Driving style identification method based on comparative learning and mixed attention mechanism

By introducing a hybrid attention mechanism and contrast learning technology into the driving style recognition method, the problem of data labeling in the prior art is solved and the problem of failure to effectively consider driving working conditions is achieved, and more accurate driving style classification and stronger model recognition capabilities are achieved.

CN119975374APending Publication Date: 2025-05-13DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510111887.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

When facing driving data on real roads, the existing driving style recognition methods have difficulty in marking data and fail to effectively consider the impact of driving conditions on driving behavior, resulting in inaccurate identification.

Method used

The driving style recognition method based on contrast learning and mixed attention mechanism is adopted, and the driving behavior characteristics prompted by driving working conditions are obtained through the hybrid attention module, and the driving working conditions are spliced ​​with the driving working conditions to output driving style characteristics. Using a contrast learning training framework, model learning and training is performed using a large amount of unlabeled data.

Benefits of technology

It improves the accuracy of driving style classification, can more effectively consider the impact of driving conditions on driving behavior, and improves the model's ability to identify driving styles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119975374A_ABST
    Figure CN119975374A_ABST
Patent Text Reader

Abstract

A driving style identification method based on comparative learning and a mixed attention mechanism belongs to the field of driving style identification, is used for improving the accuracy of driving style classification, and is technically characterized by comprising the following steps: S100, inputting a piece of driving data including driving condition data and driving behavior data into a driving style coding model, driving style characteristics of the driving data are obtained through the driving style coding model; s200, performing prediction classification on the driving style feature codes through fitting clustering to obtain a driving style classification corresponding to one piece of data; wherein the driving style coding model in the step S100 comprises a mixed attention module, and the mixed attention module obtains the driving behavior characteristics prompted by the driving condition information through attention calculation, splices the driving behavior characteristics prompted by the driving condition information with the driving condition characteristics, and outputs the driving style characteristics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of driving style recognition, and in particular relates to a driving style recognition method based on contrastive learning and hybrid attention mechanism. Background Art

[0002] Driving style is the semantic description and analysis of driving behavior, and is an important focus of driving behavior research. Driving behavior can be seen as the response of different drivers to the external driving environment. Understanding the driving behavior of drivers is very important and far-reaching for real-world car driving and even future autonomous driving.

[0003] Existing driving style recognition methods include machine learning-based methods (such as support vector machines, random forests, etc.) and supervised deep learning-based methods. However, these methods have some shortcomings when facing driving data on real roads. For example, a large amount of labeled data is required for learning, but it is difficult to accurately label driving data. In addition, existing methods do not consider the impact of driving conditions on driving behavior on real roads, resulting in inaccurate driving style recognition. Summary of the invention

[0004] The purpose of the present invention is to improve the accuracy of driving style classification in order to address the deficiencies of the prior art. According to some embodiments of the present application, the driving style recognition method includes: S100. Inputting a piece of driving data including driving condition data and driving behavior data into a driving style coding model, and obtaining a driving style feature of the piece of driving data through the driving style coding model; S200. Predicting and classifying the driving style feature coding by fitting clustering to obtain the driving style classification corresponding to the piece of data; Among them, the driving style encoding model in step S100 includes a hybrid attention module, which obtains the driving behavior characteristics prompted by the driving condition information through attention calculation, splices the driving behavior characteristics prompted by the driving condition information with the driving condition characteristics, and outputs the driving style characteristics.

[0005] According to the driving style recognition method in some embodiments of the present application, the fitted clustering in step S200 is obtained based on the following method: S210. Obtaining a training set, wherein each piece of data in the training set includes driving condition data and driving behavior data; S220. Using the training set to train a driving style encoding model; S230. Inputting the data set into the trained driving style encoding model to obtain the driving style features of each piece of data in the data set; S240. Cluster the driving style features, and classify the driving styles according to the clustering results to obtain fitted clusters.

