An Algorithm for Detecting Collision Risk between Trucks and Pedestrians in the Connected Environment

+is study develops an algorithm to detect the risk of collision between trucks (i.e., yard tractors) and pedestrians (i.e., workers) in the connected environment of the port. +e algorithm consists of linear regression-based movable coordinate predictions and vertical distance and angle judgments considering the moving characteristics of objects. Time-to-collision for port workers (TTCP) is developed to reflect the characteristics of the port using the predictive coordinates. +is study assumes the connected environment in which yard tractors and workers can share coordinates of each object in real time using the Internet of +ings (IoT) network. By utilizing microtraffic simulations, a port network is implemented, and the algorithm is verified using data from simulated workers and yard trucks in the connected environment. +e risk detection algorithm is validated using confusion matrix. Validation results show that the true-positive rate (TPR) is 61.5∼98.0%, the false-positive rate (FPR) is 79.6∼85.9%, and the accuracy is 72.2∼88.8%.+is result implies that the metric scores improve as the data collection cycle increases.+is is expected to be useful for sustainable transportation industry sites, particularly IoT-based safety management plans, designed to ensure the safety of pedestrians from crash risk by heavy vehicles (such as yard tractors).


Introduction
Technologies, educational programs, and policies designed to prevent industrial accidents have been widely implemented, and accidents are on the decline in various industrial sectors. However, accidents are still common at ports. According to the Korea Maritime Institute, the accident rate for port workers stood at 9.46 per thousand as of 2017, double the average of 4.84 for all Korean industries. is is 1.5 times greater than the rate in the transportation sector, in which traffic accidents occur more frequently. Port activities involve manual tasks associated with binding and, depending on the type of cargo, loading and unloading, and storage methods. Collisions, falling objects, and falling accidents occur frequently in ports [1]. e severity of an accident is higher compared to those in the industrial sector in general because heavy equipment is involved. e most frequent and accidental accident is collision. At a port, most heavy equipment emits a warning sound to prevent collisions in advance. is makes it difficult for the operator to recognize access equipment (such as yard tractors), and accidents in these circumstances can be fatal. In the yard area of a port, there are two main cases of collision that can occur between workers and trucks (Table 1).
Collisions between workers and equipment in port yards are similar to pedestrian-vehicle crashes on roads, which constitute a leading concern in traffic safety. Multiple algorithm-based technologies have been developed to avoid collisions, including the forward crash warning system [2][3][4][5]. e concept of time-to-collision (TTC), which is used frequently in these algorithms, is defined in relation to the preceding and following vehicles [6]. e following equation [7,8] provides a mathematical description of the concept: where h is the space headway and L is the length of the preceding vehicle. V F and V P refer to the speeds of the following and preceding vehicles, respectively. e TTC assumes that the preceding vehicle maintains a constant speed. As a result, traditional TTCs are limited in their ability of expressing dynamic situations in which speed changes rapidly on real roads. To address this shortcoming, researchers have developed complementary algorithms such as inverse TTC, time-exposed TTC, and time-integrated TTC, for use in collision-risk detection technologies [9][10][11][12][13].
TTC is used not only in detection algorithms as an indicator of real-time collisions, but also in assessing safety levels based on trajectory [14]. TTC is a representative indicator for the assessment of safety, and indicators such as postencroachment time (PET) and the deceleration rate to avoid a crash are used for analysis [15,16]. In 2003, Yang et al. developed a hydraulically based system for use in a rear-end collision warning and avoidance [17]. In the carfollowing situation, the warning system was designed with a condition-space-based approach. In 2018, Wu et al. developed an algorithm to determine the risk of a rear-end collision using real-time data. Unlike previous research, the Wu et al. study developed collision-prevention algorithms by processing real-time data that can be used in connected vehicle environments [18]. In 2019, Wu et al. used PET as an indicator for a safety analysis of the conflicting section between the bicycle road and the vehicle driveway. e authors analyzed the mechanical behavior between bicycles and vehicles to develop an algorithm that estimated crash risks and triggered a warning alarm [19]. In 2006, Oh et al. proposed a method of determining the risk of rear-end crashes using loop-detector data and applying the concept of a safe stopping distance. e relationship between the preceding and following vehicles in a collision can be expressed mathematically [20]. In 2016, Lee and Yeo developed a collision-warning algorithm based on a multilayer perceptron neural network. An algorithm was proposed to provide collision-warning information by predicting the right of influence and deceleration of passage time and utilizing segment information collected by a roadside communication unit [7]. In 2020, Yue et al. conducted a study from the vehicle's perspective using a pedestrian-tovehicle (P2V) driving simulator to predict and avoid pedestrians in pedestrian-vehicle collisions. Research has been conducted to improve P2V technology from the driver's perspective, which differs from the pedestrian's perspective, to increase pedestrian safety [21]. In 2019, Wu et al. proposed a system of risk assessment for pedestrian-vehicle collisions. Using data collected from Lidar and other sensors, they predicted pedestrian crossing intentions using a trajectory prediction model and analyzed risks based on a dynamic Bayesian network [22].
Other studies developed vehicle-to-vehicle communications systems that assume a smooth communications environment and perform a rear-end collision-risk analysis based on intervehicle information and collected communications [23][24][25]. Sensor-based studies that prioritize nearfield networks to determine accident risks are already being used throughout the industry. However, research on longdistance communication using global positioning satellite (GPS) data is still being carried out with an eye to commercialization as it requires technical improvements, such as less battery maintenance and superior GPS reception. In 2017, Chen et al. calculated alternative safety indicators, such as TTC and PET between vehicles and pedestrians, to assess safety at intersections under specific conditions and times [26].
e study featured an analysis of traditional TTC problems and P2V relationships by applying formulas. In 2019, Li et al. attempted to predict the maneuverability of adjacent vehicles through inferences based on probability methodologies such as Bayesian networks. e resulting dynamic features have been presented and are considered significant advancements in terms of real-time risk management [27].
Most TTC-based algorithm technologies have been approached from a vehicle perspective [7,17,21,23,26,28,29] and little relevant research has been conducted to help pedestrians avoid collisions with vehicles [26,30]. In Table 1: Examples of collision-risk situations between pedestrian and truck.

