# Innovative Research of Trajectory Prediction Algorithm Based on Deep Learning in Car Network Collision Detection and Early Warning System

Authors: Rongxia Wang; Malik Bader Alazzam; Fawaz Alassery; Ahmed Almulihi; Marvin White
Journal: Mobile Information Systems
 (2021)

---

## Abstract

Predicting the trajectories of neighboring vehicles is essential to evade or mitigate collision with traffic participants. However, due to inadequate previous information and the uncertainty in future driving maneuvers, trajectory prediction is a difficult task. Recently, trajectory prediction models using deep learning have been addressed to solve this problem. In this study, a method of early warning is presented using fuzzy comprehensive evaluation technique, which evaluates the danger degree of the target by comprehensively analyzing the target’s position, horizontal and vertical distance, speed of the vehicle, and the time of the collision. Because of the high false alarm rate in the early warning systems, an early warning activation area is established in the system, and the target state judgment module is triggered only when the target enters the activation area. This strategy improves the accuracy of early warning, reduces the false alarm rate, and also speeds up the operation of the early warning system. The proposed system can issue early warning prompt information to the driver in time and avoid collision accidents with accuracy up to 96%. The experimental results show that the proposed trajectory prediction method can significantly improve the vehicle network collision detection and early warning system.


---

## Body

## 1. Introduction

With the vigorous development of mobile Internet technology, global positioning technology, Internet of Things (IoT), and gradual popularization of smart wearable devices, massive amounts of mobility data have been generated [1]. The mobility data includes traffic trajectory data, human movement data, animal migration data, and trajectory data generated by other movable objects. Typically, trajectory data has the characteristics of timing, data sampling frequency, and uneven quality. The analysis and mining of traffic trajectory data can predict the location and regional distribution of vehicles in the future and has become an active ongoing research field [2].Autonomous vehicles have undergone remarkable growth over the past decade for both safety and effective mobility. The advent of advanced driving assistance systems (ADAS) is of interest to vehicles equipment manufacturing to decrease the number of traffic accidents. Vehicles with ADAS such as adaptive cruise control and emergency brakes system are already present on the road [3]. On ADAS, the collision warning system (CWS) can forecast a collision situation and warn the driver. The collision warning system detects the vehicle ahead through the machine’s vision system and warns when there is a risk of rear collision [4]. The development of a detection and early warning system can remind drivers of possible risks at any time, reduce the property losses of victims caused by road traffic accidents, and promote major technological problems in the engineering field and related research. This means that observing the traffic scene, predicting the trajectory of neighboring vehicles, and detecting collision are important tasks. However, detecting the trajectory of the neighboring vehicles is relatively difficult to work since it depends on the characteristics of each driver and various traffic conditions [5].Vehicle trajectory prediction plays an important role in both ADAS and autonomous vehicles [6]. Likun et al. [7] proposed a vehicle trajectory prediction algorithm in a crossing scene. To obtain the characteristics of vehicle movement, a method for data labeling and vehicle orientation regression was developed. Using hierarchical function as the field of discussion, fuzzy logic rules are constructed to describe the conversion between different vehicle states and motion models. By deriving the probability of each motion model, switched Kalman filter (KF) was used to further predict the vehicle trajectory within the next 1.5 s. However, their errors were found in the process of using this method to predict, resulting in inaccurate results. Lemon et al. [8] tested whether perceptual learning training can improve the collision detection performance of vehicle subjects. Eight older subjects participated in the experiment, which lasted 7 days and was conducted for 1 hour a day. Before training, the collision detection threshold of three observer velocities was measured using a forced selection procedure of two choices. During this process, participants indicated whether the approaching object would cause a collision or a noncollision event. In another experiment, the participant was trained to approach the threshold for 5 days at one of these speeds. After training, the participant’s threshold was measured again. However, due to the small number of samples in the experiment, there are errors in the results. A collision warning system based on a single Mobil eye is proposed in [9], where rear-end vehicle collisions are considered and the time to collision (TTC) is calculated to generate a warning. The authors in [10] employed a crossroad scenario of the two vehicles with GPS receivers and communication devices to detect trajectory. A rear-end collision warning system-based nonneural network is proposed by Xiang et al. [11], where vehicles employ GPS sensor and communicating devices and are supposed to be moving in the same lane. Morzy [12] developed a hybrid model using the frequency pattern tree and Prefix Span algorithm for the prediction of the trajectories. Likewise, Monreale et al. [13] designed a T-pattern tree to determine the occurrence of the trajectory patterns for estimating the subsequent location. However, this method is computationally expensive to recognize such frequent trajectory patterns.Recently, owing to the high performance of deep learning techniques, the researchers have started to replace the conventional machine learning techniques with these approaches for trajectory prediction. Wang et al. [14] used a deep learning-based model human movement prediction framework using a long short-term memory (LSTM) network. The user’s historical trajectories were used to train the model, and the original model of LSTM was enhanced to be a multiuser, region-oriented structure by integrating the sequence-to-sequence modeling. The model showed improved generalization abilities. The authors in [15] applied a recurrent neural network (RNN) for predicting the precise coordinates of the next target based on the taxi driver’s actions. In this study, a deep learning method is applied to predict the vehicle trajectory and build a vehicle detection system. Moreover, the fuzzy comprehensive evaluation technique is used to evaluate the danger degree of the target by analyzing the target’s position, horizontal and vertical distance, speed of the vehicle, and the time of the collision. An early warning activation area is constructed in the system, and the target state decision module is triggered only when the target enters the activation area, which improves the accuracy of early warning and reduces the false alarm rate.The paper is organized into multiple sections. In Section2, the proposed vehicle trajectory prediction algorithm is presented. In Section 3, the different strategies for setting the activation area are discussed. Section 4 is about the results, and the conclusion is presented in Section 5.


