New energy automobile risk prediction method based on LSTM

By constructing an LSTM-based risk prediction model for new energy vehicles and integrating dynamic and static features from multiple data sources in parallel processing, the problem of low accuracy in risk prediction for new energy vehicles in complex environments has been solved, achieving more efficient risk prediction and alerts.

CN120805057APending Publication Date: 2025-10-17TRAFFIC MANAGEMENT RES INST OF THE MIN OF PUBLIC SECURITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510976761.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In existing technologies, the accuracy of traffic accident risk prediction for new energy vehicles in complex road environments and variable climate conditions is low, mainly because the dynamic correlation and coupling effect between various factors have not been fully studied.

Method used

A risk prediction method based on LSTM is adopted, which integrates vehicle factors and external environmental factors. By constructing parallel dynamic and static feature extraction branches, the LSTM model is used to extract time-dependent features, and a fully connected layer is combined to process static data to generate a joint vector for risk prediction. The Sigmoid function is used to output the results, and the model is optimized by the cross-entropy loss function.

Benefits of technology

It improves the accuracy of accident risk prediction for new energy vehicles, effectively captures potential information and internal relationships under multi-source data conditions, realizes real-time risk prediction and alerts, and reduces the occurrence of accidents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120805057A_ABST
    Figure CN120805057A_ABST
Patent Text Reader

Abstract

According to the new energy automobile risk prediction method based on the LSTM, in the constructed risk prediction model, the LSTM is utilized to extract the time sequence dependence characteristics, modeling is performed on the dynamic time sequence data so as to capture potential information and internal relations related to accident occurrence, static data are processed through an independent full-connection Dense layer, and the risk prediction accuracy is improved. Generating a fixed feature vector to quantify and capture potential accident risk characteristics of the vehicle, splicing dynamic characteristics extracted by the LSTM and static characteristics extracted by the full-connection layer to form a joint vector containing time sequence and static characteristics, further inputting the joint vector to the full-connection layer, and performing feature fusion to obtain the potential accident risk characteristics of the vehicle. And the detection head predicts the risk probability of future accidents of the vehicle.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent traffic control, in particular to a new energy vehicle risk prediction method based on LSTM. BACKGROUND

[0002] With the rapid development of new energy vehicles, traffic safety problems are increasingly prominent. Especially in complex road environment and variable weather conditions, the frequency of traffic accidents is rising. The causes of traffic accidents are complex and diverse, including vehicle speed, road conditions and weather factors, and the mutual coupling between factors further increases the difficulty of traffic accident risk prediction. For example, under different weather and road conditions, the influence of vehicle speed on accident occurrence is different, especially in complex environments such as rainy days and nights, and excessive speed will significantly increase the risk of accidents. Although existing technologies have studied the influence of driving state, vehicle speed, acceleration and other factors on driving risk, or the significant effect of adverse weather and road factors on driving safety, the dynamic correlation between factors and their coupling effect have not been fully studied, which also affects the accuracy of accident risk prediction. SUMMARY

[0003] In order to solve the problem that the dynamic correlation between factors and their coupling effect have not been fully studied in the existing new energy vehicle driving risk prediction method, which affects the prediction accuracy, the present application provides a new energy vehicle risk prediction method based on LSTM, which can fuse vehicle factors and external environmental factors, predict new energy vehicle driving risk based on multi-source data, and effectively improve the prediction accuracy.