[0006] According to the driving style recognition method in some embodiments of the present application, the method of obtaining the training set in step S210 includes: S211. Collect driving data through the vehicle CAN bus, the driving data includes vehicle control data and GPS location data, the vehicle control data includes accelerator pedal position, brake pedal pressure and steering wheel angle; S212. Divide the vehicle control data into time windows, and extract driving behavior data of the vehicle control data from each time window, wherein the driving behavior data includes maximum throttle opening, maximum steering wheel angle, maximum brake pedal pressure, maximum throttle opening change rate, maximum brake pedal pressure change rate, maximum steering wheel angle change rate, throttle opening standard deviation, brake pedal pressure standard deviation and steering wheel angle standard; S213. Divide the GPS position data into time windows, and extract driving condition data of the GPS position data from each time window, wherein the driving condition data includes maximum acceleration, minimum acceleration, acceleration time percentage, deceleration time percentage, parking time percentage, maximum speed, average speed, speed standard deviation, acceleration standard deviation, average speed during acceleration, and average speed during deceleration.

[0007] According to the driving style recognition method in some embodiments of the present application, the driving style encoding model includes a hybrid attention module and a driving style feature output module; Among them, the hybrid attention module includes: The feature extraction layer is used to upgrade the driving condition characteristics and driving behavior characteristics of each driving data; A hybrid attention layer, used for obtaining driving behavior features prompted by driving condition information through attention calculation, splicing the driving behavior features prompted by driving condition information with driving condition features, and outputting spliced ​​features; Among them, the driving style feature output module includes: A feature mapping layer, used for reducing the dimension of the output concatenated features; LSTM layer, used to output driving style features.

[0008] According to the driving style recognition method in some embodiments of the present application, the feature extraction layer includes two feedforward neural networks and , expressed by the following formula: In the formula, They are driving condition input features and driving behavior input features respectively; They are driving condition features and driving behavior features after feature extraction. It is a feedforward neural network consisting of a linear layer and a Relu activation function layer.

[0009] According to the driving style recognition method in some embodiments of the present application, the hybrid attention layer is represented by the following formula: In the formula, They are the query matrix, key matrix, and value matrix in the attention mechanism respectively; The hybrid attention layer obtains the driving behavior characteristics prompted by the driving condition information through attention calculation, which is expressed by the following formula: In the formula, is the attention score matrix, is the softmax function, for The dimensions of the matrix, The driving behavior information is prompted by the driving condition information; The hybrid attention layer combines the driving behavior features prompted by the driving condition information with the driving condition features, which is expressed by the following formula: In the formula, For driving style characteristics, It is the concat function.

[0010] According to the driving style recognition method in some embodiments of the present application, the linear layer of the feature mapping layer is used to identify the driving style features. Perform feature mapping, which is expressed by the following formula: In the formula, is the driving style feature after feature mapping, is a linear layer; Among them, the LSTM network maps the driving style features Driving style feature encoding : In the formula, Encode driving style features, It is a bidirectional LSTM neural network.

[0011] According to the driving style recognition method in some embodiments of the present application, the method of using the training set to train the driving style encoding model in step S220 includes: S221. Use two initially identical driving style encoding models to calculate driving style feature encodings for anchor points and positive samples in the training set, respectively, and calculate the loss of the two driving style encodings through a loss function; S222. Put the driving style code of the positive sample into the negative sample queue as the driving style code of the next batch of negative samples; S223. Update the driving style coding model, use the updated driving style coding model to calculate driving style feature coding for the anchor points and positive samples in the training set, and calculate the loss of the two driving style feature codings obtained and the driving style feature coding of the negative samples in the negative sample queue through the loss function; S224. Repeat steps S222 to S223 until the number of training times is reached.

[0012] According to the driving style recognition method in some embodiments of the present application, the anchor point and the positive sample driving style encoding are expressed by the following formula: In the formula, The characteristics of the anchor sample driving data include driving behavior characteristics and driving condition characteristics; The characteristics of the positive sample driving data include driving behavior characteristics and driving condition characteristics; They are two initially identical driving style encoding models, Encode the driving style of the anchor sample, Encode the driving style of the positive sample; in, The driving style coding model according to any one of claims 1 to 8; The loss function is expressed by the following formula: In the formula, is the hyperparameter temperature coefficient, is the number of negative samples, Encode the samples for comparison, including 1 positive sample and negative samples; the loss is a The class is based on the log loss of the softmax classifier. Divided into kind; Among them, the update: Anchor driving style encoding model Update via back-propagation; Positive Driving Style Encoding Model Update, expressed as follows: In the formula, is the hyperparameter momentum coefficient, with a range of , Anchor driving style encoding model Parameters, Driving style encoding model for positive samples Parameters.

