A method for predicting driving behavior of a motor vehicle under different weather conditions
By combining the Catboost and HMM models, the accuracy problem of driving behavior prediction under different weather conditions is solved, achieving higher prediction accuracy and real-time decision support.
Patent Information
- Application Number
- CN202310312985.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2043-03-28
AI Technical Summary
Existing driving behavior prediction technology has low accuracy under different weather conditions and fails to effectively consider the correlation between temporal and spatial characteristics and complex external factors, resulting in low prediction accuracy.
The Catboost regression prediction model is combined with the HMM model. By constructing feature data and label data, Catboost embedding is used to automatically process categorical features, build a tree structure, reduce gradient disappearance, and use the residual network optimization model to predict driving behavior in combination with different weather conditions.
It improves the accuracy of driving behavior prediction under different weather conditions, provides real-time driving behavior basis and planning decisions, and reduces prediction deviation and overfitting.
Smart Images

Figure CN116311944B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle trajectory prediction, and in particular relates to a method for predicting motor vehicle driving behavior under different weather conditions. Background Art
[0002] Intelligent transportation road safety places high demands on the detection and prediction of driver behavior. Assisted driving systems are developed to help drivers drive better and more safely. These systems generally focus on predicting dangerous scenarios and issuing warnings to avoid traffic accidents. However, existing driving behavior prediction technologies often suffer from complex road conditions and unclear surrounding environments due to varying weather conditions, resulting in less than ideal prediction accuracy and accuracy. Predicting driving behavior in different weather conditions is a fundamental and essential feature of driving behavior analysis systems and collision warning systems, effectively preventing traffic accidents and improving road safety.
[0003] During the driving process, the driver is usually affected by the driving of the adjacent vehicles. The driving behavior of the adjacent vehicles is used as the basis for the driving of the own vehicle. The driver needs to refer to the driving conditions of the preceding vehicle and surrounding vehicles to complete the acceleration, deceleration, lane change and other behaviors. The driver needs to make a corresponding response within a few seconds. Figure 1 As shown, the driving of car A requires the support of adjacent vehicles. When car A needs to overtake or change lanes, it needs to predict the driving behavior of vehicles B, C, and E for at least three seconds in the future. After predicting the driving behavior of adjacent vehicles, it can complete its own driving according to the prediction results.
[0004] In different weather conditions, such as snowy and foggy days, which make driving conditions poor and visibility reduced, it is extremely important to be able to predict the driving behavior of adjacent vehicles in advance. Summary of the Invention
[0005] In order to solve the technical problems existing in the above-mentioned prior art, the present invention proposes a method for predicting motor vehicle driving behavior under different weather conditions. The purpose is to address the problems that traditional driving behavior prediction models generally do not consider the correlation between temporal and spatial characteristics and complex external factors such as different weather conditions, and have low ability to capture temporal characteristics. A driving behavior prediction model is proposed to improve the prediction accuracy of the model and provide real-time driving behavior basis and planning decisions for adjacent vehicles.
[0006] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solutions:
[0007] A method for predicting motor vehicle driving behavior under different weather conditions comprises the following steps:
[0008] S1: Build a Catboost regression prediction model;
[0009] S2: Obtain vehicle speed and acceleration data from the onboard computer of the preceding vehicle, obtaining data 1. This data is the current vehicle speed and acceleration, collected every 3 seconds, obtaining data speed and acceleration. Based on the weather conditions during the vehicle's travel time, four weather variables, namely sunny, rainy, snowy, and foggy, are listed as labels and merged into data 1, naming it data 2.
[0010] S3: Use the info() method of the pandas tool to count missing features; use the describe() method of the pandas tool to count the mean, standard deviation, maximum, minimum, and quantile information of the variable; confirm that there are no abnormalities in the data, calculate the data, and obtain data3;
[0011] S4: Label establishment, split the data set data3 into training set and test set, 70% training set and 20% test set;
[0012] S5: Build a tuning model; Catboost uses a completely symmetric tree as the base model and embeds an algorithm that automatically processes categorical features into numerical features;
[0013] S6: To reduce the vanishing gradient of the prediction experimental model, resnet is needed to approximate the same function in the deep network. The potential identity mapping function is: H(X) = X. The network is designed to be H(X) = F(X) + x. The number of channels is changed by 1*1 convolution, which is converted into a residual function: F(X) = H(X) = X.
[0014] S7: The training set and test set of the predicted probability data3 are passed through the Catboost regression prediction model to obtain the result probability data_pred. Data_pred is returned to the HMM model to obtain the output prediction results predicted speed and predictedacceleration.
[0015] Further, as a preferred technical solution of the present invention, the specific steps of S1 include: S1.1: setting parameters, the number of iterations is 100, the depth of the tree is 4, the learning rate is 0.03, and the random number seed is set to 99; S1.2: establishing feature data and label data, y is the label data, and the data other than y is the feature data (X=data.drop(columns=['y'])Y=data['y']), and training the model.
[0016] Further, as a preferred technical solution of the present invention, the specific steps of calculating the data in S3 include:
[0017] S3.1. Calculate the initial state matrix: Calculate the transformation of speed and acceleration in the statistical data, with the sequence labeled as the number of times of acceleration, deceleration, uniform acceleration, uniform deceleration, and uniform speed, to obtain the initial state matrix A.
[0018] S3.2, state transfer matrix B:
[0019] B=[b ij ] n*n
[0020] Among them, b ij is in state S at time t i Under the condition that time t+1 transfers to state S j The probability b ij =P(q t =0|i t =s t );
[0021] S3.3. Calculate the probability of the predicted sequence and obtain data data3.
[0022] Further as a preferred technical solution of the present invention, the specific steps of S5 include:
[0023] S5.1: Perform statistics on classification features and calculate the frequency of feature occurrence;
[0024] S5.2: Add hyperparameters to generate new numerical features;
[0025] S5.3: Use Optuna, a hyperparameter automation framework, to perform single executions of model tuning, manage optimization, and record experimental results.
[0026] As a further preferred technical solution of the present invention, the specific steps of S7 include: S7.1: inputting four weather variables of sunny day, rainy day, snowy day and foggy day respectively; S7.2: using the predicted results of driving behavior of other vehicles as the basis for driving of this vehicle; S7.3: model evaluation, using mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE) and determination coefficient (R) 2 To test the model training effect
[0027] The method for predicting motor vehicle driving behavior under different weather conditions described in the present invention, using the above technical solution, has the following technical effects compared with the prior art:
[0028] This invention, based on an improved HMM model, can infer unobservable states from observed states, effectively solving the optimal path problem for time-dependent transformations and improving prediction performance. The CatBoost model constructs a tree structure by disrupting the first- and second-order gradients of sample prediction results, effectively mitigating prediction bias. This invention can effectively improve the accuracy of driving behavior predictions under different weather conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of a preset traffic scene for an embodiment of the present invention;
[0030] Figure 2 Schematic diagram of a method flow in an embodiment of the present invention;
[0031] Figure 3 This is a schematic diagram of using the info() method of the pandas tool to count missing features in an embodiment of the present invention;
[0032] Figure 4 This is a schematic diagram of acceleration prediction on a sunny day according to an embodiment of the present invention;
[0033] Figure 5 This is a schematic diagram of speed prediction on a sunny day according to an embodiment of the present invention;
[0034] Figure 6 This is a schematic diagram of acceleration prediction on rainy days according to an embodiment of the present invention;
[0035] Figure 7 This is a schematic diagram of speed prediction on rainy days according to an embodiment of the present invention;
[0036] Figure 8 This is a schematic diagram of acceleration prediction in snowy weather according to an embodiment of the present invention;
[0037] Figure 9 This is a schematic diagram of speed prediction in snowy weather according to an embodiment of the present invention;
[0038] Figure 10 This is a schematic diagram of acceleration prediction in foggy weather according to an embodiment of the present invention;
[0039] Figure 11 Schematic diagram of speed prediction in foggy weather according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The present invention will be further explained below in detail with reference to the accompanying drawings so that those skilled in the art can have a deeper understanding of the present invention and be able to implement it. However, the following reference examples are only used to explain the present invention and are not intended to limit the present invention.
[0041] The present invention proposes a method for predicting motor vehicle driving behavior under different weather conditions. Figure 2As shown, the following steps are included: S1: constructing a Catboost regression prediction model;
[0042] S1.1: First, set the parameters, the number of iterations is 100, the tree depth is 4, the learning rate is 0.03, and the random number seed is set to 99; S1.2: Then, establish the feature data and label data, y is the label data, and the data other than y is the feature data (X = data.drop(columns = ['y']) Y = data['y']), and train the model;
[0043] S2: Real-time data is obtained from the onboard equipment of vehicle B. The data is collected every 3 seconds. The speed and acceleration data are obtained. This method only considers the weather conditions of sunny, rainy, snowy, and foggy days. Combined with the weather conditions during the vehicle's travel time, the four weather variables of sunny, rainy, snowy, and foggy days are listed as labels and merged into the data.
[0044] S3: The data period is from August 2019 to January 2020. The info() method of the pandas tool is used to count the missing features. The results are shown in the attached figure. Figure 3 The describe() method of the pandas tool is used to calculate the mean, standard deviation, maximum, minimum, quantile and other information of the variable. The results are shown in Table 1.
[0045] Table 1. Data statistical variable information
[0046] speed acceleration Count 993600.000 993600.000 Mean 38.6095 -0.0000 Std 10.9639 1.0763 Min 1.0540 -16.9280 25% 31.8360 -0.5027 50% 38.9880 0.0067 75% 46.1030 0.5067 max 93.8250 17.3320
[0047] Confirm that there are no abnormalities in the data and calculate the data. The specific method of this step is:
[0048] S3.1: Calculate the initial state matrix:
[0049] The transformation of speed and acceleration in the statistical data, the sequence labels are acceleration, deceleration, uniform acceleration, uniform deceleration, and uniform speed, that is, the initial state matrix is obtained;
[0050] S3.2: Calculate the state transition matrix:
[0051] HMM describes the relationship between two random processes: a process consisting of a set of unobserved (hidden) states S = {S1, S2, ..., S N}, where N is the number of hidden states that cannot be measured directly. Another random process consists of a set of M observable symbols V = {V1, V2, ..., V M The hidden state and observation symbol at time t are defined as Q tand O t Therefore, the hidden state sequence is Q = {Q1, Q2, ..., Q T}, the observation sequence is O = {O1, O2, ..., O T}, where T is the length of the sequence. Using the HMM parameter sequence, the unobserved states can be determined by analyzing the observed sequence. The state transition matrix B is obtained from the data speed and acceleration;
[0052] S3.3: Calculate the probability of the predicted sequence:
[0053] Define the probability function forward(self, obs_seq, mode:("loop","vector") = "loop"), and use forward recursion to solve the probability of the predicted sequence, A = self.transition_prob B = self.observation_prob. Initialize the parameters, n_states = self.n_states. Iterate over n_states and use vector and matrix multiplication to calculate alpha_forward[:,0] = pi*B[:,0] to output the predicted probability sequence data.
[0054] S4: Label establishment, split the data set into training set and test set, 70% training set and 20% test set, the code is (train_x,test_x,train_y,test_y=train_test_split(X,y,test_size=0.3,random_state=42)).
[0055] S5: Build a tuning model. Catboost uses a completely symmetric tree as the base model and embeds an innovative algorithm that automatically converts categorical features into numerical features:
[0056] S5.1: Perform statistics on classification features and calculate the frequency of feature occurrence;
[0057] S5.2: Add hyperparameters to generate new numerical features;
[0058] S5.3: Use the hyperparameter automation framework Optuna to manage optimization in a single execution.
[0059] S6: Catboost uses combined categorical features to exploit the connections between features, addressing gradient bias and prediction drift, thereby reducing overfitting. Deep networks that fit identical functions require the use of ResNet. The underlying identity mapping function is: H(X) = X. The network is designed as H(X) = F(X) + X. Using 1x1 convolution to change the number of channels, this is converted to a residual function: F(X) = H(X) = X.
[0060] S7: The training set and test set of the predicted probability data are passed through the Catboost regression prediction model to obtain the result probability data_pred. Data_pred is returned to the HMM model to obtain the output prediction results predicted speed and predicted acceleration:
[0061] S7.1: Input the weather variables of sunny, rainy, snowy and foggy respectively, and get the results as shown in the attached figure. Figure 4 -Attached Figure 11 As shown;
[0062] S7.2: The predicted driving behavior of vehicle B serves as the basis for vehicle A's movement. Similarly, the same applies to other vehicles adjacent to vehicle A. This result is based on the dataset collected by the present invention. Once the model is complete, historical data of the vehicle to be predicted can be input to perform the prediction.
[0063] S7.3: Model evaluation using mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), and coefficient of determination R 2 To test the model training effect, the formula is:
[0064]
[0065]
[0066]
[0067]
[0068] The model evaluation results are: R 2 :0.9598408534632157;
[0069] MAE:0.2761063913292059;
[0070] MAPE:0.16236830473962827;
[0071] RMSE:0.10294950643924143.
[0072] This paper utilizes the Catboost model to improve ranking, which reduces overfitting while using the entire data set for training, avoiding bias in gradient estimation and addressing prediction drift. Hidden states consider only vehicle speed and acceleration. Because a strict temporal correlation model is required for state sequence decoding, the temporal correlation transformation introduced here also transforms the HMM decoding problem.
[0073] The output distribution at each moment in the classic HMM model is only related to the current state. The recursive formula is introduced into the classic HMM model to calculate the optimal cumulative distance of state i at time t.
[0074] Record the backtracking path of the state at that moment The state with the optimal cumulative distance at the final time t is the final state of the optimal path. The entire optimal path, or optimal state sequence, can be obtained by backtracking from this state. The state output probability of each node (i, j) is independent of the historical path and therefore does not affect the current optimal path search.
[0075] In the present invention, as the number of regression layers increases, the effect on the training set will deviate, and network optimization is difficult. The one-dimensional residual network is used to alleviate the gradient vanishing problem. The deeper the residual network, the better the effect of the training set.
[0076] The specific implementation scheme described above further illustrates in detail the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above is only a specific implementation scheme of the present invention and is not intended to limit the scope of the present invention. Any equivalent changes and modifications made by any technician in this field without departing from the concept and principle of the present invention should fall within the scope of protection of the present invention.
Claims
1. A method for predicting motor vehicle driving behavior under different weather conditions, characterized in that: The following steps are involved: S1: Build a Catboost regression prediction model; S2: Obtain vehicle speed and acceleration data from the onboard computer of the preceding vehicle, obtaining data 1. This data is the current vehicle speed and acceleration, collected every 3 seconds, obtaining data speed and acceleration. Based on the weather conditions during the vehicle's travel time, four weather variables, namely sunny, rainy, snowy, and foggy, are listed as labels and merged into data 1, naming it data 2. S3: Use the info() method of the pandas tool to count the missing features; use the describe() method of the pandas tool to count the mean, standard deviation, maximum, minimum, and quantile information of the variable; Confirm that there are no abnormalities in the data, calculate the data, and obtain data3; The specific steps of calculating the data in S3 include: S3.
1. Calculate the initial state matrix: Calculate the transformation of speed and acceleration in the statistical data, with the sequence labeled as the number of times of acceleration, deceleration, uniform acceleration, uniform deceleration, and uniform speed, to obtain the initial state matrix A. S3.2, HMM describes the relationship between two random processes: a process consisting of a set of hidden states S = {S1, S2, ..., S N }, where N is the number of hidden states that cannot be measured directly; another random process consists of a set of M observation symbols V = {V1, V2, ..., V M }; The hidden state sequence is Q = {Q1, Q2, ..., Q T }, the observation sequence is O = {O1, O2, ..., O T }, where T is the length of the sequence; the sequence of HMM parameters is used to determine the unobserved states by analyzing the observed sequence; the state transition matrix B is obtained from the data speed and acceleration: B=[b ij ] n*n Among them, b ij is in state S at time t i Under the condition that time t+1 transfers to state S j The probability b ij =P(q t =0|i t =s t ); S3.
3. Calculate the probability of the predicted sequence and obtain data data3; S4: Label establishment, split the data set data3 into training set and test set, 70% training set and 20% test set; S5: Build a tuning model; Catboost uses a completely symmetric tree as the base model and embeds an algorithm that automatically processes categorical features into numerical features; The specific steps of S5 include: S5.1: Perform statistics on classification features and calculate the frequency of feature occurrence; S5.2: Add hyperparameters to generate new numerical features; S5.3: Use the hyperparameter automation framework Optuna for single execution when tuning the model, manage the optimization, and record the experimental results; S6: To reduce the vanishing gradient of the prediction experimental model, resnet is needed to approximate the same function in the deep network. The potential identity mapping function is: H(X)=X. The network is designed to be H(X)=F(X)+X. The number of channels is changed by 1*1 convolution, which is converted into a residual function: F(X)=H(X)=X. S7: The training set and test set of the predicted probability data3 are passed through the Catboost regression prediction model to obtain the result probability data_pred, and data_pred is returned to the HMM model to obtain the output prediction results predicted speed and predictedacceleration; The specific steps of S7 include: S7.1: inputting four weather variables of sunny day, rainy day, snowy day and foggy day respectively; S7.2: The predicted driving behavior of other vehicles is used as the basis for the driving of this vehicle; S7.3: Model evaluation using mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), and coefficient of determination (R) 2 To test the model training effect.
2. The method for predicting motor vehicle driving behavior under different weather conditions according to claim 1, characterized in that: The specific steps of S1 include: S1.1: setting parameters, the number of iterations is 100, the tree depth is 4, the learning rate is 0.03, and the random number seed is set to 99; S1.2: establishing feature data and label data, y is the label data, and the data other than y is the feature data X=data.drop(columns=['y']) Y=data['y'], and training the model.
Citation Information
Patent Citations
A vehicle driving speed prediction model construction method
CN109583081A
Short-term traffic flow prediction method based on deep method
CN110322695A