[0004] The structure of the present application is as follows: a new energy vehicle risk prediction method based on LSTM, characterized in that it comprises the following steps: S1: collecting multi-source data related to traffic accidents; The multi-source data includes static data and dynamic data; The dynamic data includes weather state data, road type, vehicle speed, and new energy vehicle fault alarm data; The static data includes historical data, which includes historical traffic accident types and total number of accidents; S2: obtaining sample data after preprocessing the multi-source data, and constructing training data set and test data set based on the sample data; S3: constructing a risk prediction model for new energy vehicles; The risk prediction model includes an input layer, a feature extraction branch, a feature fusion layer and a prediction head arranged in sequence; The feature extraction branch comprises a dynamic feature extraction branch and a static feature extraction branch arranged in parallel, and the input data is simultaneously sent to the two branches; the features output by the two branches are spliced to obtain a joint vector; The joint vector is sent to the feature fusion layer for fusion, and then the fused features are sent to the prediction head for prediction to output a prediction result; The dynamic feature extraction branch is constructed based on an LSTM model; The static feature extraction branch comprises a fully connected layer and a Relu layer; The feature fusion layer is implemented based on a fully connected layer; S4: training the risk prediction model based on the training data set to obtain a trained risk prediction model; S5: based on the trained risk prediction model, real-time prediction is performed on the vehicle to be predicted, and a prediction result is output; Further features are as follows: The prediction head is implemented based on a Sigmoid function; Further comprising the following steps: S6: comparing the prediction result output by the risk prediction model with a preset risk threshold, and issuing a risk prompt information when the output result is greater than the risk threshold; In step S4, during training, a binary classification cross-entropy loss function is used to evaluate the deviation between the risk probability predicted by the model and the real label; Assuming that the real label is y∈{0,1}, and the predicted risk probability is The cross-entropy loss calculation formula is: ; Wherein, N represents the number of samples, y i represents the real label of the i-th sample, represents the prediction probability of the model for the i-th sample; In step S5, before risk prediction, when collecting the associated static data of the vehicle to be predicted, if there is no historical data of the vehicle to be predicted itself, the historical data corresponding to the vehicle to be predicted of the same vehicle type is input. The preprocessing operation comprises normalizing the vehicle speed data to the [0,1] interval, normalizing the total number of accidents to the [0,1] interval, and encoding other classification data based on one-hot.

[0005] The present application provides a new energy vehicle risk prediction method based on LSTM. In the constructed risk prediction model, LSTM is used to extract time-series dependent features and model dynamic time-series data to capture potential information and intrinsic relationships related to the occurrence of accidents. The static data is processed through an independent fully-connected Dense layer to generate a fixed feature vector to quantify and capture the potential accident risk characteristics of the vehicle. The dynamic features extracted by LSTM and the static features extracted by the fully-connected layer are then spliced ​​to form a joint vector containing time-series and static features. The joint vector is further input into the fully-connected layer, and after feature fusion, it is sent to the detection head to predict the risk probability of future accidents of the vehicle. In this method, multi-source data is integrated through the risk prediction model, and the dynamic correlation and coupling effect between the vehicle's own data and external environmental factors are effectively extracted, thereby realizing the accident risk prediction of new energy vehicles based on multi-source data and effectively improving the accuracy of risk prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0006] Figure 1 This is a schematic diagram of the risk prediction model structure of this application; Figure 2 A flow chart of the method of this application; Figure 3 This is an example of weather status data; Figure 4 This is an example of road type data; Figure 5 This is an example of a new energy fault alarm code; Figure 6 This is an example of a risk prediction process based on input data. DETAILED DESCRIPTION

[0007] like Figure 2 As shown, the present application includes a new energy vehicle risk prediction method based on LSTM, which includes the following steps.

[0008] S1: Collect multi-source data related to traffic accidents. This method combines vehicle status data with external environmental data (such as historical traffic accidents, road conditions, and weather data) to accurately predict the probability of an accident through multi-factor integration.

[0009] Multi-source data includes static data and dynamic data; Dynamic data includes: weather conditions data, road type, vehicle speed and new energy vehicle fault alarm data when the traffic accident occurred.

[0010] Static data includes: historical data, historical data includes: historical traffic accidents and the total number of accidents.

[0011] Dynamic data is data that changes over time, and there is a certain relationship between the same type of data before and after. Static data is historical data, which does not change over time once it occurs.

[0012] The intelligent control system of the new energy vehicle obtains real-time weather state data based on the existing weather API interface. Specific examples of weather state data are shown in Figure 3 The road type data currently being driven by the vehicle to be predicted is obtained based on the existing map API interface and the like. Specific real-time road type data is shown in Figure 4 Real-time vehicle speed and implementation fault alarm data of the vehicle to be predicted can be collected and obtained based on the intelligent control system of the new energy vehicle. Part of the data of the real-time fault alarm data of the new energy vehicle is shown in Figure 5

[0013] Static data can be obtained based on the traffic management platform database or the manufacturer database of the new energy vehicle. Specifically, static data includes: historical data of the accident vehicle itself. If the accident vehicle is a new vehicle and has no historical data available, the historical data of the same type of vehicle can be collected to assist in judgment.