## 2. Vehicle Trajectory Prediction Algorithm Based on Deep Learning

### 2.1. Deep Learning

Deep learning is making major improvements in solving problems that have repelled the best efforts of the researchers in artificial intelligence community for several years. It has proved to be very good at discovering complex structures in high-dimensional data and is therefore applied in many domains of science and technology. In addition to providing the highest performance in image recognition and speech recognition, it has beaten other machine learning techniques at predicting the activity of potential drug molecules, reconstructing brain circuits, and predicting the effects of mutations in noncoding DNA on gene expression and disease. Deep learning is a group of algorithms motivated by the structure and function of the human brain called artificial neural networks. Deep learning uses a large amount of training data to build a model structure with several hidden layers and combines low-level features to form more abstract deep features, thereby improving the accuracy of the final classification or prediction. In deep learning algorithms, learning can be supervised, semisupervised, or unsupervised, and there are as many as 5–10 hidden layers. Deep learning has many similarities and differences with traditional neural networks. Both adopt a layered structure, that is, a multilayer network composed of an input layer, a hidden layer (multilayer), and an output layer [16]. The traditional artificial neural network (ANN) uses the error backpropagation (BP) algorithm to adjust the parameters and iteratively updates the weights and biases to train the entire ANN. First, randomly set the initial values of parameters such as weights and biases, then calculate the output under the current ANN, and change the parameters according to the difference between it and the output of the original sample set, so that the final output result reaches convergence [17]. This overall process is based on the gradient descent method, which uses the negative gradient direction as the search direction. But when the traditional ANN has too many layers (i.e., more than 7 layers), the residual error propagated to the front layer will become smaller. It is prone to gradient diffusion, and it is difficult to adjust the parameters of each layer. In addition, when the number of layers is too small (less than or equal to 3), the effect of the ANN is not optimal compared with other linear regression methods, and the training speed is still relatively slow.To improve the shortcomings in the training of ANN models, deep learning uses a different training mechanism. It adopts a layer-by-layer initialization training mechanism and achieves the approximation of complex functions through unsupervised learning of a deep nonlinear network structure. Moreover, the feature representation of the sample data in the original space is transformed into a new feature space. This process can be seen as a layer-by-layer feature transformation. Therefore, when adjusting the feedback, deep learning can avoid the sparse gradient (i.e., the error correction signal is getting smaller and smaller from the top layer), and the convergence is likely to cause local minimum problems.


### 2.2. Target Detection Algorithm for Deep Learning

Deep learning attempts to imitate the structure and computation methods of biological neural networks. It builds a multihidden network, trains on a large number of data samples, and learns the essential characteristics of the data samples to achieve strong generalization capabilities. Building a deep learning model mainly involves the selection of neuron types, topological structures, and learning rules [18].By increasing the power of computer equipment and creating a large number of educational data sets, deep learning has been developed. In terms of target detection, the speed and accuracy of target detection have made great discoveries. In contrast, YOLOv2 is slightly better, but it targets dozens of detection targets. YOLO uses neural networks to provide real-time object detection. This algorithm is popular because of its speed and accuracy. It has been widely applied in various applications to detect people, traffic signals, parking meters, and animals. It is an object detector that employs the distinct patterns learned by a deep neural network to detect an object. YOLOv2 uses a single neural network to foresee bounding boxes and class probabilities directly from complete images in one inference. It segments the input image intoG×G grids. Each cell in the grid predicts l bounding boxes and confidence scores of bounding boxes, as well as m conditional class probabilities. To better complete the task of detecting vehicle collisions, this study improves the YOLOv2 network and builds the YOLO-R network [19].The whole detection process is divided into full-line detection and offline training. In offline training, the collected training group is sent to the YOLO-R network for training, and, finally, the weighted information of the network is extracted. In the full-line detection first, a frame of image is entered as input; after the YOLO-R network is trained, it creates the output target position and category confidence information and then uses the matching algorithm to find out the rectangular frame of the collision vehicle that matches the vehicle and merge the two rectangular frames to complete classification of vehicles. Finally, according to the detected target position, the Kalman filter is used to predict the possible position of the target at the next moment, and the optimal similarity match is performed with the detection result [20]. Kalman filter is an algorithm that estimates some unknown variables given the measurements observed over time. Kalman filters have relatively simple form and require small computational power. Kalman filtering is a recursive process that detects the state estimate as well as the uncertainty of the estimate, given the previous knowledge of the state and the measurements collected at present. The Kalman filter decreases the measurement noise and computes the errors related to each computed state element [21].