[0013] According to the driving style recognition method in some embodiments of the present application, the fitting clustering in step S200 is K-means fitting clustering; The data set in step S230 includes a training set and a test set; The clustering in step S240 is K-means clustering; In the step S240, the driving style is classified according to the clustering result, including determining the hyperparameters of the clustering category through the sum of squared errors and the silhouette coefficient evaluation index.

[0014] Beneficial effects: In the first aspect, compared with the previous driving style recognition method, the advantage of the present invention is that the driving behavior performance of the driving style under different driving conditions can be effectively considered through the hybrid attention module. The prior art usually only considers driving behavior for driving style determination. Even if the driving condition can be considered, the driving behavior and the driving condition are usually considered independently, and the correlation between the two in the data cannot be mined and used for driving style determination. The present invention first obtains the driving behavior characteristics prompted by the driving condition information through the corresponding calculation of the hybrid attention mechanism in the present invention, and then further splices the driving behavior characteristics prompted by the driving condition information with the driving style characteristics. The driving behavior affected by the driving condition in the present invention can be given a higher weight, so that the driving behavior changes caused by the driving condition changes can be considered in determining the driving style, so that in the driving style determination, the driving behavior can be associated with the driving condition in the data, and the semantic relationship between the driving behavior and the driving condition can be mined. The experimental data shows that the driving style classification output by the driving data is more accurate, which can effectively improve the ability of the model to identify the driving style.

[0015] On the second aspect, the present invention can use a large amount of unlabeled data to learn and train the model through comparative learning, which can solve the problem that driving data is difficult to accurately label and improve the field applicability of the method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a flow chart of the present invention.

[0017] Figure 2 Diagram of the driving style encoding model structure. DETAILED DESCRIPTION

[0018] The technical solution of the present invention is further described below.

[0019] Embodiment 1: A driving style recognition method based on contrastive learning and hybrid attention mechanism, comprising the following steps: Step 1. Preprocess the driving data to obtain training sets and test sets; Step 2. Build a driving style encoding model based on hybrid attention mechanism.

[0020] The driving style encoding model uses a hybrid attention network to obtain driving behavior features prompted by driving condition features, concatenates the driving behavior features prompted by driving condition information with driving condition features, maps the concatenated features through a feature mapping layer, and then performs feature encoding through an LSTM network to obtain driving style feature encoding; Step 3. Build a contrastive learning training framework to train the driving style encoding model in step 2.

[0021] This includes defining the loss function and model optimizer, setting model hyperparameters, iteratively optimizing the model by having the model perform instance discrimination tasks on the training dataset, and obtaining an optimized driving style encoding model; Step 4. Perform an inference on the training set and the test set using the optimized driving style encoding model obtained in step 3. Encode the driving style features obtained by passing the training set and the test set through the driving style encoding model, and then perform K-Means clustering to obtain the driving style category.

[0022] Step 5. For a piece of driving data (data to be detected), obtain the driving style feature code through the above driving style coding model, and predict and classify the driving style feature code by fitting K-Means clustering to obtain the driving style classification corresponding to the piece of data.

[0023] The following is a detailed description of each step: Among them, step 1. preprocessing the driving data to obtain the training set and the test set includes: Step 1-1. Collect original driving data information through the vehicle CAN bus, and classify the original driving data into vehicle control data and GPS location data according to the information type, wherein the vehicle control data includes data such as accelerator pedal position, brake pedal pressure, steering wheel angle, etc.

[0024] Step 1-2. Divide the vehicle control data into time windows with a window size of 40 seconds and a step size of 30 seconds, and extract 9 characteristics from the data in each window to describe the driving behavior, namely, maximum throttle opening, maximum steering wheel angle, maximum brake pedal pressure, maximum throttle opening change rate, maximum brake pedal pressure change rate, maximum steering wheel angle change rate, throttle opening standard deviation, brake pedal pressure standard deviation, and steering wheel angle standard deviation.