[0014] S2: After preprocessing the multi-source data, sample data is obtained, and training data set and test data set are constructed based on the sample data.

[0015] The collected raw data is associated through the vehicle identification number VIN and the license plate number, and after eliminating invalid data, the data is grouped based on each accident of the vehicle to form an accident sample data.

[0016] After obtaining enough accident sample data, non-traffic accident data is added. The non-traffic accident data is also associated based on the vehicle identification number VIN and the license plate number, and then grouped to obtain non-accident sample data. All accident sample data and non-accident sample data are labeled, and the accident data and non-accident data are used as labels. Sample data set is obtained, and then the sample data set is grouped to obtain training data set and test data set.

[0017] In this method, in order to improve the training effect of the model and the consistency of the data, the multi-source data needs to be standardized through preprocessing operation.

[0018] The preprocessing operation includes the following contents.

[0019] The vehicle speed data is normalized to the [0, 1] interval; The number of accidents is normalized to the [0, 1] interval; Other data belongs to data that does not need to be classified, such as: weather, road type, alarm information, historical accident type, etc., which is encoded based on one-hot.​

[0020] In implementation, in the case of inconsistent data frequencies, a sliding window is used to ensure that the time series features of different data frequencies have consistent time frame structures. If a certain data is low-frequency data, linear interpolation is used in the window to complete it, ensuring that there is valid data input at each time step. When constructing sample data for training based on historical data, a window of 20 seconds to 10 seconds before the time of each accident record is selected as the input for predicting whether the accident occurs.

[0021] S3: Construct a risk prediction model for new energy vehicles.

[0022] As shown in Figure 1 , the risk prediction model includes an input layer, a feature extraction branch, a feature fusion layer, and a prediction head arranged in sequence.

[0023] The feature extraction branch includes a dynamic feature extraction branch and a static feature extraction branch arranged in parallel, and the input data is sent into both branches at the same time; the features output by the two branches are spliced to obtain a joint vector; The joint vector is sent to the feature fusion layer for fusion, and then the fused features are sent to the prediction head for prediction, and the prediction result is output; The dynamic feature extraction branch is constructed based on an LSTM model; The static feature extraction branch includes a fully connected layer and a Relu layer; The feature fusion layer is implemented based on a fully connected layer.

[0024] The prediction head is implemented based on a Sigmoid function.

[0025] S4: Train the risk prediction model based on the training data set, and use the cross-entropy loss function to iteratively optimize the model to obtain a trained risk prediction model.

[0026] As shown in Figure 2 , for time series input (such as vehicle speed, alarm information, and road type), the model processes the time series dependent features through an LSTM layer, and the LSTM layer processes the input data step by step with the help of a multi-unit structure, thereby learning the dynamic patterns in the vehicle operation process. Static features (such as historical accident data, historical accident frequency, and accident severity) are processed through an independent fully connected (Dense) layer to generate a fixed feature vector, which quantifies and captures the potential accident risk characteristics of the vehicle.

[0027] Then, the dynamic features extracted by the LSTM layer are spliced with the static features to form a joint vector containing time series and static features. The joint vector is further input into a multi-layer fully connected network, and finally a Sigmoid activation function is used to generate the risk probability of the vehicle's future accident.

[0028] The formal definition of the network structure of the risk prediction model in this application is as follows: For time series input: X seq ∈R T×F Through the calculation of the LSTM layer, a hidden state vector h LSTM ∈R H : ; Where LSTM H represents the output dimension of the LSTM layer as H.

[0029] Static input X static ∈R S is mapped to a D-dimensional vector h static ∈R D : ; Where W static ∈R D×S and b static ∈R D are the weight matrix and bias vector of the fully connected layer, obtained through training.

[0030] Next, the output h LSTM ∈R H of the LSTM layer and the static feature representation h static ∈R D are connected together to form a joint vector h concat ∈R H+D : .

[0031] The joint feature vector h concat ∈R H+D is mapped through a fully connected layer and using the Sigmoid activation function to obtain the output value , i.e. the risk probability: ; Where σ represents the Sigmoid function, W out ∈R 1×(H+D) and b out ∈R are the weight matrix and bias vector of the output layer, obtained based on training.

[0032] During model training, the binary cross-entropy loss function is used to evaluate the deviation between the predicted risk probability and the true label.