### 2.3. Trajectory Prediction Algorithm

Vehicle trajectory prediction refers to the use of historical trajectory data of the vehicle. When the destination is unknown, a certain prediction model is used to give the precise position of the vehicle at the next moment or multiple consecutive moments [22] and [23]. Before the development of the vehicle position prediction model, the historical trajectory data of the vehicle needs to be preprocessed. The preprocessing process is divided into four steps.


#### 2.3.1. Filtering

The process of filtering is applied to filter the data of error track points and repeated track points in vehicle tracks. In the geographical positioning system (GPS) trajectory data of the vehicle, there are obvious error data points. After obtaining the time interval and spatial distance between the GPS trajectory points, the GPS positioning points with obvious errors are removed.


#### 2.3.2. Subtrajectory Division

According to the time interval and the spatial distance, the trajectory that does not occur during the continuous driving period is divided, and the trajectory data associated with the user’s multiple driving behaviors is obtained.


#### 2.3.3. Index of Vehicle Trajectory Data

The index of vehicle subtrajectory data is used to provide underlying support for the access of vehicle trajectory data.


#### 2.3.4. Sparse Trajectory Completion Based on Clustering

The distance-based K-Modes algorithm is used to cluster the historical subtrajectories of vehicles, and the trajectory points are complimented for sparse trajectories based on the clustering results. The number of trajectory points in the trajectory is increased to improve the quality of trajectory data. After preprocessing of the vehicle data is completed, the historical vehicle trajectory data is used as input for training and the vehicle trajectory prediction model is developed to predict the vehicle position at the next moment.


### 2.4. Vehicle Detection Algorithm

The interframe difference method, also known as the time domain difference, is used to extract video images in successive two or three frames; subtraction operation is applied to obtain a difference image. The changing area in motion is detected by the different images. This interframe difference method is the basic detection method of moving vehicles [24]. The position of the moving object is obtained by subtracting two consecutive frames of the vehicle images. The vehicle detection method using the interframe difference method is based on the trees and lanes of the road environment and the close-range video frame environment taken by the camera with a fixed position and angle. Since the position of the vehicle moves between the two frames, there is a specific difference between the pixel values of the vehicle positions of the two frames and the corresponding positions of the other frames. The pixel values of these two frames of the image in the video stream are subtracted to obtain the position information of the moving vehicle.When using the difference between the vehicle detection frames in the video stream, two adjacent or close images are extracted, then the different function is employed in the pixel value corresponding to the pixel position, and the result of the operation greater than a certain limit such as 1 is specified. Other values are defined as 0, which is a dual function. Therefore, the pictogram defined in equation (1) constitutes the outline (foreground) of the moving vehicle, and other parts are regarded as the background. The interframe difference method can be expressed as follows:(1)Atx,y=Btx,y−Bt−ix,y,(2)Ax,y=1,Atx,y>T,0,Atx,y≤T,where Atx,y indicates that the difference operation is performed at the tth frame to obtain the absolute value, Btx,y shows the pixel gray value at the position (x, y) of the extracted image of the tth frame, ti is the tith frame, and i is the frame difference. T is the threshold for estimating the background or the foreground, and A (x, y) represents the result of the interframe difference operation at the corresponding position (x, y) of the two pictures.


## 2.1. Deep Learning