[0025] Step 1-3. Divide the GPS location data into time windows with a window size of 40 seconds and a step size of 30 seconds, and extract 11 characteristics from the data in each window to describe the driving conditions, namely maximum acceleration, minimum acceleration, acceleration time percentage, deceleration time percentage, parking time percentage, maximum speed, average speed, speed standard deviation, acceleration standard deviation, average speed during acceleration, and average speed during deceleration.

[0026] Step 1-4. Combine the driving behavior characteristics and driving condition characteristics into driving data. Each piece of driving data includes the driving behavior characteristics and driving condition characteristics of a driver over a period of time. The driving data is the input data of the driving style encoding model. Among them, two different driving data generated by the same driver are combined as positive sample pairs for comparative learning to construct training set data. The training of the driving style encoding model is detailed in step 3.

[0027] Step 2. Build a driving style encoding model based on the hybrid attention mechanism, including: Step 2-1. Construct a hybrid attention module, including: a feature extraction layer and a hybrid attention layer; Step 2-2. Construct a driving style feature output module, including: a feature mapping layer and an LSTM layer; Step 2-3. The hybrid attention module and the driving style feature output module are constructed into a driving style encoding model. The output of the hybrid attention module is used as the input of the driving style feature output module, and the output of the driving style feature output module is used as the final output of the model, i.e., the driving style feature encoding, for subsequent clustering to determine the driving style category.

[0028] Among them, the feature extraction layer in step 2-1 is two feedforward neural networks and , respectively processing the driving condition characteristics and driving line characteristics for dimension increase, as shown in the following formula: ; In the formula, They are driving condition input features and driving behavior input features respectively; They are driving condition features and driving behavior features after feature extraction. It is a feedforward neural network consisting of a linear layer and a Relu activation function layer.

[0029] Among them, the hybrid attention layer in step 2-1 uses the weight matrix to calculate the hybrid attention mechanism The matrix is ​​represented by the following formula: In the formula, They are the query matrix, key matrix, and value matrix in the attention mechanism respectively; Among them, the hybrid attention layer in step 2-1 obtains the driving behavior characteristics prompted by the driving condition information through attention calculation, which is expressed by the following formula: In the formula, is the attention score matrix, is the softmax function, for The dimensions of the matrix, The driving behavior information is prompted by the driving condition information; Among them, the hybrid attention layer in step 2-1 splices the driving behavior information prompted by the driving condition information with the driving condition information to represent the driving style for the network model to learn and feature splicing, which is expressed by the following formula: In the formula, is the driving style feature, also known as the driving style representation vector, It is the concat function.

[0030] Among them, the feature mapping layer in step 2-2 uses a linear layer to transform the driving style features output by the hybrid attention layer in step 2-1. Perform feature mapping for dimensionality reduction, which is expressed by the following formula: In the formula, is the driving style feature after feature mapping, which can also be called the driving style feature representation vector after feature mapping. is a linear layer.

[0031] Among them, the LSTM network in step 2-2 represents the driving style vector after feature mapping After processing, the final driving style feature encoding is obtained, which is expressed by the following formula: In the formula, Encode the driving style features that are finally output by the driving style encoding model. It is a bidirectional LSTM neural network.

[0032] Step 3. Build a contrastive learning training framework to train the driving style encoding model in step 2, including: Step 3-1. Use two initially identical driving style encoding models to calculate the driving style feature encoding for the anchor points and positive samples in the training set respectively, and calculate the loss of the two driving style encodings through the loss function; Step 3-2. Put the driving style code of the positive sample into the negative sample queue as the driving style code of the next batch of negative samples; Step 3-3. Update the driving style coding model, use the updated driving style coding model to calculate the driving style feature coding for the anchor points and positive samples in the training set, and calculate the loss of the two driving style feature codings obtained and the driving style feature coding of the negative samples in the negative sample queue through the loss function; Step 3-4. Repeat steps 3-2 to 3-3 until the number of training settings is reached.

[0033] Among them, the comparison mechanism designed for the model training in step 3-1 uses two initially completely identical driving style encoding models, which can also be called encoders, to encode the driving style features of the anchor point and the positive sample respectively. By training the driving style encoding model, the anchor point can be successfully matched with the positive sample in the positive sample and a group of negative samples, that is, the encoding distance with the positive sample is closer, and the encoding distance with the negative sample is farther.