[0033] Assuming the true label is y∈{0,1}, and the predicted risk probability is The cross-entropy loss calculation formula is: ; Wherein, N represents the number of samples, y i represents the true label of the i-th sample, represents the prediction probability of the i-th sample by the model. The loss function guides the model to update the weights by penalizing the probability value of the wrong classification, so as to gradually improve the prediction accuracy.

[0034] During the training process, a prediction module is also set up, and the preprocessed test data is input into the trained accident risk prediction model. The accident risk prediction model outputs the prediction result, and the prediction result is compared with the true result through the prediction module to evaluate the model performance.

[0035] S5: Based on the trained risk prediction model, real-time prediction is performed on the vehicle to be predicted, and the prediction result is output.

[0036] The real-time acquisition of dynamic data of the vehicle to be predicted includes: real-time weather state data, real-time road type, real-time vehicle speed, real-time fault alarm data of new energy vehicles; static data includes: historical data, which includes: historical traffic accidents, accident frequency and accident severity; Wherein, when collecting the associated static data of the vehicle to be predicted, if there is no historical data of the vehicle to be predicted itself, the historical data corresponding to the vehicle to be predicted and the vehicle of the same model is input.

[0037] The collected data is preprocessed to ensure the accuracy and consistency of the data, and then input into the trained risk prediction model.

[0038] The whole process will be described below through specific examples, because the examples are only for illustration, and pseudo data is used.

[0039] The original input in this embodiment is as follows: Timestamp, vehicle speed (km / h), alarm code, longitude, latitude, weather code, road code; 2025-07-14 14:25:00, 110, 0, 116.40, 39.90, 12, 1; 2025-07-14 14:25:10, 115, 0, 116.41, 39.91, 12, 1; 2025-07-14 14:25:20, 120, 18, 116.42, 39.92, 12, 1; 2025-07-14 14:25:30, 125, 18, 116.43, 39.93, 12, 1.

[0040] In the data preprocessing stage, the following operations are performed: Step 1: Data association and cleaning; By VIN association, real-time data and historical accident data are associated, and invalid data is removed, including duplicate data, data with abnormal field values, etc. The definition of specific invalid data types is set according to actual conditions.

[0041] Step 2: Feature engineering; 2.1: Weather encoding (heavy rain -> one-hot): weather_mapping = [0]*19 # Initialize a 19-dimensional zero vector, [0,0,0,0,...,0] weather_mapping

[11] = 1 # Table 1, heavy rain code 12 corresponds to index 11, [0,0,0,0,.1..,0] 2.2: Road encoding (highway -> one-hot): road_mapping = [0]*12 [0,0,0,0,...,0] road_mapping[0] = 1 # Table 2, highway code 1 corresponds to index 0 [1,0,0,0,...,0] 2.3: Alarm encoding (high temperature battery alarm -> one-hot): alarm_mapping = [0]*19 [0,0,0,0,...,0] alarm_mapping

[17] = 1 # Table 3, code 18 corresponds to index 17 [0,0,0,0,..,1,0,0] 2.4: Speed normalization (assuming maximum speed 200 km / h): normalized_speed = [110 / 200, 115 / 200, 120 / 200, 125 / 200] = [0.55, 0.575, 0.6, 0.625] Step 3: Time alignment processing: use sliding window to align data time series, specific implementation details based on existing technology.

[0042] Assuming that in this embodiment, the speed data is low-frequency data, then linear interpolation is used in the window to complete.

[0043] Speed interpolation example (14:25:10-14:25:20): original = [115@14:25:10, 120@14:25:20] Linear interpolation is performed: Interpolated = [115, 115.5, 116, 116.5, 117, 117.5, 118, 118.5, 119, 119.5, 120] # one data point per second; Step 4: Dynamic feature combination; this embodiment is a single time step example; Time step t = 14:25:15 Feature vector: [vehicle speed (0.58), weather (heavy rain), road (highway), alarm (high temperature of battery)] -> [0.58, 0,0,...,1 (weather), 1,0,...,0 (road), 0,...,1,0 (alarm)] Total dimensions = 1 (vehicle speed) + 19 (weather) + 12 (road) + 19 (alarm) = 51 dimensions; Step 5: Static feature combination: Accident type [0]*3 [0,0,0] three dimensions; Historical accident features = [accident frequency 3 / 10 (maximum accident frequency in data) accident type] = [0.3,0,0,0] 4 dimensions.