No.
Situation Visualization 1 e worker is working or waiting in the yard. e yard tractor is driving on the road at normal speed and approaching the worker's location. e worker is not aware of the approaching tractor.
2 e worker is on the move. e yard tractor is driving on the road at normal speed and approaching the worker's location. e worker is not aware of the approaching tractor.
2 Journal of Advanced Transportation this study, a vehicle-collision avoidance algorithm is proposed from the perspective of the pedestrian (worker). In a port, devices can be distributed to workers to facilitate the collection and management of data. e device is developed using IoT-based GPS technology and can determine the realtime location of workers and equipment. ese IoT-based collision-risk detection technologies are expected to be applied first in traffic environments that guarantee the safety of pedestrians. e algorithm technology described in this study is expected to play an important role in planning pedestrian traffic safety measures in future sustainable pedestrian-oriented traffic environments. e purpose of this study is to develop detection techniques that can predict pedestrian collision risks using connected technology under special conditions, such as lowtraffic ports or nonsignal intersections. e movable objects of the port terminal travel in a designated direction through a designated road, but pedestrians cannot specify the direction of progress due to their characteristics. Considering this, in this study, the speed, direction, and location of the equipment are defined by the change in relative distance as predictions. A collision-risk detection algorithm is developed reflecting the defined concept, which is validated using microtraffic simulations. With reference to the performance of the device that can be applied to the field, a simulation scenario with different data collection cycles is designed. Validation of the algorithm was performed by considering differences in risk detection accuracy on a collection cycle basis.