[0034] The anchor point and positive sample driving style encoding are expressed by the following formula: In the formula, The characteristics of the anchor sample driving data include driving behavior characteristics and driving condition characteristics; The characteristics of the positive sample driving data include driving behavior characteristics and driving condition characteristics; They are two initially identical driving style encoding models, Encode the driving style of the anchor sample, Encode the driving style of the positive sample; in, A driving style encoding model as described in any one of the above items; Among them, the loss function in step 3-1 adopts a form of contrast loss, InfoNCE loss function, which is expressed by the following formula: In the formula, is the hyperparameter temperature coefficient, is the number of negative samples, Encode the samples for comparison, including 1 positive sample and negative samples; it can be seen that the loss is a The class is based on the log loss of the softmax classifier, which attempts to Divided into kind; Among them, the negative sample update method in step 3-2 is to maintain a queue of data samples as the negative sample dictionary, so that the sample encoding of the previous batch can be used to decouple the size of the negative sample dictionary from the batch size, so that the negative sample dictionary can be much larger than the batch size, and a hyperparameter can be used flexibly to set the queue size; Among them, the encoder update method in step 3-3, the encoder As an anchor encoder, updated by back-propagation; encoder As a comparison sample encoder, in order to make the samples in the sample queue consistent, the momentum update method is adopted, that is, no back propagation is performed, and the encoder The original parameters and encoder After the update, the parameters are added in a certain proportion and then updated to realize the encoder Slow update, expressed by the following formula: In the formula, is the hyperparameter momentum coefficient, with a range of , take a larger momentum such as 0.999 to update the parameters slowly, for Encoder parameters, for Encoder parameters.

[0035] From the above, by setting the training related configuration, that is, setting the hyperparameters, selecting the model optimizer, training the model, performing the instance discrimination task on the training set, optimizing the model based on the loss function and update method, and saving the model.

[0036] Step 4. Perform an inference on the training set and the test set using the optimized driving style encoding model obtained in step 3. Encode the driving style features obtained by encoding the training set and the test set through the driving style encoding model, and then perform K-Means clustering to obtain the categories of driving styles, including: Step 4-1. Use the driving style model trained in step 3 to encode the training set and the test set respectively to obtain the driving style feature encoding of each driving data of the training set and the test set; Step 4-2. Perform K-means clustering on the driving style feature encoding of the training set and the test set, and determine hyperparameters such as the number of clustering categories through evaluation indicators such as the sum of squared errors and the silhouette coefficient, and finally determine that the driving styles are divided into three categories.

[0037] Driving style refers to a person's driving habits, behaviors and attitudes during driving. It is usually affected by many factors such as personal character, driving experience, traffic environment and familiarity with the vehicle. The three types of driving styles in this invention include: Aggressive driving style: This type of driver usually likes to accelerate quickly, brake suddenly, change lanes frequently, and even overtake forcibly in traffic jams. They have a high pursuit of speed and like to seek excitement in driving.

[0038] Gentle driving style: drive smoothly, accelerate and brake gently, and try to avoid sudden acceleration and braking. Obey traffic rules, plan routes and lane changes in advance, and pay attention to driving safety.

[0039] Conservative driving style, usually slower speeds, keeping a wide gap to the car in front, and trying to avoid overtaking. They are very cautious and may even block traffic when traffic is flowing.

[0040] Step 5. For a piece of driving data (data to be detected), obtain the driving style feature code through the above driving style coding model, and predict and classify the driving style feature code by fitting K-Means clustering to obtain the driving style classification corresponding to the piece of data, including: Step 5-3. In actual use, for a piece of driving data, first use the model trained in step 3 to obtain the driving style feature code, and then use the K-means clustering fitted by the training set data in step 4-2 to predict and classify the driving style feature code to obtain the driving style corresponding to this piece of driving data.