Deep learning is making major improvements in solving problems that have repelled the best efforts of the researchers in artificial intelligence community for several years. It has proved to be very good at discovering complex structures in high-dimensional data and is therefore applied in many domains of science and technology. In addition to providing the highest performance in image recognition and speech recognition, it has beaten other machine learning techniques at predicting the activity of potential drug molecules, reconstructing brain circuits, and predicting the effects of mutations in noncoding DNA on gene expression and disease. Deep learning is a group of algorithms motivated by the structure and function of the human brain called artificial neural networks. Deep learning uses a large amount of training data to build a model structure with several hidden layers and combines low-level features to form more abstract deep features, thereby improving the accuracy of the final classification or prediction. In deep learning algorithms, learning can be supervised, semisupervised, or unsupervised, and there are as many as 5–10 hidden layers. Deep learning has many similarities and differences with traditional neural networks. Both adopt a layered structure, that is, a multilayer network composed of an input layer, a hidden layer (multilayer), and an output layer [16]. The traditional artificial neural network (ANN) uses the error backpropagation (BP) algorithm to adjust the parameters and iteratively updates the weights and biases to train the entire ANN. First, randomly set the initial values of parameters such as weights and biases, then calculate the output under the current ANN, and change the parameters according to the difference between it and the output of the original sample set, so that the final output result reaches convergence [17]. This overall process is based on the gradient descent method, which uses the negative gradient direction as the search direction. But when the traditional ANN has too many layers (i.e., more than 7 layers), the residual error propagated to the front layer will become smaller. It is prone to gradient diffusion, and it is difficult to adjust the parameters of each layer. In addition, when the number of layers is too small (less than or equal to 3), the effect of the ANN is not optimal compared with other linear regression methods, and the training speed is still relatively slow.To improve the shortcomings in the training of ANN models, deep learning uses a different training mechanism. It adopts a layer-by-layer initialization training mechanism and achieves the approximation of complex functions through unsupervised learning of a deep nonlinear network structure. Moreover, the feature representation of the sample data in the original space is transformed into a new feature space. This process can be seen as a layer-by-layer feature transformation. Therefore, when adjusting the feedback, deep learning can avoid the sparse gradient (i.e., the error correction signal is getting smaller and smaller from the top layer), and the convergence is likely to cause local minimum problems.


## 2.2. Target Detection Algorithm for Deep Learning

Deep learning attempts to imitate the structure and computation methods of biological neural networks. It builds a multihidden network, trains on a large number of data samples, and learns the essential characteristics of the data samples to achieve strong generalization capabilities. Building a deep learning model mainly involves the selection of neuron types, topological structures, and learning rules [18].By increasing the power of computer equipment and creating a large number of educational data sets, deep learning has been developed. In terms of target detection, the speed and accuracy of target detection have made great discoveries. In contrast, YOLOv2 is slightly better, but it targets dozens of detection targets. YOLO uses neural networks to provide real-time object detection. This algorithm is popular because of its speed and accuracy. It has been widely applied in various applications to detect people, traffic signals, parking meters, and animals. It is an object detector that employs the distinct patterns learned by a deep neural network to detect an object. YOLOv2 uses a single neural network to foresee bounding boxes and class probabilities directly from complete images in one inference. It segments the input image intoG×G grids. Each cell in the grid predicts l bounding boxes and confidence scores of bounding boxes, as well as m conditional class probabilities. To better complete the task of detecting vehicle collisions, this study improves the YOLOv2 network and builds the YOLO-R network [19].The whole detection process is divided into full-line detection and offline training. In offline training, the collected training group is sent to the YOLO-R network for training, and, finally, the weighted information of the network is extracted. In the full-line detection first, a frame of image is entered as input; after the YOLO-R network is trained, it creates the output target position and category confidence information and then uses the matching algorithm to find out the rectangular frame of the collision vehicle that matches the vehicle and merge the two rectangular frames to complete classification of vehicles. Finally, according to the detected target position, the Kalman filter is used to predict the possible position of the target at the next moment, and the optimal similarity match is performed with the detection result [20]. Kalman filter is an algorithm that estimates some unknown variables given the measurements observed over time. Kalman filters have relatively simple form and require small computational power. Kalman filtering is a recursive process that detects the state estimate as well as the uncertainty of the estimate, given the previous knowledge of the state and the measurements collected at present. The Kalman filter decreases the measurement noise and computes the errors related to each computed state element [21].


## 2.3. Trajectory Prediction Algorithm

Vehicle trajectory prediction refers to the use of historical trajectory data of the vehicle. When the destination is unknown, a certain prediction model is used to give the precise position of the vehicle at the next moment or multiple consecutive moments [22] and [23]. Before the development of the vehicle position prediction model, the historical trajectory data of the vehicle needs to be preprocessed. The preprocessing process is divided into four steps.


### 2.3.1. Filtering

The process of filtering is applied to filter the data of error track points and repeated track points in vehicle tracks. In the geographical positioning system (GPS) trajectory data of the vehicle, there are obvious error data points. After obtaining the time interval and spatial distance between the GPS trajectory points, the GPS positioning points with obvious errors are removed.


### 2.3.2. Subtrajectory Division

According to the time interval and the spatial distance, the trajectory that does not occur during the continuous driving period is divided, and the trajectory data associated with the user’s multiple driving behaviors is obtained.


### 2.3.3. Index of Vehicle Trajectory Data

The index of vehicle subtrajectory data is used to provide underlying support for the access of vehicle trajectory data.


### 2.3.4. Sparse Trajectory Completion Based on Clustering

The distance-based K-Modes algorithm is used to cluster the historical subtrajectories of vehicles, and the trajectory points are complimented for sparse trajectories based on the clustering results. The number of trajectory points in the trajectory is increased to improve the quality of trajectory data. After preprocessing of the vehicle data is completed, the historical vehicle trajectory data is used as input for training and the vehicle trajectory prediction model is developed to predict the vehicle position at the next moment.


## 2.3.1. Filtering

