Utilizing AI and machine learning to improve railroad safety: Detecting trespasser hotspots
Trespassing on the railroad remains one of the most important and challenging safety issues that railroad operators face every day. Trespassing on railroads has resulted in many unfortunate incidents, including injuries, disruptions to rail services and fatalities. There are many methods currently in place by rail operators to help in reducing the number of incidents such as physical barriers, signage and increased patrolling. However, these conventional methods have limitations, as they are costly, often incomplete and difficult to maintain, particularly in rural or remote areas. Additionally, current methods typically react to incidents rather than proactively prevent them. While these methods have helped to deter trespassers and reduce incidents, there is always more that can be done to help address this pressing safety issue.
Every year, there are hundreds of incidents that occur due to unauthorized presence on railroad property. The issue of trespassing is ongoing, and there will always be a need for innovation and improvements in the rail industry. In recent years, there have been many improvements in technology with artificial intelligence (AI) and machine learning (ML) methodologies. These new methodologies are not only capable of expanding upon the current methods mentioned above by potentially pinpointing areas of focus, but they also offer promising new solutions to improve safety in railroad operations and reduce trespassing incidents by predicting where trespassing is likely to occur.
ENSCO has explored how new AI and ML methods can be utilized to help reduce trespassing incidents and improve railroad safety. These advances offer an opportunity to predict and prevent trespassing events before they occur. By examining anonymized location data from devices operating within geofenced rail corridors, areas can be identified where users are suspected to “linger,” which often indicates higher regions of trespassing. These locations are known as trespassing hotspots.
Overview of AI and ML solutions
AI and ML have emerged as powerful technologies for addressing complex challenges in railroad safety. These methods have advanced capabilities that allow computer algorithms to continuously learn and identify patterns even within large datasets. This allows for continuous monitoring with the potential to differentiate between what is trespassing and normal, or authorized behavior, such as walking across a designated sidewalk railroad crossing. A key component in determining trespasser hotspots is the use of anonymized location data from mobile devices along the rail corridor. Figure 1 reviews historical anonymous location data along the rail corridor that allows AI and ML models to distinguish patterns in human behaviors and identify areas where trespassing is likely to occur and report them as trespasser hotspot locations.
To effectively reduce trespassing incidents, AI and ML models need to accurately detect when and where unauthorized access occurs along the rail corridor. Models examine large amounts of anonymous location information from mobile devices over extended periods of time in order to distinguish patterns. These patterns, along with other important factors like time of day, physical location and velocity, are used to distinguish the difference between what may be normal or legal human activity and trespassing activity.
For example, we do not want to report a hotspot area at a railroad station if we only see activity during business hours, but if activity appears in the middle of the night when passenger trains are not operating that could be reported as a trespassing hotspot where further action for prevention may need to be taken. The velocity of the device pings is also an important factor to consider when evaluating around the rail corridor.
Device pings can appear to be on the track in what may look like a trespassing event but could actually be devices on a passenger train. Using the velocity of the device pings models can determine whether a person may be in a train, vehicle or walking along the tracks. These factors and others all play a role in using ML models to differentiate patterns and predict human behavior.
Integrating anonymous mobile location data not only enables rail operators to predict and prevent future trespassing incidents, but also potentially detect near real time active trespassing events and act accordingly. Reporting there was an active trespassing event even in the past few days can decrease response time to these events and allow railroads to more quickly react and put preventative measures in place. This targeted approach allows for more rapid and informed decision making to proactively reduce trespassing incidents and improve railroad safety.
Transportation Technology Center (TTC)
One limitation of using anonymous historical mobile location data is that it is difficult to verify and be 100% certain of what is shown in the data without a ground truth analysis. A ground truth analysis is vital to test the accuracy of AI and ML models and can also be used to generate a controlled data set. To complete a ground truth assessment, ENSCO researchers generated different testing scenarios at the Transportation Technology Center (TTC) in Pueblo, Colo., shown in Figure 2.
The TTC provided a safe and controlled space to simulate various pedestrian behaviors around railroad tracks and features. During these scenarios, researchers simulated both trespassing behavior and normal human behavior to gather realistic data to test the accuracy of AI and ML models. Some of the different scenarios include unauthorized walking along the track, legal sidewalk crossing and loitering near the track.
To complete the ground truth analysis, multiple burner phones were utilized during each scenario to generate mobile device location data. This data was then evaluated by the ML models and output potential trespassing hotspots. With the new models several patterns were identified as trespassing events, and ENSCO was able to validate patterns were accurately detected as trespassing. For example, a trespassing hotspot was identified where there was prolonged stationary behavior (loitering) in one area. Comparing the output of the model generated results with the known testing scenarios can validate the accurate detection of the hotspot.
Trespasser hotspot user interphase
To effectively manage the large amounts of anonymous location data, ENSCO created an interactive user interface to analyze and investigate the trespasser hotspots reported by the model. Through interactive maps and visual summaries, operators can easily pinpoint trespassing hotspots and evaluate the surrounding area, allowing railroad personnel to investigate hotspot areas and determine what may be beneficial to reduce trespassing at that specific location before sending personnel to manually inspect the area. This is where the environmental context of the area plays a key role. The models incorporate land use data into the model processing, which allows for further distinguishing between human patterns in the data.
For example, being able to distinguish between a legal sidewalk railroad crossing and an unauthorized footpath that crosses the tracks. Such information equips rail safety teams with the evidence needed to strategically allocate resources, plan preventive measures and enhance enforcement efforts in areas with the highest risk. Evaluating the environment at the hotspot locations also allows railroad operators to know ahead of time what conventional prevention methods could be implemented at that location. Intruding fencing to block footpaths or adding barriers around crossings.
Benefits
Implementing AI and ML solutions for detecting railroad trespassers offers substantial benefits, with significant potential to improve overall safety for all rail users. AI and ML models enable railroad personnel to intervene proactively rather than reacting after incidents occur, potentially reducing the number of future trespassing incidents. By improving hotspot detection, rail operators can strategically allocate resources to areas of greatest concern.
Such targeted interventions have the potential to significantly decrease the number of trespassing incidents, resulting in fewer injuries and fatalities on rail property. Beyond immediate improvements, AI and ML based detection has broader implications for railroad safety management, benefiting both rural and urban environments. In rural areas, where monitoring large expanses of track is challenging due to limited resources, these new models can provide efficient surveillance over extended distances. In densely populated urban settings, advanced analytics can distinguish normal, everyday movement from genuine trespassing threats, minimizing false alarms and improving enforcement efforts.
Overall, integrating AI and ML methods into railroad trespassing detection will not only benefit rail operators but lead to a safer rail environment. While these new methods have shown substantial promise in improving railroad safety, ongoing research and development remain essential. Future efforts will extend these innovative technologies from historical analysis and near real time reporting to actively detecting trespassing events as they occur. Dense populations, increased device activity and intricate urban landscapes require refined analytical methods and tailored solutions to effectively manage trespassing detection.
At the same time, privacy considerations and data security remain at the forefront of this research, requiring constant vigilance to ensure anonymity and compliance with evolving privacy standards. The significant benefits provided by the advanced ML models in trespasser detection include improved accuracy, faster response times, targeted resource allocation and potentially fewer trespassing incidents, all highlight the importance of continued innovation in railroad safety.
Conclusion
Rail trespassing is a deeply rooted challenge, but it is not unsolvable. By applying AI responsibly through data-driven hotspot analysis, integration with existing infrastructure and community-focused safeguards, transit agencies can shift from reacting to incidents toward proactively preventing them. As these technologies mature, partnerships between industry, government and communities will be key to creating a safer and more reliable rail network.
About the Author

Samantha Kirkpatrick
Senior Data Scientist, ENSCO, Inc.
Samantha Kirkpatrick is a senior data scientist in ENSCO’s Surface Transportation Group. In her current role, she is managing the Rail Surface Imaging System and working with the Federal Railroad Administration (FRA) on a trespassing detection project. She’s also a part-time contractor for the FRA as part of its Business Intelligence Services team.
She received her bachelor’s degree in mathematics with a focus in statistics from the College of Charleston. She joined ENSCO in 2018 through ENSCO’s intern program.
Donald Tweedie III
Engineering Psychologist, Federal Railroad Administration Office of Research, Development, and Technology
Donald Tweedie III is an engineering psychologist at the Federal Railroad Administration's Office of Research, Development and Technology, based in Washington, D.C.