[0044] The dynamic features are 51-dimensional data, as shown in Figure 6 The input data in this embodiment includes 11 unit time steps, and the static features are 4-dimensional data. After the input data is input into the risk prediction model, the dynamic features are extracted through the LSTM layer, and a 64-dimensional vector corresponding to the dynamic features is output. The static features are extracted through the Dense layer, and a 64-dimensional vector corresponding to the static features is output.

[0045] The two 64-dimensional feature vectors are spliced in front and back to obtain a 128-dimensional joint feature vector, which is then input into the fully connected layer of the feature fusion layer for feature fusion, and finally input into the detection head for risk prediction, outputting the risk occurrence probability in percentage form.

[0046] S6: Compare the prediction result output by the risk prediction model with the preset risk threshold, and when the output result is greater than the risk threshold, issue a risk prompt information. This method reminds the vehicle in the accident-prone scene through scientific data modeling means, reducing the occurrence of accidents After using the technical solution of the present application, multiple factors such as weather, road, vehicle speed, vehicle alarm information and vehicle historical accident information are used at the same time, which can more accurately fit the complex relationship of real scene accident occurrence. In this method, LSTM is used to model multi-time series data to capture potential information and internal relations related to accident occurrence. The present application has universality and real-time performance, and is suitable for real-time accident risk prediction and reminding of new energy vehicles.

Claims

1. A new energy vehicle risk prediction method based on LSTM, characterized in that: It includes the following steps: S1: Collect multi-source data related to traffic accidents; The multi-source data includes static data and dynamic data; The dynamic data includes: weather status data, road type, vehicle speed, and new energy vehicle fault alarm data; The static data includes: historical data, which includes: historical traffic accident types and total number of accidents; S2: Preprocessing the multivariate data to obtain sample data, and constructing a training data set and a test data set based on the sample data; S3: Build a risk prediction model for new energy vehicles; The risk prediction model includes: an input layer, a feature extraction branch, a feature fusion layer and a prediction head arranged in sequence; The feature extraction branch includes: a dynamic feature extraction branch and a static feature extraction branch set in parallel, input data is sent to the two branches at the same time; the features output by the two branches are spliced ​​to obtain a joint vector; Sending the joint vector to the feature fusion layer for fusion, and then sending the fused features to the prediction head for prediction, and outputting the prediction result; The dynamic feature extraction branch is constructed based on the LSTM model; The static feature extraction branch includes: a fully connected layer and a ReLU layer; The feature fusion layer is implemented based on the fully connected layer; S4: Training the risk prediction model based on the training data set to obtain the trained risk prediction model; S5: Based on the trained risk prediction model, real-time prediction is performed on the vehicle to be predicted, and the prediction result is output.

2. The LSTM-based new energy vehicle risk prediction method according to claim 1, characterized in that: The prediction head is implemented based on the Sigmoid function.

3. The LSTM-based new energy vehicle risk prediction method according to claim 2 is characterized in that: It also includes the following steps: S6: Compare the prediction result output by the risk prediction model with a preset risk threshold, and issue a risk warning message when the output result is greater than the risk threshold.

4. The LSTM-based new energy vehicle risk prediction method according to claim 1, characterized in that: In step S4, during training, a binary cross entropy loss function is used to evaluate the deviation between the risk probability predicted by the model and the true label; Assuming the true label is y∈{0,1}, the predicted risk probability is , then the cross entropy loss calculation formula is: ; Where N represents the number of samples, y i represents the true label of the i-th sample, Represents the model's predicted probability for the i-th sample.

5. The LSTM-based new energy vehicle risk prediction method according to claim 1, characterized in that: In step S5, before risk prediction, when collecting the associated static data of the vehicle to be predicted, if there is no historical data on the vehicle to be predicted itself, the historical data corresponding to the vehicle of the same model as the vehicle to be predicted is input.

6. The LSTM-based new energy vehicle risk prediction method according to claim 1, characterized in that: The preprocessing operation includes normalizing the vehicle speed data to the interval [0, 1], normalizing the total number of accidents to the interval [0, 1], and encoding other classification data based on one-hot encoding.