The process of filtering is applied to filter the data of error track points and repeated track points in vehicle tracks. In the geographical positioning system (GPS) trajectory data of the vehicle, there are obvious error data points. After obtaining the time interval and spatial distance between the GPS trajectory points, the GPS positioning points with obvious errors are removed.


## 2.3.2. Subtrajectory Division

According to the time interval and the spatial distance, the trajectory that does not occur during the continuous driving period is divided, and the trajectory data associated with the user’s multiple driving behaviors is obtained.


## 2.3.3. Index of Vehicle Trajectory Data

The index of vehicle subtrajectory data is used to provide underlying support for the access of vehicle trajectory data.


## 2.3.4. Sparse Trajectory Completion Based on Clustering

The distance-based K-Modes algorithm is used to cluster the historical subtrajectories of vehicles, and the trajectory points are complimented for sparse trajectories based on the clustering results. The number of trajectory points in the trajectory is increased to improve the quality of trajectory data. After preprocessing of the vehicle data is completed, the historical vehicle trajectory data is used as input for training and the vehicle trajectory prediction model is developed to predict the vehicle position at the next moment.


## 2.4. Vehicle Detection Algorithm

The interframe difference method, also known as the time domain difference, is used to extract video images in successive two or three frames; subtraction operation is applied to obtain a difference image. The changing area in motion is detected by the different images. This interframe difference method is the basic detection method of moving vehicles [24]. The position of the moving object is obtained by subtracting two consecutive frames of the vehicle images. The vehicle detection method using the interframe difference method is based on the trees and lanes of the road environment and the close-range video frame environment taken by the camera with a fixed position and angle. Since the position of the vehicle moves between the two frames, there is a specific difference between the pixel values of the vehicle positions of the two frames and the corresponding positions of the other frames. The pixel values of these two frames of the image in the video stream are subtracted to obtain the position information of the moving vehicle.When using the difference between the vehicle detection frames in the video stream, two adjacent or close images are extracted, then the different function is employed in the pixel value corresponding to the pixel position, and the result of the operation greater than a certain limit such as 1 is specified. Other values are defined as 0, which is a dual function. Therefore, the pictogram defined in equation (1) constitutes the outline (foreground) of the moving vehicle, and other parts are regarded as the background. The interframe difference method can be expressed as follows:(1)Atx,y=Btx,y−Bt−ix,y,(2)Ax,y=1,Atx,y>T,0,Atx,y≤T,where Atx,y indicates that the difference operation is performed at the tth frame to obtain the absolute value, Btx,y shows the pixel gray value at the position (x, y) of the extracted image of the tth frame, ti is the tith frame, and i is the frame difference. T is the threshold for estimating the background or the foreground, and A (x, y) represents the result of the interframe difference operation at the corresponding position (x, y) of the two pictures.


## 3. Vehicle Network Collision Warning System

In autopilot vehicle technology, the rear-end collision warning systems play a central role. When employed in real-world situations, existing warning systems are facing severe challenges. Some methods fail to send warnings, while others create multiple incorrect warnings. To avoid frequent false alarms, the following measures are established in this study.


### 3.1. Activation of the Early Warning System

The biggest challenge in designing an early warning system for vehicle collision detection is how to effectively reduce false alarms and missed alarms [25]. Frequent false alarms will distract the driver and may lead to traffic accidents in severe cases. To design a high-precision early warning system, this paper first sets an early warning activation area in front of the vehicle. When the target enters the early warning activation area, only then the early warning system is activated.


### 3.2. Early Warning Activation Area Setting

This article sets the shape of the alert activation area as a trapezoid. The rationality of setting a trapezoid is that, on the one hand, the vehicle has a limited range of maneuverability, and the vehicle forms a triangular shape with the original direction after changing direction. On the other hand, when the target is very close to the vehicle, full braking cannot avoid accidents, so the front of the vehicle has some areas that are excluded.


### 3.3. Fuzzy Warning Algorithm

Fuzzy early warning algorithm refers to the use of fuzzy comprehensive evaluation method to evaluate the dangerous degree of the front target, and the abstract target state is used to analyze the position of the target, the horizontal and vertical distance, the speed of the vehicle, and the TTC information [26]. These data are merged by the fuzzy comprehensive evaluation method, and finally, the current risk level of the target is obtained. The fuzzy comprehensive evaluation method uses fuzzy mathematics theory to quantify qualitative evaluation problems. The basic idea is to establish the index set and comment set for the evaluated object and then take the index weight set and the participation degree of the evaluated object in each element of the index set to obtain the relationship of the ambiguity table. Finally, the fuzzy comprehensive rate is used to compile the index total weight and fuzzy relationship table to obtain the fuzzy comprehensive evaluation result.


### 3.4. Vehicle Trajectory Prediction Model