[0041] Compared with the previous driving style recognition method, the advantage of the present invention is that the driving behavior performance of the driving style under different driving conditions can be effectively considered through the hybrid attention module. The prior art usually only considers driving behavior for driving style determination. Even if the driving conditions can be considered, the driving behavior and the driving conditions are usually considered independently, and the correlation between the two in the data cannot be mined and used for driving style determination. The present invention first obtains the driving behavior characteristics prompted by the driving condition information through the corresponding calculation of the hybrid attention mechanism in the present invention, and then further splices the driving behavior characteristics prompted by the driving condition information with the driving style characteristics. The driving behavior affected by the driving condition in the present invention can be given a higher weight, so that the driving behavior changes caused by the driving condition changes can be considered in determining the driving style, so that in the determination of the driving style, the driving behavior can be associated with the driving condition in the data, and the semantic relationship between the driving behavior and the driving condition can be mined. The experimental data shows that the driving style classification output by the driving data is more accurate, which can effectively improve the ability of the model to identify the driving style. For example, the driver's driving behavior in congested conditions is less aggressive, while in normal conditions, it is more aggressive. Therefore, for normal conditions, the aggressive behaviors of different drivers should have a considerable weight, so that the associated condition information can be considered in determining the driving style, so as to more accurately reflect the driving style. In addition, the present invention can use a large amount of unlabeled data to learn and train the model through comparative learning.

[0042] Experiment: The data set comes from vehicle CAN bus data collected by 1,768 drivers within one month, with a total of 962,165 driving record data. 582,621 data from the first 1,000 drivers are used as the training set. 379,544 data from the last 700 drivers are used as the test set. The final clustering result of the same driver in the same category is used as the accuracy rate. The mixed attention layer is ablated and the following results are produced: It can be seen that the use of the hybrid attention mechanism improves the accuracy by 13.11% and 11.16% on the training set and test set respectively; the use of the hybrid attention mechanism can effectively improve the model's ability to recognize driving style through driving behaviors under the influence of driving conditions.

[0043] Based on the above embodiments, the embodiments of the present application further provide a computer program, which, when executed on a computer, enables the computer to execute the methods provided in the above embodiments.

[0044] Based on the above embodiments, the embodiments of the present application further provide a computer storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the method provided in the above embodiments.

[0045] The storage medium may be any available medium that can be accessed by a computer. For example, but not limited to, a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.

[0046] Based on the above embodiments, an embodiment of the present application further provides a chip, which is used to read a computer program stored in a memory to implement the method provided in the above embodiments.

[0047] Based on the above embodiments, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the method provided in the above embodiments is implemented.

[0048] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0049] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0050] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0051] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0052] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A driving style recognition method, characterized in that: include: S100. Inputting a piece of driving data including driving condition data and driving behavior data into a driving style coding model, and obtaining a driving style feature of the piece of driving data through the driving style coding model; S200. Predicting and classifying the driving style feature coding by fitting clustering to obtain the driving style classification corresponding to the piece of data; Among them, the driving style encoding model in step S100 includes a hybrid attention module, which obtains the driving behavior characteristics prompted by the driving condition information through attention calculation, splices the driving behavior characteristics prompted by the driving condition information with the driving condition characteristics, and outputs the driving style characteristics.

2. The driving style recognition method according to claim 1, characterized in that: in, The fitted clustering in step S200 is obtained based on the following method: S210. Obtaining a training set, wherein each piece of data in the training set includes driving condition data and driving behavior data; S220. Using the training set to train a driving style encoding model; S230. Inputting the data set into the trained driving style encoding model to obtain the driving style features of each piece of data in the data set; S240. Cluster the driving style features, and classify the driving styles according to the clustering results to obtain fitted clusters.

3. The driving style recognition method according to claim 1, characterized in that: in, The method for obtaining the training set in step S210 includes: S211. Collect driving data through the vehicle CAN bus, the driving data includes vehicle control data and GPS location data, the vehicle control data includes accelerator pedal position, brake pedal pressure and steering wheel angle; S212. Divide the vehicle control data into time windows, and extract driving behavior data of the vehicle control data from each time window, wherein the driving behavior data includes maximum throttle opening, maximum steering wheel angle, maximum brake pedal pressure, maximum throttle opening change rate, maximum brake pedal pressure change rate, maximum steering wheel angle change rate, throttle opening standard deviation, brake pedal pressure standard deviation and steering wheel angle standard; S213. Divide the GPS position data into time windows, and extract driving condition data of the GPS position data from each time window, wherein the driving condition data includes maximum acceleration, minimum acceleration, acceleration time percentage, deceleration time percentage, parking time percentage, maximum speed, average speed, speed standard deviation, acceleration standard deviation, average speed during acceleration, and average speed during deceleration.

