Truck early warning state identification method based on convolutional neural network
Through the method of warning status identification based on convolutional neural networks, the problems of not objective and accurate feature extraction in existing technologies have been solved, and accurate identification and early warning of the truck warning status are realized, and the safety of truck operation and road traffic safety are improved. Essence
Patent Information
- Application Number
- CN202411331874.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-09-24
AI Technical Summary
In the state monitoring and early warning of trucks, feature extraction relies on manual design, is susceptible to subjective influence and cannot be optimized through algorithms, resulting in features not objective and accurate enough, and the deep features and complex correlation patterns of data cannot be fully captured.
Adopt the annualized truck warning status recognition method based on convolutional neural networks, through the processing and feature analysis of the GPS trajectory data, build a sports characteristic index system, establish a mapping relationship between the statement of truck warning and trajectory segment, and use convolutional neural networks for model training And test, identify the state of speed, fatigue driving, rollover and collision warning status of trucks.
The accurate judgment of the truck driver's status and vehicle operation, timely warning the possible safety risks, reducing the probability of accidents, improving the safety and driving efficiency of trucks, and ensuring road traffic safety.
Smart Images

Figure CN119377815A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic safety applications, and in particular to a method for identifying a truck warning state based on a convolutional neural network. Background Art
[0002] With the rapid development of the global economy and urbanization, truck transportation has become an important part of the modern logistics system. As the economic environment continues to recover, the turnover of road freight is on the rise. However, the safety issues of truck transportation are becoming increasingly prominent. Compared with other types of automobile safety accidents, the consequences of truck accidents are more serious.
[0003] Freight traffic accidents not only affect traffic order, but also cause huge economic losses and immeasurable social losses. Therefore, for road managers and operators, risk warning and control in truck operations have become an important part of road management. The factors that cause frequent truck accidents are complex and diverse, among which the driver's status and vehicle operation status are directly related to the safety of truck operation. Therefore, real-time monitoring and warning of the truck driver's status and vehicle operation status are particularly important.
[0004] With the development of advanced technologies such as the Internet of Things, artificial intelligence, and sensor technology, it has become possible to achieve real-time monitoring and analysis of truck status. However, many methods in current research require manual design to extract features related to truck behavior, which are easily affected by the subjective consciousness of researchers and cannot be optimized through algorithms. As a result, the extracted features are not objective and accurate enough, and cannot fully capture the deep characteristics and complex correlation patterns of the data; or a lot of manpower and time costs are required to label truck warning data. In order to solve the defects of current research, the relationship between the characteristics of truck operation trajectories and warning risks can be established to achieve accurate judgment of the driver's status, vehicle operation conditions, etc., so as to timely warn of possible safety risks;
[0005] In view of this, we proposed a truck warning status recognition method based on convolutional neural network. Summary of the invention
[0006] The purpose of the present invention is to provide a truck warning status recognition method based on convolutional neural network to solve the problems raised in the above background technology.
[0007] To achieve the above object, the present invention provides the following technical solution: a method for identifying a truck warning state based on a convolutional neural network, the method comprising the following steps:
[0008] S1, processing of GPS trajectory data;
[0009] S11, data outlier processing;
[0010] S12, coordinate conversion;
[0011] S2. Analysis of truck warning data characteristics;
[0012] S21, truck kinematic trajectory extraction;
[0013] S22. Truck warning trajectory feature analysis: Visualize and statistically analyze the truck trajectory data to identify the distribution range and characteristics of truck trajectory points in different states of fatigue driving warning, speeding warning, rollover warning, and collision warning, as well as the speed status of trucks at different locations. Count the time of trajectory points within a week hour by hour according to different weeks, and calculate the duration of the warning trajectory segment;
[0014] S23, truck warning trajectory segment division, through the characteristics of speeding, fatigue driving, rollover, collision warning trajectory segment research, the trajectory is segmented by using the sample short-trip division based on the change of vehicle kinematic characteristics. The trajectory length screening value is determined and the trajectory screening is performed;
[0015] S24, sample parameter completion, completing the information of time, distance, speed, acceleration, jerk, angle difference, and angle difference change rate for the pre-processed trajectory data;
[0016] S3, Truck warning status recognition based on convolutional neural network;
[0017] S31, initialize network layers and parameters;
[0018] S32. Construct a neural network and design the neural network structure by combining input layer, convolution layer, batch normalization layer, activation function, maximum pooling layer, and fully connected layer; use feature fusion and Dropout technology for full connection design
[0019] S33, model training, converting raw data into PyTorch tensors to interact with the neural network. Then, the training data is iteratively processed, the model's prediction results are calculated through forward propagation, and the loss value is calculated based on the prediction results and the true label. Next, the backpropagation algorithm is used to calculate the gradient and update the network parameters. This process is repeated until the model converges to the optimal parameters;
[0020] S34, model testing, compare the model prediction results and the real labels to calculate the test accuracy. Calculate the confusion matrix, accuracy, F1 score and other indicators to comprehensively evaluate the performance of the model. The indicators intuitively reflect the performance of the model in different aspects, providing an important reference for subsequent model optimization.
[0021] S4. Determine the optimal network structure.
[0022] Optionally, S11 includes the following steps: acquiring GPS data, determining a normal running speed threshold of a truck, and removing abnormal track point data whose average speed is greater than the threshold. At the same time, abnormal longitude and latitude coordinate data and duplicate data whose longitude and latitude values are not within the scope of the study area are also screened out;
[0023] The S12 includes the following steps: In order to ensure the consistency and comparability of the data, coordinate conversion is performed using the WGS-84 coordinate system as a unified standard, so that the visualization of the trajectory data on the map is more convenient and intuitive, and is convenient for effective analysis and application.
[0024] Optionally, the S21 includes:
[0025] Calculate the running speed, acceleration, direction angle and change rate of direction angle of the truck during operation; detect whether the truck has dangerous behaviors such as sudden braking or sudden acceleration through the change of instantaneous speed and acceleration; judge whether the truck is turning through the analysis of direction angle and change rate of direction angle; characterize and analyze the dangerous behaviors of speeding, fatigue driving, rollover or collision of the truck based on the calculated data; the specific calculation is as follows:
[0026] Use the Haversine formula to calculate the geographical distance between two adjacent points:
[0027] a=sin 2 (Δlat / 2)+cos(lat i )*cos(lat i+1 )*sin 2 (Δlon / 2) (1)
[0028] c = 2 * asin(sqrt(a)) (2)
[0029] d = R * c (3)
[0030] Where d represents the spherical distance between two points, R represents the average radius of the earth, and lat i and lat i+1 Represents the latitude of two adjacent points, Δlat = lat i+1 -lat i Represents the difference in latitude, Δlon = lon i+1 -lon i represents the difference in longitude;
[0031] Acceleration and jerk calculation:
[0032] a i =Δv / Δt (4)
[0033] ji =Δa / Δt (5)
[0034] Calculation of direction angle change and change rate:
[0035] bc i =Δθ=θ i+1 -θ i (6)
[0036] ba i =Δθ / Δt=θ i+1 -θ i / Δt (7)
[0037] Among them, Δv represents the change in velocity between adjacent points i and i+1, Δa represents the change in acceleration between adjacent points i and i+1, and Δt represents the change in time.
[0038] Optionally, in S23, the track points with an average speed of 0 in the track are divided into different situations, and the specific division steps are as follows:
[0039] S231, performing short-stroke division to segment the trajectory;
[0040] S232, calculating the basic features of each trajectory point and screening out trajectory data in four warning states whose length is not less than a determined value;
[0041] S233, sorting and numbering the trajectory points according to the license plate number and time, preliminarily dividing the different time periods of different vehicles, and taking the continuous trip of each vehicle as a short trip division unit;
[0042] S234, process the track points with an average speed of 0 in the track according to the situation, and set the points with an average speed of 0 whose adjacent track points have non-zero speeds as the break points. For the long continuous zero speed segments, delete them and divide the track segments at the next non-zero speed point, and update the number;
[0043] S235, after the short-stroke trajectory segments are divided, extract the trajectory segments whose length is not less than the determined value;
[0044] S236, track segment integration, coding update.
[0045] Optionally, the S32 further includes: specific construction steps are as follows:
[0046] S321, transform the trajectories in the same segment into multiple dimensions. The input matrix form is shown in formula (8), where the rows of the matrix represent a single feature, the columns represent all the features of the sampling point at the current moment, the width of the input matrix is the dimension of the input feature, which is consistent with the dimension of the model input layer, and the length m of the input matrix represents the number of trajectory points contained in a single sample;
[0047]
[0048] S322, making the original trajectory samples have the same length by padding or truncating, taking a trajectory segment with a sliding window of M=50 (i.e., 50 trajectory points); truncating the segments with a length exceeding 50, and padding the segments with a length less than 50 with the value of the last trajectory point;
[0049] S323, introduces the fusion technology of the embedding layer to fuse the different features of the truck operation data; uses random initialization, and the size of the embedding layer (i.e., the dimension of each category vector) is a hyperparameter; obtains the embedding vector of each classification feature, and fuses them with other types of features (such as continuous features, other embedding vectors, etc.) through weighted summation, and uses the fused features as input;
[0050] S324, using a two-dimensional convolutional neural network, the matrix of multi-dimensional features is regarded as image input, so that the correlation between different feature columns can be considered at the same time. The convolution formula is as follows:
[0051]
[0052] S325. Add residual connections to the network structure. The residual connections directly connect the input to the deep output of the network.
[0053] S326. Use batch normalization (BN) layer to standardize the data. Suppose the input data is: {X1,X2..Xn}.
[0054] Use formula (10) to calculate the mean μ of n input sample data:
[0055]
[0056] Use formula (11) to calculate the variance (sigma) σ of the input sample data 2 :
[0057]
[0058] Use formula (12) to demean the input sample data and divide it by the standard deviation:
[0059]
[0060] The parameters gama and lamda are introduced to scale and translate the standardized data to prevent the normal distribution standardized data from being distributed on both sides of the sigmoid function and the normalized data from being concentrated in the approximate linear part in the middle of the sigmoid function, which affects the nonlinear ability:
[0061]
[0062] S327. A pooling layer is periodically inserted between the convolutional layers. This invention adopts maximum pooling and selects the maximum value in each pooling window. The calculation formula is as follows:
[0063]
[0064] Among them, z i,k is the output of the current layer, z i-1,k+m is the mth neuron in the previous layer;
[0065] S328, feature fusion and Dropout technology are used to design the fully connected layer, flatten the output of the pooling layer, and the flattening operation stretches the feature map into a one-dimensional vector. The fully connected layer receives the flattened input, and each neuron is connected to each element of the input, and a weighted sum is performed, and a bias is added. The fully connected layer maps the final output to a linearly separable space and cooperates with the output layer for classification;
[0066] S329, finally enters the output layer, and the output layer uses softmax classifier for classification. The formula is as follows:
[0067]
[0068] Finally, each position gets a probability value, and the value of the position with the highest probability is taken as the recognition result.
[0069] Optionally, the S34 further includes:
[0070] The specific calculation is as follows: Confusion Matrix: The confusion matrix is a two-dimensional matrix that shows the predictions of the model on different categories. For multi-category classification problems, the concept of confusion matrix is expanded;
[0071] The accuracy calculation formula (16) is:
[0072]
[0073] The precision calculation formula (17) is:
[0074]
[0075] The recall calculation formula (18) is:
[0076]
[0077] The F1 Score calculation formula (19) is:
[0078]
[0079] The confusion matrix will contain the True Positives (TP), False Positives (FP), and False Negatives (FN) for each class.
[0080] Optionally, the S4 includes:
[0081] Quantitatively evaluate the performance of different network configurations and extract key hyperparameter configurations, including layer modes (i.e., the combination of convolutional layers, pooling layers, BN layers, etc.), the presence or absence of layers (i.e., whether a specific network layer is included), the convolution depth of CNN (i.e., the number of convolutional layers), and the number of filters in the layer. Change the configuration of hyperparameters to ultimately find the most suitable network structure; identify the warning status of trucks.
[0082] Compared with the prior art, the present invention provides a method for identifying truck warning status based on convolutional neural network, which has the following beneficial effects:
[0083] This truck warning status recognition method based on convolutional neural network constructs a kinematic feature indicator system, establishes a mapping relationship between the truck warning status and trajectory segment characteristics, and proposes a truck warning status recognition technology to achieve safety risks through abnormal trajectory identification, reduce the probability of accidents, improve truck operation safety and driving efficiency, and provide technical support for ensuring road traffic safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] Figure 1 It is the overall flow chart of the present invention;
[0085] Figure 2 This is an example diagram of the direction angle of the present invention;
[0086] Figure 3 It is a time distribution diagram of the early warning trajectory points of the present invention;
[0087] Figure 4 It is a diagram of the trajectory division of the present invention;
[0088] Figure 5 Draw a flow chart for the trajectory of the present invention;
[0089] Figure 6 This is an example diagram of the two-dimensional convolution of the present invention;
[0090] Figure 7 This is a schematic diagram of residual connection of the present invention;
[0091] Figure 8Schematic diagram of the maximum pooling process of the present invention;
[0092] Fig. 9 This is a structural diagram of the truck warning status prediction algorithm of the present invention. DETAILED DESCRIPTION
[0093] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0094] like Figure 1-Figure 9 As shown, the present invention provides a technical solution: a method for identifying a truck warning state based on a convolutional neural network, comprising the following steps:
[0095] S1. Processing of GPS trajectory data
[0096] S11. Data outlier processing
[0097] GPS data acquisition, the trajectory data sampling interval is mostly 30s. Each trajectory point contains 31 fields, and 7 relevant fields are selected for research, including vehicle number, longitude, latitude, time, instantaneous speed, angle with the north direction and warning sign. The data format obtained by the research sampling is shown in the following table:
[0098]
[0099] An example of actual trajectory data is shown in Table 2:
[0100] License plate number longitude latitude time Angle Speedkm / h Alarm Tags Shaanxi AC***1 109.09880 34.387989 11 / 2 13:36:37 188 14.9 2 Shaanxi AC***1 109.09854 34.386863 11 / 2 13:37:07 191 11.1 2 Shaanxi AC***1 109.09830 34.385747 11 / 2 13:37:37 189 18.6 2 Shaanxi AC***1 109.09802 34.384354 11 / 2 13:38:07 190 20.5 2 Shaanxi AC***1 109.09782 34.383368 11 / 2 13:38:37 176 16.6 2
[0101] Considering that the truck may be speeding, the abnormal trajectory point data with an average speed greater than 150km / h is removed. At the same time, the abnormal longitude and latitude coordinate data whose latitude and longitude values are not within the study area are also deleted. When the GPS signal is interfered or blocked, the location data may be recorded repeatedly. This part of the repeated abnormal data is deleted;
[0102] S12. Coordinate transformation
[0103] The WGS-84 coordinate system is used as the unified standard for coordinate conversion. The GCJ-02 coordinate system (x, y) of the original truck GPS trajectory data is converted to the WGS-84 coordinate system. The calculation method of (x', y') in the coordinate system is as follows:
[0104] x'=2x-(x+dLon) (1)
[0105] y'=2y-(y+dLat) (2)
[0106]
[0107] Among them, e = 6378245, e′ = 0.0066934216229659;
[0108] S2. Analysis of truck warning data characteristics:
[0109] S21. Truck kinematic trajectory extraction
[0110] The GPS longitude and latitude can calculate the distance traveled by the vehicle in a unit time, and the instantaneous speed of the vehicle combined with the angle with the true north direction can depict the current movement trend of the truck. Acceleration can reflect the change of the vehicle's speed in a unit time and characterize the acceleration and deceleration state of the vehicle. The angle with the true north direction and its rate of change can reflect the rate of change of the vehicle's direction in a unit time and show the vehicle's turning situation. The specific steps for calculating the running speed, acceleration, direction angle and rate of change of the direction angle of the truck when the truck is running are as follows:
[0111] Use the Haversine formula to calculate the geographical distance between two adjacent points:
[0112] a=sin 2 (Δlat / 2)+cos(lat i )*cos(lat i+1 )*sin 2 (Δlon / 2) (6)
[0113] c = 2 * asin(sqrt(a)) (7)
[0114] d = R * c (8)
[0115] Calculate acceleration and jerk:
[0116] a i =Δv / Δt (9)
[0117] j i =Δa / Δt (10)
[0118] Calculate the direction angle change and change rate:
[0119] bc i =Δθ=θ i+1 -θ i (11)
[0120] ba i =Δθ / Δt=θ i+1 -θi / Δt (12)
[0121] The specific direction angle is as follows: Figure 2 As shown;
[0122] S22. Truck warning trajectory characteristics analysis
[0123] Visualize and statistically analyze the trajectory data of trucks to obtain a distribution map of warning trajectory points and a heat map with the speed of warning trajectory points as the weight. Use the distribution map of warning trajectory points to identify the distribution range and characteristics of truck trajectory points in different states of fatigue driving warning, speeding warning, rollover warning, and collision warning. The heat map with the speed of warning trajectory points as the weight intuitively displays the speed of warning vehicles at different locations, helping managers to identify high-risk areas and the speed status of trucks at different locations. The time of trajectory points within a week is counted hourly according to different weeks to obtain an hourly distribution heat map of warning trajectory points, and to identify the time periods when trajectory warning data appears significantly;
[0124] The characteristics of the warning trajectory under visualization and statistical analysis are shown in the following table:
[0125]
[0126] The time distribution of warning trajectory points is as follows: Figure 3 As shown;
[0127] S23. Truck warning trajectory segment division
[0128] Through the characteristic research of overspeeding, fatigue driving, rollover and collision warning trajectory segments, the trajectory is segmented by using the sample short-distance division based on the change of vehicle kinematic characteristics. The trajectory length screening value is determined and the trajectory screening is performed. The trajectory points with an average speed of 0 in the trajectory are divided into different situations. The specific division steps are as follows:
[0129] S231, segment the trajectory using a sample short-trip segmentation based on the changes in vehicle kinematic characteristics. The short-trip segment mainly includes four driving characteristics: acceleration, deceleration, constant speed, and idling. 2 is the threshold, and the acceleration segment is defined as a>=0.15m / s 2 At the same time, V≠0, the deceleration section is a<=-0.15m / s 2 At the same time, V≠0, the uniform speed section is |a|<0.15m / s 2 At the same time, V≠0, the idle section is a=0 and V=0 and the engine is running continuously;
[0130] S232, defining the trajectory segment length as the number of trajectory points contained in the trajectory segment, taking 10 as the threshold of the trajectory point length according to the example, calculating the basic features of each trajectory point and screening out trajectory data in four warning states with a length not less than 10;
[0131] S233, sorting and numbering the trajectory points according to the license plate number and time, preliminarily dividing the different time periods of different vehicles, and taking the continuous trip of each vehicle as a short trip division unit;
[0132] S234. If the truck is in the following situations: ① Waiting for the red light at a signal-controlled intersection. ② On urban roads with high traffic density, the truck may need to stop briefly in congested traffic and wait. ③ Loading and unloading goods, adjusting the position of goods, etc. require a short stop to complete necessary operations. ④ In specific traffic control areas or speed-restricted areas, it may be necessary to slow down or stop briefly due to traffic congestion or speed limit requirements. In order to comply with traffic regulations, ensure traffic safety, or complete cargo transportation tasks, trucks will stop briefly. For points where the average speed of adjacent trajectory points is 0 and the speed is non-zero, set them as break points. For long continuous segments with a speed of zero, delete them and split the trajectory segment at the next non-zero speed point, and update the number;
[0133] S235, after the short-distance trajectory segments are divided, the trajectory segments with a length not less than ten are extracted and defined
[0134] function to extract all trajectory segments with the same number not less than ten;
[0135] S236, trajectory segment integration, coding update;
[0136] Finally, the total number of valid sample short-trip trajectory points extracted is 617,362, and the trajectory segments are 23,410. The final number of samples after trajectory division is shown in the following table:
[0137] Warning situation Collision Warning Speeding warning Rollover warning Fatigue driving warning Number of track segments 3480 4274 7733 7923 Number of track points 106102 133687 116319 261254
[0138] See the trajectory division for details. Figure 4 , the specific trajectory division process can be seen in Figure 5 ;
[0139] S24. Sample parameter completion
[0140] The pre-processed trajectory data is supplemented with information on time, distance, speed, acceleration, jerk, angle difference, and angle difference change rate. The specific parameters of the final sample points after trajectory division are shown in Table 5:
[0141]
[0142]
[0143] S3. Truck warning status recognition based on convolutional neural network:
[0144] S31. Initialize network layers and parameters
[0145] S311. Conducting the architecture of a neural network model, wherein the architecture includes a neural network model having multiple components such as a convolutional layer, a batch normalization layer, an activation function, and a fully connected layer;
[0146] S312, define the forward propagation process, that is, information can only be transmitted in one direction, and there is no round-trip loop. The output of the previous layer is used as the input of the next layer, and the output of the next layer is calculated, and the calculation continues until the output layer;
[0147] S313, add activation function, the activation function needs to meet the following properties: 1. nonlinearity 2. differentiability 3. monotonically increasing 4. bounded output value range. The output of the convolution layer uses the ReLU activation function to increase the nonlinear expression ability of the model;
[0148] S314, select the cross entropy loss function, which can well measure the difference between the model prediction results and the true labels, and help the model learn the correct classification decisions. At the same time, select the Adam optimizer as the optimization algorithm of the model. Adam combines the advantages of momentum gradient descent and RMSprop algorithms, and can adaptively adjust the learning rate to accelerate the training process of the model;
[0149] S32. Constructing a neural network
[0150] The neural network structure is designed by combining input layer, convolution layer, batch normalization layer, activation function, maximum pooling layer, and fully connected layer. Residual connections are added to the network structure to solve the gradient vanishing and gradient exploding problems that occur during the training of deep neural networks. The fusion technology of the embedding layer is introduced to fuse the different features of the truck operation data, further enrich the input information of the model, and improve the accuracy of the prediction. Feature fusion and Dropout technology are used for full connection design. The specific construction steps are as follows:
[0151] S321, transform the trajectory in the same segment into multiple dimensions, and the characteristic parameters include speed, acceleration, jerk, distance, angle with the true north direction, angle difference, angle difference conversion rate, and the square of the characteristic parameter with difference calculation. The input matrix form is shown in formula (8), where the row of the matrix represents a single feature, the column represents all the features of the sampling point at the current moment, the width of the input matrix is the dimension of the input feature, which is consistent with the dimension of the model input layer, and the length m of the input matrix represents the number of trajectory points contained in a single sample;
[0152]
[0153] S322. First determine the number of trajectory points to be divided, that is, the size of the window, set to 50. Then initialize two pointers start and end, which represent the starting position and ending position of the window respectively. Initially, both start and end point to the starting position of the trajectory segment. End moves backward until the window contains a specified number of trajectory points. During the movement, record the starting position and ending position of each window. When the window reaches the boundary at the end of the trajectory segment, the number of trajectory points contained in the last window may be less than the window size. Select the value of the last trajectory point of the current window for filling until its length reaches 50;
[0154] S323, introduce the fusion technology of the embedding layer to fuse the different features of the truck operation data, enrich the input information of the model, and improve the accuracy of the prediction. The initialization of the embedding layer can be started by random initialization. The size of the embedding layer is a hyperparameter, and the optimal value is set to 30. Once the embedding vector of each classification feature is obtained, it can be fused with other features by weighted summation and other methods. The settings of the embedding layer are shown in the following table:
[0155]
[0156]
[0157] S324, using a two-dimensional convolutional neural network, the matrix of multi-dimensional features is regarded as image input, so that the correlation between different feature columns can be considered at the same time. The convolution formula is as follows:
[0158]
[0159] An example of a two-dimensional convolution is Figure 6 As shown;
[0160] S325. Add residual connections to the network structure. The residual connections connect the input directly to the deep output of the network. The residual block in this example consists of several convolutional layers (or other types of layers) and a "short-circuit" connection. This "short-circuit" connection adds the input of the block (or some transformed input) to the output of the block and then passes it to the relu activation function. Figure 7 Schematic diagram of residual connection;
[0161] S326. Use batch normalization (BN) layer to standardize the data. Suppose the input data is: {X1,X2..Xn}.
[0162] Use formula (15) to calculate the mean μ of n input sample data:
[0163]
[0164] Use formula (16) to calculate the variance (sigma) σ of the input sample data 2 :
[0165]
[0166] Use formula (17) to demean the input sample data and divide it by the standard deviation:
[0167]
[0168] The parameters gama and lamda are introduced to scale and translate the standardized data to prevent the normal distribution standardized data from being distributed on both sides of the sigmoid function and the normalized data from being concentrated in the approximate linear part in the middle of the sigmoid function, which affects the nonlinear ability:
[0169]
[0170] The output of the middle layer of the network is normalized through the normalization layer, which speeds up the model training time, improves the generalization ability of the model, and helps prevent problems such as gradient disappearance or gradient explosion;
[0171] S327, periodically insert a pooling layer between the convolutional layers, use maximum pooling, and select the maximum value in each pooling window. The maximum pooling process is as follows Figure 8 As shown, the calculation formula is as follows:
[0172]
[0173] Among them, z i,k is the output of the current layer, z i-1,k+m is the mth neuron in the previous layer;
[0174] S328, feature fusion and Dropout technology are used to design the fully connected layer. Feature fusion fuses features at different levels and makes full use of the information extracted by the model at different levels. In the Dropout layer, the P value is initially set to 0.5, which means that in each training batch, 50% of the neurons will be randomly disconnected. Early stopping technology is used to automatically select the optimal number of training cycles.
[0175] The output of the pooling layer is flattened. The flattening operation stretches the feature map into a one-dimensional vector. The fully connected layer receives the flattened input. Each neuron is connected to each element of the input, and a weighted sum is performed. A bias is added. The fully connected layer maps the final output to a linearly separable space and cooperates with the output layer for classification.
[0176] S329, finally enter the output layer, the output layer uses softmax classifier for classification, the formula is shown in (20), and finally each position (a total of four positions, representing four warning states) has a probability value, which is the probability that the input trajectory segment is in the current warning state. Finally, the value of the position with the largest probability is taken as the recognition result;
[0177]
[0178] S33. Model training
[0179] S331. In the model training stage, the cross entropy loss function was selected, which can well measure the difference between the model prediction results and the true labels, helping the model learn the correct classification decisions. At the same time, the Adam optimizer was selected as the optimization algorithm of the model. Adam combines the advantages of momentum gradient descent and RMSprop algorithms, and can adaptively adjust the learning rate to accelerate the training process of the model.
[0180] S332. During the training process, multiple hyperparameters are set to control the training behavior of the model. Among them, the output of the convolutional layer uses the ReLU activation function to increase the nonlinear expression ability of the model. The maximum number of iterations of model training is set to 100 times, and the sample size of each batch is set to 64. In addition, the Dropout technology is introduced in the fully connected layer to prevent the model from overfitting by randomly disconnecting a part of the neuron connections. In the Dropout layer, the P value is initially set to 0.5, which means that in each training batch, 50% of the neurons will be randomly disconnected. To further improve the performance of the model, the early stopping technology is used to automatically select the optimal number of training cycles. This technology determines whether the model is overfitting by monitoring the performance indicators (such as accuracy) on the validation set. When the performance indicators on the validation set have not improved for several consecutive cycles, stop training and save the current best performing model parameters;
[0181] S34, Model Testing
[0182] After the model training is completed, the model is evaluated using an independent test set. By calculating the performance indicators on the test set (such as accuracy, confusion matrix, F1 score, etc.), the generalization ability and prediction accuracy of the model are comprehensively evaluated. The specific calculation is as follows:
[0183] Confusion Matrix: A confusion matrix is a two-dimensional matrix that shows the predictions of the model on different categories. This example involves four warning states, which is a multi-category classification problem. At this time, the concept of confusion matrix is expanded. The confusion matrix will contain true positives (TP), false positives (FP), and false negatives (FN) for each category. Table 7 is an example of a confusion matrix for a four-category problem: rows represent true categories and columns represent predicted categories;
[0184] Predicted as class 1 Predicted as class 2 Predicted as class 3 Predicted to be category 4 Actually Category 1 TP FN FN FN Actually Category 2 FP TP FN FN Actually Category 3 FP FP TP FN Actually Category 4 FP FP FP TP
[0185] True Positives (TP): The number of samples that the model correctly predicted as positive class;
[0186] False Positives (FP): The number of negative samples that the model incorrectly predicts as positive. FP represents a false positive of the model, where a negative sample is incorrectly classified as positive.
[0187] False Negatives (FN): The number of positive samples that the model incorrectly predicts as negative. FN represents a false positive of the model, where a positive sample is incorrectly classified as negative.
[0188] The elements on the diagonal represent the number of samples correctly predicted by the model, and the elements on the off-diagonal represent the model's incorrect predictions on that category.
[0189] Accuracy:
[0190]
[0191] Precision:
[0192]
[0193] Recall:
[0194]
[0195] The F1 Score is:
[0196]
[0197] S4. Determine the optimal network structure:
[0198] The performance of different network configurations is quantitatively evaluated, and key hyperparameter configurations are extracted. Hyperparameters include layer modes (i.e., the combination of convolutional layers, pooling layers, BN layers, etc.), the presence or absence of layers (i.e., whether a specific network layer is included), the convolution depth of CNN (i.e., the number of convolutional layers), and the number of filters in the layer. In this example, seven network models are constructed to change the hyperparameter configurations. The results are shown in Table 8:
[0199]
[0200]
[0201] According to the overall accuracy, CNN-D is the optimal network structure. The truck warning status prediction algorithm structure is shown in Fig. 9 .
[0202] Therefore, the present invention adopts the above-mentioned truck warning status recognition method based on convolutional neural network, which can identify truck speeding, fatigue driving, rollover and collision warnings, and has high application value in the field of traffic safety.
[0203] The above generally describes the present invention in detail, but it is obvious to a person skilled in the art that some modifications or improvements can be made to the present invention. Therefore, modifications or improvements that do not depart from the spirit of the present invention are within the scope of protection of the present invention.
Claims
1. A method for identifying truck warning status based on convolutional neural network, characterized in that: The method comprises the following steps: S1, processing of GPS trajectory data; S11, data outlier processing; S12, coordinate conversion; S2. Analysis of truck warning data characteristics; S21, truck kinematic trajectory extraction; S22. Truck warning trajectory feature analysis: Visualize and statistically analyze the truck trajectory data to identify the distribution range and characteristics of truck trajectory points in different states of fatigue driving warning, speeding warning, rollover warning, and collision warning, as well as the speed status of trucks at different locations; The time of the trajectory points within a week is counted hour by hour according to different weeks, and the duration of the warning trajectory segment is calculated; S23, truck warning trajectory segmentation, through the characteristics of speeding, fatigue driving, rollover, collision warning trajectory segmentation, the trajectory is segmented by using the sample short-trip segmentation based on the change of vehicle kinematic characteristics; the trajectory length screening value is determined and the trajectory screening is performed; S24, sample parameter completion, completing the information of time, distance, speed, acceleration, jerk, angle difference, and angle difference change rate for the pre-processed trajectory data; S3. Truck warning status recognition based on convolutional neural network S31, initialize network layers and parameters; S32. Construct a neural network, design the neural network structure by combining input layer, convolution layer, batch normalization layer, activation function, maximum pooling layer, and fully connected layer components; use feature fusion and Dropout technology for full connection design; S33, model training, converting raw data into PyTorch tensors to interact with the neural network; then, iteratively processing the training data, calculating the model's prediction results through forward propagation, and calculating the loss value based on the prediction results and the true label; using the backpropagation algorithm to calculate the gradient and update the network parameters; repeating this process until the model converges to the optimal parameters; S34, model testing, compare the model prediction results and the real labels to calculate the test accuracy; calculate the confusion matrix, accuracy, F1 score and other indicators to comprehensively evaluate the performance of the model; through the indicators, the performance of the model in different aspects is intuitively reflected, which provides an important reference for subsequent model optimization; S4. Determine the optimal network structure.
2. The method for identifying truck warning status based on convolutional neural network according to claim 1, characterized in that: The S11 comprises the following steps: acquiring GPS data, determining a threshold value of a normal running speed of a truck, and removing abnormal track point data whose average speed is greater than the threshold value; and also removing abnormal data and duplicate data of longitude and latitude coordinates whose longitude and latitude values are not within the scope of the study area; The S12 includes the following steps: In order to ensure the consistency and comparability of the data, coordinate conversion is performed using the WGS-84 coordinate system as a unified standard, so that the visualization of the trajectory data on the map is more convenient and intuitive, and is convenient for effective analysis and application.
3. The method for identifying truck warning status based on convolutional neural network according to claim 1, characterized in that: The S21 includes: Calculate the running speed, acceleration, direction angle and change rate of direction angle of the truck during operation; detect whether the truck has dangerous behaviors such as sudden braking or sudden acceleration through the change of instantaneous speed and acceleration; judge whether the truck is turning through the analysis of direction angle and change rate of direction angle; characterize and analyze the dangerous behaviors of speeding, fatigue driving, rollover or collision of the truck based on the calculated data; the specific calculation is as follows: Use the Haversine formula to calculate the geographical distance between two adjacent points: a=sine 2 (Δlat / 2)+cos(lat i )*bas(lat i+1 )*sine 2 (Δlon / 2) (1) c = 2 * asin(sqrt(a)) (2) d = R * c (3) Where d represents the spherical distance between two points, R represents the average radius of the earth, and lat i and lat i+1 Represents the latitude of two adjacent points, Δlat = lat i+1 -lat i Represents the difference in latitude, Δlon = lon i+1 -lon i represents the difference in longitude; Acceleration and jerk calculation: a i =Δv / Δt (4) j i =Δa / Δt (5) Calculation of direction angle change and change rate: b.c. i =Δθ=θ i+1 -θ i (6) ba i =Δθ / Δt=θ i+1 -θ i / Δt (7) Among them, Δv represents the change in velocity between adjacent points i and i+1, Δa represents the change in acceleration between adjacent points i and i+1, and Δt represents the change in time.
4. The method for identifying truck warning status based on convolutional neural network according to claim 1, characterized in that: In S23, the track points with an average speed of 0 in the track are divided into different situations, and the specific division steps are as follows: S231, performing short-stroke division to segment the trajectory; S232, calculating the basic features of each trajectory point and screening out trajectory data in four warning states whose length is not less than a determined value; S233, sorting and numbering the trajectory points according to the license plate number and time, preliminarily dividing the different time periods of different vehicles, and taking the continuous trip of each vehicle as a short trip division unit; S234, processing the track points with an average speed of 0 in the track according to the situation, setting the point with an average speed of 0 whose adjacent track points have non-zero speed as a break point; deleting the long continuous zero speed segment and dividing the track segment at the next non-zero speed point, and updating the number; S235, after the short-stroke trajectory segments are divided, extract the trajectory segments whose length is not less than the determined value; S236, track segment integration, coding update.
5. The method for identifying truck warning status based on convolutional neural network according to claim 1, characterized in that: The S32 further includes: the specific construction steps are as follows: S321, transform the trajectories in the same segment into multiple dimensions. The input matrix form is shown in formula (8), where the rows of the matrix represent a single feature, the columns represent all the features of the sampling point at the current moment, the width of the input matrix is the dimension of the input feature, which is consistent with the dimension of the model input layer, and the length m of the input matrix represents the number of trajectory points contained in a single sample; S322, make the original trajectory samples have the same length by padding or truncating, take the trajectory segment of the sliding window M=50; truncate the segments with a length exceeding 50, and fill the segments with a length less than 50 with the value of the last trajectory point; S323, introduced the fusion technology of embedding layer to fuse different features of truck operation data; adopted random initialization, and the size of embedding layer was a hyperparameter; obtained the embedding vector of each classification feature, and fused them with other types of features through weighted summation, and used the fused features as input; S324, using a two-dimensional convolutional neural network, the matrix of multi-dimensional features is regarded as image input, so that the correlation between different feature columns can be considered at the same time. The convolution formula is as follows: S325. Add residual connections to the network structure. The residual connections directly connect the input to the deep output of the network. S326, using batch normalization (BN) layer to standardize the data, assuming that the input data is: {X1, X2..Xn}; Use formula (10) to calculate the mean μ of n input sample data: Use formula (11) to calculate the variance (sigma) σ of the input sample data 2 : Use formula (12) to demean the input sample data and divide it by the standard deviation: The parameters gama and lamda are introduced to scale and translate the standardized data to prevent the normal distribution standardized data from being distributed on both sides of the sigmoid function and the normalized data from being concentrated in the approximate linear part in the middle of the sigmoid function, which affects the nonlinear ability: S327. A pooling layer is periodically inserted between the convolutional layers. This invention adopts maximum pooling and selects the maximum value in each pooling window. The calculation formula is as follows: Among them, z i,k is the output of the current layer, z i-1,k+m is the mth neuron in the previous layer; S328, feature fusion and Dropout technology are used to design the fully connected layer, flatten the output of the pooling layer, and the flattening operation stretches the feature map into a one-dimensional vector. The fully connected layer receives the flattened input, and each neuron is connected to each element of the input, and a weighted sum is performed, and a bias is added. The fully connected layer maps the final output to a linearly separable space and cooperates with the output layer for classification; S329, finally enters the output layer, and the output layer uses softmax classifier for classification. The formula is as follows: Finally, each position gets a probability value, and the value of the position with the highest probability is taken as the recognition result.
6. The method for identifying truck warning status based on convolutional neural network according to claim 1, characterized in that: The S34 further includes: The specific calculation is as follows: Confusion matrix: The confusion matrix is a two-dimensional matrix that shows the predictions of the model on different categories. For multi-category classification problems, the concept of confusion matrix is expanded; The accuracy calculation formula (16) is: The precision calculation formula (17) is: The recall calculation formula (18) is: The F1 Score calculation formula (19) is: The confusion matrix will contain the true positives, false positives, and false negatives for each class.
7. The method for identifying truck warning status based on convolutional neural network according to claim 1, characterized in that: The S4 includes: Quantitatively evaluate the performance of different network configurations and extract key hyperparameter configurations, including layer mode, presence or absence of layers, CNN convolution depth, and number of layer filters; change the hyperparameter configuration to ultimately find the most suitable network structure; identify the warning status of trucks.
Citation Information
Patent Citations
Truck running state recognition method based on trajectory data
CN111340427A
Trajectory data mining method based on deep semi-supervised neural network
CN111368879A
Fatigue driving behavior detection system based on parallel cross convolutional neural network
CN111914738A
Truck track abnormity identification method and system
CN116524723A
Truck driver posture behavior identification method based on convolutional neural network fusion model
CN116994229A
Cited By
Anti-collision early warning method for vehicle, computer program product and vehicle
CN119992878A