Machine learning algorithms for supervised learning are based on the assumption that the input data is equally distributed and independent. However, to compute the trajectory of the vehicle, time-series data is entered as an input value. This shows that the input data is dependent. Therefore, we use RNN to develop a trajectory prediction model and use sequentially structured data as input. However, it has the disadvantage of gradient vanishing. To solve this problem, the long short-term memory (LSTM) model is used to predict the position of the vehicle at the next moment [23]. In the field of vehicle trajectory prediction, neural network models are one of the commonly used structures, including BP models and RNN models. The BP neural network model processes the input data by dividing the input layer, the hidden layer, and the output layer. The weights in neural networks are constantly updated and optimized through feedback mediation. The output data is approximated to the actual value with arbitrary precision to achieve the purpose of prediction. The problem that the BP neural network faces in the field of vehicle trajectory prediction is that the number of input features is fixed, and historical trajectory data cannot be used. The LSTM is also called the sequence-to-sequence model, and it transforms an input data sequence into an output data sequence. This model is widely applied in text summarization, machine translation, and image processing [47, 48]. The fundamental idea behind the LSTM model is a memory cell, which can preserve its state over time, and nonlinear gating units, which adjust the information flow into and out of the memory cell. Most recent studies have included many enhancements that have been made to the LSTM architecture since its original structure. However, LSTMs are now used in many machine learning problems, which differ significantly in scale and nature from the problems that these improvements were initially tested on. The trajectory prediction model of the vehicle also estimates a new trajectory sequence by training input sequence. The present LSTM model is based on the RNN model and is segmented into an encoder and a decoder part. It receives input from the encoder part and generates a vector containing the information of the input value. This vector is used by the decoder to recursively generate an output value.


## 3.1. Activation of the Early Warning System

The biggest challenge in designing an early warning system for vehicle collision detection is how to effectively reduce false alarms and missed alarms [25]. Frequent false alarms will distract the driver and may lead to traffic accidents in severe cases. To design a high-precision early warning system, this paper first sets an early warning activation area in front of the vehicle. When the target enters the early warning activation area, only then the early warning system is activated.


## 3.2. Early Warning Activation Area Setting

This article sets the shape of the alert activation area as a trapezoid. The rationality of setting a trapezoid is that, on the one hand, the vehicle has a limited range of maneuverability, and the vehicle forms a triangular shape with the original direction after changing direction. On the other hand, when the target is very close to the vehicle, full braking cannot avoid accidents, so the front of the vehicle has some areas that are excluded.


## 3.3. Fuzzy Warning Algorithm

Fuzzy early warning algorithm refers to the use of fuzzy comprehensive evaluation method to evaluate the dangerous degree of the front target, and the abstract target state is used to analyze the position of the target, the horizontal and vertical distance, the speed of the vehicle, and the TTC information [26]. These data are merged by the fuzzy comprehensive evaluation method, and finally, the current risk level of the target is obtained. The fuzzy comprehensive evaluation method uses fuzzy mathematics theory to quantify qualitative evaluation problems. The basic idea is to establish the index set and comment set for the evaluated object and then take the index weight set and the participation degree of the evaluated object in each element of the index set to obtain the relationship of the ambiguity table. Finally, the fuzzy comprehensive rate is used to compile the index total weight and fuzzy relationship table to obtain the fuzzy comprehensive evaluation result.


## 3.4. Vehicle Trajectory Prediction Model

Machine learning algorithms for supervised learning are based on the assumption that the input data is equally distributed and independent. However, to compute the trajectory of the vehicle, time-series data is entered as an input value. This shows that the input data is dependent. Therefore, we use RNN to develop a trajectory prediction model and use sequentially structured data as input. However, it has the disadvantage of gradient vanishing. To solve this problem, the long short-term memory (LSTM) model is used to predict the position of the vehicle at the next moment [23]. In the field of vehicle trajectory prediction, neural network models are one of the commonly used structures, including BP models and RNN models. The BP neural network model processes the input data by dividing the input layer, the hidden layer, and the output layer. The weights in neural networks are constantly updated and optimized through feedback mediation. The output data is approximated to the actual value with arbitrary precision to achieve the purpose of prediction. The problem that the BP neural network faces in the field of vehicle trajectory prediction is that the number of input features is fixed, and historical trajectory data cannot be used. The LSTM is also called the sequence-to-sequence model, and it transforms an input data sequence into an output data sequence. This model is widely applied in text summarization, machine translation, and image processing [47, 48]. The fundamental idea behind the LSTM model is a memory cell, which can preserve its state over time, and nonlinear gating units, which adjust the information flow into and out of the memory cell. Most recent studies have included many enhancements that have been made to the LSTM architecture since its original structure. However, LSTMs are now used in many machine learning problems, which differ significantly in scale and nature from the problems that these improvements were initially tested on. The trajectory prediction model of the vehicle also estimates a new trajectory sequence by training input sequence. The present LSTM model is based on the RNN model and is segmented into an encoder and a decoder part. It receives input from the encoder part and generates a vector containing the information of the input value. This vector is used by the decoder to recursively generate an output value.