Prediction of Relative Space.
In this study, risk indicators were calculated based on traditional TTC concepts. Traditional TTCs are used not only for crash risk detection, but also for conflict-based safety analysis at intersections and certain other sections.
is study used a risk detection methodology using latitude and longitude coordinates. e relative distance is then calculated to determine the risk as in the following equation. Euclidean distances were used to calculate the distance between coordinates: where l r is the distance between port worker and equipment and (x p , y p ) and (x e , y e ) are the coordinates of the port worker and equipment (based on geographical distances), respectively. is study produced a changing relative distance-based TTC between worker and equipment. Alternative safety indicators were then proposed to respond to and avoid expected collisions. Considering the spatial characteristics of the port, a general straight section predicted future coordinates using a linear regression model. In many previous studies of collision-warning algorithms, the perception reaction time (PRT) is assumed to be between 0 and 2.5 s [31][32][33]. In this study, response time is set in consideration of the PRT by taking into account the vehicles, the work of the port workers, and mobility characteristics. e movement of the equipment is predicted for more than 10 s from detection and recognition of, and response to, collision risk, and verification of the research methodology is carried out.
A criterion of 10 s for detecting accident risks is set given the characteristics of the port container yards. A one-yard block is compartmentalized so that it can accommodate 15 containers (20 ft) horizontally and six vertically. A block is 90 m wide and 15 m long. e speed limit of moving equipment (such as yard tractors) in the port is 30 km/h (8.3 m/s). e maximum distance the equipment can travel in 10 s is therefore 83 m. Because the width of a one-yard block is 90 m, the time of 10 s in the algorithm is the maximum prediction time to ensure that all movement up to the next direction selection can be predicted. Because the port is a difficult working environment to recognize approaching equipment, collision accidents caused by low speeds continue to occur. For example, if a yard tractor moves at a speed of 5 km/h, it can travel 13.9 m in 10 s. Due to the reduction of the hazard radius and sudden acceleration and deceleration behavior, it is necessary to select the forecast range for the next 10 s. In this study, a complementary TTC is proposed based on predicting a minimum collision distance with workers within 10 s. e minimum relative distance based on recursive algorithms can be found in the following equation: where l r,t is the relative distance between worker and equipment at any time t and (x p,t , y p,t ) and (x e,t , y e,t ) are the coordinates of port worker and equipment, respectively, at any time t. e collision risk is calculated based on the minimum value among the relative distances calculated by location information within 10 s of the future.
In order to use the collected position coordinates for analysis, a transformation work is required. Because the latitude and longitude coordinates used in this study are spherical coordinates, they should be converted to Cartesian coordinates to obtain relative distances. e haversine formula is used to convert orthogonal coordinates to the Cartesian system, and the relative distance is calculated after conversion. In this study, a regression model with recursive concept is developed to predict location coordinates. In other words, it is a method of using historical location information to produce future forecast information. In Figure 1, the recursive concept is illustrated.
When the current time is t 0 and the historical coordinates recorded before t seconds are supplied, a linear regression model can be constructed with the slope dependent on the amount of change and the regression coefficient and dependent variables as the predicted coordinates.
e y-axis coordinates (latitude) and x-axis coordinates (longitude) were predicted by building separate equations as follows: y predicted,e,t � y e,t − y e,t+1 x e,t − x e,t+1 · x predicted,e,t + e

Journal of Advanced Transportation
where y predicted,e,t and x predicted,e,t are the predicted y-axis (latitude) and x-axis (longitude) coordinates of equipment, respectively. e is a residual, and f ′ (t) is the regression coefficient of the prediction model, such that where d t is the vertical distance between the predicted directional line of the moving equipment and the worker. θ t is the degree between the equipment and the worker (Figure 2).

Time-to-Collision for Port Workers (TTCP).
e relative distance (l r ) from the current time to the predicted coordinates after 10 s has been aggregated to define the time at which l r is minimal, as seen in equation (7). In addition, changes in l r and relative velocity (v r ) between the forecast coordinates for a worker and equipment can provide a realtime rate of change (v l,Δt ) of the current relative speed. e time-to-collision for port workers (TTCP) can be calculated using the relationship between relative distance and realtime rate of change: where t min is the time at which the relative distance between objects for the future 10 s is minimum. t 0 is current time. l r,t is relative distance, and v r,Δt is the relative distance reduction rate at time t. TTCP is the time calculated for the rate at which the relative distance and relative velocity can be obtained through the prediction coordinates and the relative velocity is reduced by the amount of change in this indicator. It is the time taken to minimize l r,t from the worker, assuming that the worker's presence is recognized within a certain relative distance and that the worker moves in the predicted direction at the current speed for 10 s. e set 10 s is the maximum value that can detect all accessible objects. In this study, the TTCP threshold to determine the presence or absence of a dangerous situation is set to 4 s. According to Yue et al., given a brake reaction rate of 1.25 to 1.5 s (from the previous study), a TTC of 2 s is considered a serious precrash accident [21]. In addition, given a brake response speed and the worker's response speed of 2.5 s, a TTC of 4 s is considered dangerous. erefore, in this study, when the proposed TTCP is 4 s, the situation is considered dangerous (precrash situation). Because the maximum travel distance for 4 s at a design speed of 30 km/h is approximately 33.3 m, this is almost consistent with the relative distance-based risk assessment standard of 30 m.