4. The driving style recognition method according to claim 1, characterized in that: The driving style encoding model includes a hybrid attention module and a driving style feature output module; Among them, the hybrid attention module includes: The feature extraction layer is used to upgrade the driving condition characteristics and driving behavior characteristics of each driving data; A hybrid attention layer, used for obtaining driving behavior features prompted by driving condition information through attention calculation, splicing the driving behavior features prompted by driving condition information with driving condition features, and outputting spliced ​​features; Among them, the driving style feature output module includes: A feature mapping layer, used for reducing the dimension of the output concatenated features; LSTM layer, used to output driving style features.

5. The driving style recognition method according to claim 4, characterized in that: in, The feature extraction layer includes two feedforward neural networks and , expressed by the following formula: In the formula, They are driving condition input features and driving behavior input features respectively; They are driving condition features and driving behavior features after feature extraction. It is a feedforward neural network consisting of a linear layer and a Relu activation function layer.

6. The driving style recognition method according to claim 5, characterized in that: in, The hybrid attention layer is expressed by the following formula: In the formula, They are the query matrix, key matrix, and value matrix in the attention mechanism respectively; The hybrid attention layer obtains the driving behavior characteristics prompted by the driving condition information through attention calculation, which is expressed by the following formula: In the formula, is the attention score matrix, is the softmax function, for The dimensions of the matrix, The driving behavior information is prompted by the driving condition information; The hybrid attention layer combines the driving behavior features prompted by the driving condition information with the driving condition features, which is expressed by the following formula: In the formula, For driving style characteristics, It is the concat function.

7. The driving style recognition method according to claim 6, characterized in that: in, The linear layer of the feature mapping layer is used to map the driving style features Perform feature mapping, which is expressed by the following formula: In the formula, is the driving style feature after feature mapping, is a linear layer; Among them, the LSTM network maps the driving style features Driving style feature encoding : In the formula, Encode driving style features, It is a bidirectional LSTM neural network.

8. The driving style recognition method according to claim 2, characterized in that: in, The method of using the training set to train the driving style coding model in step S220 includes: S221. Use two initially identical driving style encoding models to calculate driving style feature encodings for anchor points and positive samples in the training set, respectively, and calculate the loss of the two driving style encodings through a loss function; S222. Put the driving style code of the positive sample into the negative sample queue as the driving style code of the next batch of negative samples; S223. Update the driving style coding model, use the updated driving style coding model to calculate driving style feature coding for the anchor points and positive samples in the training set, and calculate the loss of the two driving style feature codings obtained and the driving style feature coding of the negative samples in the negative sample queue through the loss function; S224. Repeat steps S222 to S223 until the number of training times is reached.

9. The driving style recognition method according to claim 8, characterized in that: in, The anchor point and the positive sample driving style encoding are expressed by the following formula: In the formula, The characteristics of the anchor sample driving data include driving behavior characteristics and driving condition characteristics; The characteristics of the positive sample driving data include driving behavior characteristics and driving condition characteristics; They are two initially identical driving style encoding models, Encode the driving style of the anchor sample, Encode the driving style of the positive sample; in, The driving style coding model according to any one of claims 1 to 8; The loss function is expressed by the following formula: In the formula, is the hyperparameter temperature coefficient, is the number of negative samples, Encode the samples for comparison, including 1 positive sample and negative samples; the loss is a The class is based on the log loss of the softmax classifier. Divided into kind; Among them, the update: Anchor driving style encoding model Update via back-propagation; Positive Driving Style Encoding Model Update, expressed as follows: In the formula, is the hyperparameter momentum coefficient, with a range of , Anchor driving style encoding model Parameters, Driving style encoding model for positive samples Parameters.

10. The driving style recognition method according to claim 2, characterized in that: The fitting clustering in step S200 is K-means fitting clustering; The data set in step S230 includes a training set and a test set; The clustering in step S240 is K-means clustering; In the step S240, the driving style is classified according to the clustering result, including determining the hyperparameters of the clustering category through the sum of squared errors and the silhouette coefficient evaluation index.