## 4. Vehicle Collision Detection and Early Warning Analysis

### 4.1. Overall Performance of the Vehicle Detection Algorithm

To verify the overall performance of the proposed vehicle detection algorithm, a video containing a sequence of 1200 images is collected from the recording guide that is used to detect and monitor vehicles. In this video, car A always appears directly in front of the main car, accelerating and decelerating from time to time, among which car B and car C pass through the left and right lanes and disappear. The results of the proposed vehicle detection and tracking algorithm are shown in Figure1. The curve in the figure describes the position of the detected and tracked vehicle in the video image sequence. Each frame records the detected and tracked vehicle’s circumscribed rectangle center in the x and y directions of the image plane and provides statistics about the processing time of each frame, as shown in Figure 2.Figure 1
Video vehicle detection and tracking results.Figure 2
Time taken per frame by vehicle detection algorithm.From the data analysis in Figure1, it can be seen that car A always appears in the middle of the image, and then car B and C are detected in the left and right parts of the image, which also shows that they are accelerating. There are many reversals in the track curve of car A, indicating that the speed of car A is changing, which is consistent with the actual situation. The information given in Figure 2 shows that the average detection time per frame is 45 ms, and the average tracking time per frame is 52 ms, which meets the real-time requirements of the front-end vehicle collision warning system.


### 4.2. Anticollision Warning Results

An early warning system will reduce accidents to an extent. It is an innovative driver-assistance system developed to avoid or reduce the severity of vehicle collision. An anticollision warning system monitors a vehicle’s speed, the speed of the vehicle in front of it, and the distance between two vehicles, so that it can inform the driver if the vehicles get too close, assisting to avoid a collision. To verify the effectiveness of the proposed early warning system, this study collected 100 sets of traffic scenes containing pedestrians and cyclists as test data. Each set of scenes contains four consecutive frames of images, and the vehicle speed and camera calibration information are saved to facilitate the calculation of early warning indicators. In the experiment, 20 experienced drivers were invited as observers to label these 100 sets of data and divide them into three levels: safety, attention, and danger. The voting method was adopted, and the level with the highest number of votes was selected as the label of the test data. Table1 and Figure 3 show the early warning results with and without the warning activation area. The accuracy represents the ratio of the number of warning levels correctly identified by the system to the total number of test data. Precision is the fraction of relevant instances among all retrieved instances. Recall, also known as sensitivity, is the fraction of retrieved instances among all relevant instances.Table 1
The role of the early warning activation area.
Warning areaOperation hours (ms)Accuracy (%)Precision (%)Recall (%)With warning area30919192.25Without warning area60705977Figure 3
The role of the early warning activation area.By analyzing the data in Table1, it can be concluded that, after adding the early warning activation area to the vehicle early warning system, the accuracy, precision, and recall rate have been increased by 15.25%, 30%, and 19%, respectively, and the performance of the early warning system has been greatly improved with accuracy 91%, precision 91%, and recall rate 92%, respectively. Moreover, the early warning activation area excludes some safety targets, reduces the amount of system calculation, and approximately doubles the operating speed. Table 2 provides the detection results of various warning levels.Table 2
Detection results of various warning levels.
StatePositive checkFalse detectionMissedAccuracy (%)Safety364090Attention162280Danger191095It can be observed that the accuracy of the dangerous state is the highest, reaching 95%, and the accuracy of the attention state is the lowest (80%), with two types of false detection and two types of missed detection in the 20 sets of data and the 40 sets of data in the safe state. Four groups were mistakenly detected as the attention states. Among the 7 examples of false detection and missed detection, 4 of the safety states were mistakenly detected as the attention state because the target was at the front left of the vehicle. Although the speed of the vehicle was fast and the target’s horizontal and vertical distances were short, the observer found that the vehicle had a direction, the tendency of turning right, so the instance is judged as a safe state; a scene of a dangerous state missed is that there were 8 pedestrians in front of the vehicle and one of the pedestrians was running across the road. This scene was marked as a dangerous state, but the speed was only 20 km/h and the possibility of danger was relatively small. In another instance, the values of the attention and danger states in theS vector were similar, causing the system to misjudge the attention state as danger; the rest are complicated scenes, and the observer’s labeling is not uniform.Through the above analysis, it can be concluded that the proposed early warning system is more objective than the observer’s observation. It comprehensively considers the movement of the target in the longitudinal direction of the vehicle and the speed information of the vehicle and can better meet the requirements of the forward anticollision early warning system.


## 4.1. Overall Performance of the Vehicle Detection Algorithm