Development of a Crash Risk Detection Algorithm for Port
Workers. To detect accident risks in real time by combining the proposed alternative safety indicators such as TTCP requires defining and classifying various behaviors of workers and equipment. In this study, given the basic characteristics of accidents occurring within the port, directly relevant variables were derived and considered in the algorithm. Factors judged important and reflected in the development of algorithms are work status, location (place), distance from objects (relative distance, l r ), vertical distance (d t ), degree (θ t , and approach direction (v r . According to Layton and Dixon (2012), the stopping sight distance is 31.2 m at a design speed of 30 km/h, and the typical emergency stopping distance is 14.2 m on dry road surfaces (with a response time of 2.5 s) [31]. By referring to this standard, yard trucks within 30 m of the worker and approaching the worker's direction were detected as dangerous objects. In this study, an algorithm was developed by largely dividing it into two stages based on these criteria. e first is the "risk situation judgement algorithm" that detects objects approaching within a relative distance of 15 m. e second is "collision-risk detection algorithm," which determines the designated TTCP criterion according to vertical distance (d t ) and angle (θ t . Collision-risk detection algorithm is performed only for objects determined to be dangerous by risk situation judgement algorithm. e developed algorithm is shown in Figure 3. Figure 4 provides a diagram of the algorithm to determine the risk of collision at a port. It is the process of calculating the indicators according to changes in the  Figure 1: A recursive algorithm for predicting coordinates by time. relative space between trucks and workers. is figure expresses a simple situation for understanding. In practice, the change in speed of the object can be reflected to detect changes in the TTC according to the speed.

Data Description.
is study assumes a situation in which the real-time locations of workers and equipment are collected using IoT devices. is allowed us to derive the risk of a collision accident between workers and equipment in a port yard in the form of a TTC-based risk index and detection using the collected data. Technical research is currently being carried out at the port in anticipation of the introduction of IoT devices. To implement and evaluate accident-risk detection technologies in an IoT communication environment, a virtual environment is established using microtraffic simulations. Previous studies used data collected from actual roads [12,34], where it is difficult to ensure a fully controlled environment for experimentation and implement the desired scenario.
us, in this study, simulation analyses were performed that enabled the full implementation of the planned risk scenario. In this study, the risk of a collision within a port is divided into scenarios. e actual environment and working characteristics were classified and analyzed to capture all possible situations between workers and equipment in the simulation network, and the risk of collision at the port is separated into four distinct scenarios. Trace data on workers and equipment were collected for each scenario using VISSIM, a microtraffic simulation program. e simulation time is set to a total length of 1,200 s for the collection of data, and analysis is performed by dividing the collection cycle into three categories, considering the communication performance of an actual IoT device. e period for the analysis is set to 1 Hz, 2 Hz, or 10 Hz. To simulate the movement of equipment and yard tractors in the port, movement at the actual port is analyzed and the average speed is below 30 km/h. Network settlement and verification efforts were not carried out because the objective is to detect the risk of collision between workers and equipment in certain situations without considering intervehicle interactions and delays in traffic. e spatial background applied in this study is Busan Sinseondae Pier ( Figure 5). e same spatial network is established using Google and Kakao maps, and photos are taken at realworld sites. Journal of Advanced Transportation 5

Results and Discussion
Algorithm verification is carried out to detect the risk of a collision between a worker and equipment within the port using trajectory data collected in the analysis network and VISSIM. e analysis is performed by dividing the data into three scenarios according to the frequency of the information collection. Simulation experiments were conducted according to the information collection cycle. To evaluate the risk detection performance of the algorithm, the risk situation is defined as follows: (1) If the relative distance is within 30 m and the relative distance is decreasing, the relative velocity (v r ) is positive and the mobile device is approaching (2) Relative distance within 15 m In this study, the confusion matrix is used to evaluate the detection performance of the algorithm. As a criterion for determining the accuracy of the predicted value, the above two situations were set as the actual class (Table 2). e confusion matrix is used to compare the number of true and false predicted values and actual values. e simulation results of algorithm are classified into four categories to evaluate detection accuracy as follows: True positive (TP): the algorithm predicted that a situation is dangerous, and it is true False positive (FP): the algorithm predicted that a situation is dangerous, and it is false False negative (FN): the algorithm predicted that a situation is normal, and it is false True negative (TN): the algorithm predicted that a situation is normal, and it is true True positive rate (TPR) � recall(sensitivity) False positive rate (FPR) � 1 − specificity accuracy � TP + TN TP + FN + FP + TN .
True-positive rate (TPR), also called sensitivity, refers to how accurately the algorithm classifies dangerous situations (TP + FN), as seen in equation (8). False-positive rate (FPR) indicates how accurately the algorithm classifies normal situations (TN + FP), as seen in equation (9). Accuracy is an indicator that considers both TP and TN, which can most intuitively represent the performance of the algorithm [35], as seen in equation (10). e numbers of samples according to the data collection cycle were 12,811 (1 Hz), 25,147 (2 Hz), and 137,254 (10 Hz), respectively. e confusion matrix and metric scores are presented in Tables 3-6. e metric scores of 1 Hz show 61.5%, 79.6%, and 72.2%. is score is the smallest of three data collection cycle scenarios. Compared to other cycles, 1 Hz has a longer prediction unit. erefore, this result is seen as an increase in error within the prediction unit. For 2 Hz, the data were every 0.5 s; the metric score shows 91.8%, 85.9%, and 87.5%. Finally, for 10 Hz and the shortest collection cycle, the metric score shows 98.0%, 85.4%, and 88.8%. It is obvious that the score of 10 Hz has the greatest accuracy among the cycles, which suggests that the shorter Apron Container Yard  the collection cycle, the better the performance of the algorithm.
In summary, sensitivity analysis and comparative studies have been conducted to verify the performance of the algorithm. Sensitivity analysis shows the performance of algorithms associated with data collection cycles, which means that shorter collection cycles are better in terms of detection accuracy of algorithms. Considering current technical level such as battery and equipment size, it is difficult to supply equipment with 10 Hz. erefore, it is necessary to establish equipment and servers that can provide an appropriate data collection cycle in consideration of the realistic conditions of the industrial site.

Conclusions
is study developed and verified an algorithm to detect the risk of collision accidents between port workers and equipment. A risk indicator represented by TTC is selected to provide detection of the risk of collision due to equipment in situations specified by various conditions in the port.
Traditional TTCs are the simplest collision-detection replacement safety indicators and only detect hazardous situations if certain conditions are met. Various studies have suggested improving TTCs to compensate for these problems. e purpose of this study is to develop an algorithm that considers the characteristics of pedestrian behavior by calculating the TTC between workers and equipment, not TTCs, in the situation of the next lane.
As a result, the algorithm shows 61.5-98.0% TPR, 79.6-85.9% FPR, and 72.2-88.8% Accuracy depending on the collection cycle. e algorithm validation results indicate that the metric scores increase as the collection cycle is shortened. is means that the better the performance of individual IoT devices available in the field is, the better the risk detection level of the algorithm can be. Based on these analysis results, this study argues for the need to introduce smart port equipment following technical improvements. Because it is an algorithm developed considering the spatial characteristics of ports, it is significant in terms of safety improvement in industrial sites.
However, some limitations exist in this study. First, since it is a simulation-based algorithm study assuming conditions in the field, further verification using real-world field data is required. Second, improvements are needed on the threshold baseline setting of stopping sight distance and TTC. In this study, the criteria for studies conducted in general traffic flow environments were utilized. erefore, the stopping sight distance and TTC settings that are optimized for a port environment are needed [30,36]. ird, the accuracy improvement of the algorithm can be performed by utilizing various prediction and verification methodologies. In this study, predictive method is used for real-time contextual judgement and algorithm optimization. However, since machine learning-based positional coordinate prediction studies have been conducted, various prediction methodologies need to be reviewed to improve the accuracy of algorithms [37]. In addition, studies of collisionprevention methodologies using similar techniques can be applied to improvements [38][39][40]. Future research will be considered verifying algorithms using device data collected in the field and improving services after introduction. It is expected to help prevent accidents between equipment and pedestrians at ports and other industrial sites.

Data Availability
Some or all data, models, or code that support the findings of this study are available from the corresponding author upon reasonable request.

Disclosure
is research was a part of the project titled "Development of Port Risk Prediction and Intelligent Port Safety Management Technologies".

Conflicts of Interest
e authors declare no conflicts of interest.