To verify the overall performance of the proposed vehicle detection algorithm, a video containing a sequence of 1200 images is collected from the recording guide that is used to detect and monitor vehicles. In this video, car A always appears directly in front of the main car, accelerating and decelerating from time to time, among which car B and car C pass through the left and right lanes and disappear. The results of the proposed vehicle detection and tracking algorithm are shown in Figure1. The curve in the figure describes the position of the detected and tracked vehicle in the video image sequence. Each frame records the detected and tracked vehicle’s circumscribed rectangle center in the x and y directions of the image plane and provides statistics about the processing time of each frame, as shown in Figure 2.Figure 1
Video vehicle detection and tracking results.Figure 2
Time taken per frame by vehicle detection algorithm.From the data analysis in Figure1, it can be seen that car A always appears in the middle of the image, and then car B and C are detected in the left and right parts of the image, which also shows that they are accelerating. There are many reversals in the track curve of car A, indicating that the speed of car A is changing, which is consistent with the actual situation. The information given in Figure 2 shows that the average detection time per frame is 45 ms, and the average tracking time per frame is 52 ms, which meets the real-time requirements of the front-end vehicle collision warning system.


## 4.2. Anticollision Warning Results

An early warning system will reduce accidents to an extent. It is an innovative driver-assistance system developed to avoid or reduce the severity of vehicle collision. An anticollision warning system monitors a vehicle’s speed, the speed of the vehicle in front of it, and the distance between two vehicles, so that it can inform the driver if the vehicles get too close, assisting to avoid a collision. To verify the effectiveness of the proposed early warning system, this study collected 100 sets of traffic scenes containing pedestrians and cyclists as test data. Each set of scenes contains four consecutive frames of images, and the vehicle speed and camera calibration information are saved to facilitate the calculation of early warning indicators. In the experiment, 20 experienced drivers were invited as observers to label these 100 sets of data and divide them into three levels: safety, attention, and danger. The voting method was adopted, and the level with the highest number of votes was selected as the label of the test data. Table1 and Figure 3 show the early warning results with and without the warning activation area. The accuracy represents the ratio of the number of warning levels correctly identified by the system to the total number of test data. Precision is the fraction of relevant instances among all retrieved instances. Recall, also known as sensitivity, is the fraction of retrieved instances among all relevant instances.Table 1
The role of the early warning activation area.
Warning areaOperation hours (ms)Accuracy (%)Precision (%)Recall (%)With warning area30919192.25Without warning area60705977Figure 3
The role of the early warning activation area.By analyzing the data in Table1, it can be concluded that, after adding the early warning activation area to the vehicle early warning system, the accuracy, precision, and recall rate have been increased by 15.25%, 30%, and 19%, respectively, and the performance of the early warning system has been greatly improved with accuracy 91%, precision 91%, and recall rate 92%, respectively. Moreover, the early warning activation area excludes some safety targets, reduces the amount of system calculation, and approximately doubles the operating speed. Table 2 provides the detection results of various warning levels.Table 2
Detection results of various warning levels.
StatePositive checkFalse detectionMissedAccuracy (%)Safety364090Attention162280Danger191095It can be observed that the accuracy of the dangerous state is the highest, reaching 95%, and the accuracy of the attention state is the lowest (80%), with two types of false detection and two types of missed detection in the 20 sets of data and the 40 sets of data in the safe state. Four groups were mistakenly detected as the attention states. Among the 7 examples of false detection and missed detection, 4 of the safety states were mistakenly detected as the attention state because the target was at the front left of the vehicle. Although the speed of the vehicle was fast and the target’s horizontal and vertical distances were short, the observer found that the vehicle had a direction, the tendency of turning right, so the instance is judged as a safe state; a scene of a dangerous state missed is that there were 8 pedestrians in front of the vehicle and one of the pedestrians was running across the road. This scene was marked as a dangerous state, but the speed was only 20 km/h and the possibility of danger was relatively small. In another instance, the values of the attention and danger states in theS vector were similar, causing the system to misjudge the attention state as danger; the rest are complicated scenes, and the observer’s labeling is not uniform.Through the above analysis, it can be concluded that the proposed early warning system is more objective than the observer’s observation. It comprehensively considers the movement of the target in the longitudinal direction of the vehicle and the speed information of the vehicle and can better meet the requirements of the forward anticollision early warning system.


## 5. Conclusions

Vehicle collision prediction has gained increasing attention for safety improvement in smart cities. It is crucial to design effective warning methods for vehicle collisions which are one of the main causes of traffic accidents. This paper provides an overview of mainstream video prediction algorithms and proposes a vehicle trajectory prediction algorithm based on deep learning to predict the vehicle trajectory so that the possible position of the vehicle can be detected in advance, and the potential collision of the vehicle can be warned. In addition, a vehicle collision warning method based on the Internet of Vehicles system is provided, which can effectively avoid the risks during driving, remind the driver to concentrate, and greatly reduce the potential safety hazards during driving. The proposed system can issue early warning prompt information to the driver in time and avoid collision accidents with accuracy up to 96%. The experimental results show that the trajectory prediction algorithm based on deep learning can significantly improve the vehicle network collision detection and early warning system.



---

*Source: 3773688-2021-11-19.xml*