A method and system for intelligent traffic vehicle safety detection based on transfer learning

By using the Transformer architecture and multi-head self-attention mechanism in intelligent transportation vehicle safety detection, combined with the high-dimensional feature classification network, the problem of insufficient time series feature extraction in the existing technology is solved, and the real-time performance and performance of intelligent transportation vehicle safety detection are improved. Generalization performance ensures system security and privacy protection.

CN117932606BActive Publication Date: 2024-10-29JINAN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410266168.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-08
Publication Date
2024-10-29
Estimated Expiration
2044-03-08

AI Technical Summary

Technical Problem

Existing intelligent transportation vehicle safety detection technology ignores the time series characteristics in the data, resulting in insufficient real-time safety detection capabilities and insufficient model generalization performance, and cannot effectively deal with the problem of missing time series characteristics in the intelligent transportation system.

Method used

The transfer learning method based on the Transformer architecture is used to learn the temporal characteristics of the data through the encoder layer and the multi-head self-attention mechanism, and combined with the high-dimensional feature classification network to extract the characteristics of the attack behavior of intelligent transportation vehicles and improve the real-time performance and generalization of the model. ability.

Benefits of technology

It achieves accurate detection of attacks on intelligent transportation vehicles, improves the real-time and generalization performance of the intelligent transportation vehicle safety detection system, and ensures the safety of the transportation system and the protection of passenger privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117932606B_ABST
    Figure CN117932606B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for intelligent transportation vehicle safety detection based on transfer learning, wherein the method includes the following steps: constructing an intelligent transportation carrier security attack detection model based on Transformer transfer learning, and dividing it into two parts: a data preprocessing module and a security detection module. For the intelligent transportation vehicle data preprocessing part, principal component analysis and decision tree methods are used to reduce the dimension of data features, eliminate most of the irrelevant features in the data, and retain the most critical attack features and time series features of the data. For the security detection model part, it is regarded as a target detection task to determine whether the intelligent transportation vehicle is under external attack. Transformer combines a multi-head self-attention mechanism and a target classification technology. The multi-head self-attention mechanism can well learn the time series features of the intelligent transportation vehicle network data, and the target classification technology can be used to identify different types of intrusion attack data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of the combination of deep learning and intelligent transportation industry, and specifically relates to an intelligent transportation vehicle safety detection method and system based on transfer learning. Background Art

[0002] With the continuous development of urban transportation, the intelligence level of urban transportation vehicles and rail transportation is constantly improving, and the various sensors and network communication equipment carried by intelligent transportation have become more complex. The complexity of the connection of modern intelligent transportation equipment also poses a major threat to the safety of urban transportation. In particular, intrusion attacks from the Internet of Things pose a universal threat to the safety of intelligent transportation, which may cause traffic vehicles to lose control, endanger the safety of passengers, and even cause the entire intelligent transportation system to be paralyzed, causing immeasurable losses. The inherent vulnerability of intelligent transportation vehicle networks, such as the lack of security features of controller area network protocols, imperfect security mechanisms, and defects in data integrity, authentication, and encryption, urgently requires the establishment of an efficient and stable intelligent transportation vehicle safety detection system.

[0003] In recent years, deep learning technology has achieved great success in security detection systems. Researchers have used stacked gated recurrent unit models and methods based on generative adversarial networks for intelligent traffic safety detection and have achieved certain results, but these models have limitations in real-time security detection capabilities. At the same time, existing models ignore the inherent temporal regularity of security attacks, resulting in the omission of time series features in the data and insufficient real-time security detection capabilities. Summary of the invention

[0004] In view of the problem that the existing intelligent transportation vehicle safety detection technology misses the extraction of temporal features in data, the present invention proposes an intelligent transportation vehicle safety detection method and system based on transfer learning, which adopts the Transformer architecture to learn the temporal features of data and uses the transfer learning method to improve the generalization ability of the model and system; the model and system encode the input and output through the encoder layer, integrate the multi-head self-attention mechanism, and further promote the learning of temporal dynamics; after the encoder layer, a high-dimensional feature classification network is also introduced to realize the detection of attack behaviors of intelligent transportation vehicles; further improve the real-time performance of the current intelligent transportation vehicle safety detection system. This innovation plays an important role in protecting the safety of intelligent transportation systems, transportation vehicles, passengers, and maintaining personal privacy.

[0005] To achieve the above object, the present invention provides the following solutions:

[0006] A method for intelligent transportation vehicle safety detection based on transfer learning includes the following steps:

[0007] S1. Preprocess the data of Car Hacking, an intelligent traffic data set, and extract the time series features and attack features in the Car Hacking, wherein the Car Hacking, an intelligent traffic data set, includes Dos attacks, Fuzzy attacks, Spoofing, and normal data.

[0008] S2. Using the time series features and attack features, train an intelligent transportation vehicle safety detection model based on a Transformer multi-type neural network;

[0009] S3, processing the prediction of the training data in S2 and the initial labeling of the training data, calculating the prediction error of the intelligent transportation vehicle safety detection model, and fine-tuning and optimizing the parameters of the intelligent transportation vehicle safety detection model based on the prediction error;

[0010] S4, using the Car Hacking intelligent traffic data set to test the fine-tuned and optimized intelligent traffic vehicle safety detection model, and using the transfer learning method to further adjust the intelligent traffic vehicle safety detection model that has passed the test on the M-CAN and B-CAN intrusion attack data sets;

[0011] S5. Using the M-CAN and B-CAN intrusion attack data sets to train the further adjusted intelligent transportation vehicle safety detection model, to obtain an intelligent transportation vehicle safety attack detection model that achieves a preset accuracy;

[0012] S6. Perform an ablation experiment on the intelligent transportation vehicle safety attack detection model that has achieved a preset accuracy, select the intelligent transportation vehicle safety attack detection model with the best performance for packaging, and complete the safety detection of the intelligent transportation vehicle based on the intelligent transportation vehicle safety attack detection model.

[0013] Preferably, in S1, the method for preprocessing the intelligent traffic data set Car Hacking includes:

[0014] The PCA decision tree method is used to reduce the feature dimension of the intelligent traffic dataset Car Hacking and retain the time series information.

[0015] Performing label encoding on the Car Hacking intelligent traffic data set after feature dimension reduction, wherein the label encoding is performed in the order of Dos, Fuzzy, Gear, RPM, and Normal;

[0016] The repeated data in the intelligent traffic data set Car Hacking after label encoding is cleaned, and the time series features and attack features in the intelligent traffic data set Car Hacking are extracted.

[0017] Preferably, in S2, the method of training the intelligent transportation vehicle safety detection model constructed based on the Transformer multi-type neural network by using the time series features and attack features includes:

[0018] Input the time series features and attack features into the vector embedding coding layer of the Transformer to expand the dimension, convert the discrete variables into continuous vector representation, and obtain the coding vector;

[0019] The timing features and attack features are input into the position embedding encoding layer of the Transformer, and the position information is provided by linear transformation using sin and cos functions to obtain a position vector;

[0020] The encoding vector is directly added to the position vector to obtain the input of the Transformer encoding layer; wherein the Transformer encoding layer is composed of 6 identical sub-layers, each sub-layer includes two parts: a multi-head attention layer and a feedforward neural network layer, and the connection between each two layers is realized by residual connection and normalization;

[0021] After the Transformer encoding layer, a Softmax sublayer is connected to output the relevant position weight information;

[0022] Based on the relevant position weight information, a DNN network is used to classify and output high-dimensional features. Preferably, the method of using sin and cos functions for linear transformation includes:

[0023] PE(pos.2i)sin(pos / 1000021 / dmodel)

[0024] PE(pos,21+11))=cos(pos / 100002i / dmodel)

[0025] Among them, the sin and cos functions correspond to a set of odd and even numbered dimensions respectively; i is the sequence number; pos represents the position information of the feature in the sequence; dmodel represents the encoding dimension, which is set to 64; at the same time, the output period of the position embedding function PE(·) is designed to be in the range of 2π to 2π×10000, so that each position can obtain different position codes in different dimensions.

[0026] Preferably, the multi-head attention layer divides the attention module into 8 heads, and interacts each element of the input sequence with other elements; specifically: first, the encoding vector of the input sequence is mapped to a high-dimensional space through a linear transformation to obtain the initial query, key and value matrices; the similarity score between each query vector and all key vectors is calculated, and the score is normalized to obtain the attention score; the attention score is multiplied by the value matrix to obtain the attention weight; the attention weight is then calculated through multiple different heads to obtain multiple weighted sum vectors, which are spliced ​​together, and then mapped to a low-dimensional space through a linear transformation to obtain the output of the multi-head self-attention layer.

[0027] Preferably, the DNN network comprises two hidden layers, each hidden layer comprises a fully connected layer, a ReLU activation function and a Dropout function.

[0028] Preferably, in S6, the method of performing an ablation experiment on the intelligent transportation vehicle security attack detection model that achieves a preset accuracy includes:

[0029] Using the Transformer+DNN method as the baseline, the separate DNN method, the Transformer method and the intelligent transportation vehicle safety attack detection model were experimented on the M-CAN and B-CAN intrusion datasets respectively, and the best performance security detection model that passed multiple rounds of tests was encapsulated to build an intelligent transportation vehicle safety detection system.

[0030] The present invention also provides an intelligent transportation vehicle safety detection system based on transfer learning, comprising: a data preprocessing module, a first model training module, a first adjustment module, a second adjustment module, a second model training module and a detection module;

[0031] The data preprocessing module is used to perform data preprocessing on the intelligent traffic data set Car Hacking, and extract the time series features and attack features in the intelligent traffic data set Car Hacking, wherein the intelligent traffic data set Car Hacking includes Dos attack, Fuzzy attack, Spoofing and normal data;

[0032] The first model training module is used to train the intelligent transportation vehicle safety detection model built based on the Transformer multi-type neural network by using the time series features and attack features;

[0033] The first adjustment module is used to process the prediction of the training data and the initial labeling of the training data in the first model training module, calculate the prediction error of the intelligent transportation vehicle safety detection model, and fine-tune and optimize the parameters of the intelligent transportation vehicle safety detection model based on the prediction error;

[0034] The second adjustment module is used to test the fine-tuned and optimized intelligent transportation vehicle safety detection model using the intelligent transportation data set Car Hacking, and further adjust the intelligent transportation vehicle safety detection model that has passed the test on the M-CAN and B-CAN intrusion attack data sets using the transfer learning method;

[0035] The second model training module is used to train the further adjusted intelligent transportation vehicle safety detection model using the M-CAN and B-CAN intrusion attack data sets to obtain an intelligent transportation vehicle safety attack detection model that achieves a preset accuracy;

[0036] The detection module is used to perform an ablation experiment on the intelligent transportation vehicle safety attack detection model that reaches a preset accuracy, select the intelligent transportation vehicle safety attack detection model with the best performance for encapsulation, and complete the safety detection of the intelligent transportation vehicle based on the intelligent transportation vehicle safety attack detection model.

[0037] Compared with the prior art, the present invention has the following beneficial effects:

[0038] The present invention proposes a method and system for intelligent traffic vehicle safety detection based on transfer learning. By preprocessing the intelligent traffic data set Car Hacking and using the PCA decision tree method to reduce the dimension of data features, the temporal regularity of the intrusion data can be extracted from large-scale data, and the temporal characteristics of the data can be retained. Then, by constructing a Transformer model, the input data is encoded and output using the encoding layer, and the temporal characteristics of the intrusion attack data are learned with the help of a multi-head self-attention mechanism. In view of the fact that the essence of intrusion behavior detection is a classification task of attack types, we added a classification network DNN network after the encoder layer to achieve accurate detection of intrusion attack behaviors. In order to verify the generalization of the model, the transfer learning method is used to directly use the training model on the intelligent traffic data set Car Hacking to fine-tune the parameters, avoiding the need to retrain a new model for each downstream task, and solving the problem of insufficient generalization performance caused by deep learning model training for scenarios that ignore the temporal feature information of intrusion data. Then, in order to further verify the correctness of the model and the importance of the temporal characteristics of the intrusion attack data set, an ablation experiment was carried out. Finally, the best-performing intelligent traffic vehicle safety detection model selected through multiple rounds of testing was encapsulated to build an intelligent traffic vehicle safety detection system with excellent performance and strong generalization. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0040] Figure 1 A flowchart of an intelligent transportation vehicle safety detection method based on Transformer transfer learning provided in one embodiment of the present application;

[0041] Figure 2 A schematic diagram of the structure of an intelligent transportation vehicle safety detection system based on Transformer transfer learning provided in one embodiment of the present application;

[0042] Figure 3 This is a flow chart of an intelligent transportation vehicle data preprocessing module in one embodiment of the present application;

[0043] Figure 4 This is a schematic diagram of the structure of a Transformer encoding layer feature learning module in one embodiment of the present application;

[0044] Figure 5This is a schematic diagram of the structure of a DNN multi-classification neural network output module in one embodiment of the present application;

[0045] Figure 6 This is a schematic diagram of the structure of an intelligent transportation vehicle safety detection and identification module in one embodiment of the present application. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0048] The present invention belongs to the field of combining deep learning with the urban traffic safety industry, and can be used for the security detection of abnormal data of intelligent transportation carriers such as intelligent networked vehicles and urban rail transit in smart city scenarios to ensure the information security of transportation vehicles. The method based on deep learning has the advantages of strong adaptability and low latency, and has higher robustness in the detection of abnormal data of transportation vehicles in complex urban traffic environments. Therefore, it has also achieved certain results in the application scenarios such as intelligent networked vehicle attack detection and urban rail transit attack detection in the field of intelligent transportation. The traditional deep learning traffic vehicle attack detection method focuses on directly learning the local attack features of abnormal data, but does not take into account the temporal regularity that intrusion attacks often have, and ignores the global temporal characteristics of the data, resulting in poor real-time detection of previous vehicle-mounted security attack detection methods and poor detection effects. To this end, the present invention aims at the lack of temporal feature learning ability in the process of traffic vehicle security attack detection, and discloses a method and system for intelligent transportation carrier security attack detection based on Transformer transfer learning.

[0049] Embodiment 1

[0050] This application discloses a smart traffic vehicle safety detection method and system based on Transformer transfer learning, such as Figure 1 and Figure 2 As shown, including:

[0051] S1. Preprocess the Car Hacking data set, extract the time series features and attack features in the data, and perform feature dimensionality reduction on the data. Then, label encode the data and delete duplicate data for subsequent pre-training.

[0052] S2, passing the time series features and attack feature data extracted in step S1 into the intelligent traffic vehicle safety detection module built based on the Transformer multi-type neural network to train the model;

[0053] S3, processing the prediction of the training data in step S2 and the initial labeling of the training data, calculating the prediction error of the intelligent transportation vehicle safety detection model, and fine-tuning the training model parameters based on the error calculated above;

[0054] S4. For the security detection model obtained in step S3 after the Car Hacking test on the intelligent traffic dataset, the model is further adjusted on the M-CAN and B-CAN intrusion attack datasets using the transfer learning method;

[0055] S5. Based on the model parameters adjusted in step S4 and multiple training results on the M-CAN and B-CAN intrusion attack data sets, select the model with the best performance accuracy, and save the best model and results;

[0056] S6. Based on the best model saved in step S5, in order to verify the effectiveness of the feature selection method and evaluate the impact of specific features on the model results, an ablation experiment was conducted on the proposed model, and the best intelligent transportation vehicle safety detection model that passed multiple rounds of tests was encapsulated to build an intelligent transportation vehicle safety detection system;

[0057] In the embodiment of the present application, by preprocessing the data of the intelligent traffic Car Hacking dataset and using the PCA decision tree method to reduce the dimension of data features, the time regularity of the intrusion data can be extracted from large-scale data, the temporal characteristics of the data are retained, and the problem of insufficient real-time detection of previous security detection models is solved. Then, by constructing a Transformer model, the input data is encoded and output using the encoding layer, and the temporal characteristics of the intrusion attack data are learned with the help of a multi-head self-attention mechanism. In view of the fact that the essence of intrusion behavior detection is a classification task of attack types, we added a classification network DNN network after the encoder layer to achieve accurate detection of intrusion attack behaviors. In order to verify the generalization of the model, the transfer learning method is used to directly use the training model on the intelligent traffic Car Hacking dataset to fine-tune the parameters, avoiding the need to retrain a new model for each downstream task, and solving the problem of insufficient generalization performance caused by deep learning model training for scenarios that ignore the temporal feature information of intrusion data. Then, in order to further verify the correctness of the model and the importance of the temporal characteristics of the intrusion attack dataset, an ablation experiment was carried out. Finally, the best-performing intelligent traffic vehicle safety detection model selected through multiple rounds of testing was encapsulated to build an intelligent traffic vehicle safety detection system with excellent performance and strong generalization.

[0058] See also Figure 3 , the intelligent transportation vehicle data preprocessing module process includes:

[0059] The Car Hacking dataset of intelligent transportation is analyzed and then data features are extracted. The dataset contains Dos attack, fuzzy attack, spoofing (RPM / gear) and normal data, totaling 17,558,462 data, of which 15,226,830 are normal data and 2,331,517 are abnormal data, accounting for 13% of the total. The data analysis shows that the number of abnormal data in the dataset is too small, which may lead to underfitting of the model. Therefore, it is necessary to re-extract features from the data and use the PCA decision tree method to perform appropriate feature processing to retain the temporal characteristics of the data.

[0060] First, the data is dimensionally reduced to retain the time series information. The data attribute features of the intelligent traffic data set Car Hacking include Timestamp, CAN ID, DLC, DATA, and Flag. Timestamp is the timestamp information, CAN ID is the identifier of the hexadecimal CAN message (for example, 043f), DLC is the data byte length, the DATA segment is a 32-bit hexadecimal number, and the FLAG flag indicates whether it is attacked, including two categories, T and R. Analyze the characteristics of various attacks: Dos attack injects high-priority CAN messages (for example, 0x000 CAN ID data packets) in a short period, Fuzzy attack injects completely random CAN ID and data value messages every 0.5 milliseconds, and Spoofing attack injects messages of certain CAN IDs related to RPM / Drive Gear information every 1 millisecond. All four attacks use CAN IDs for message injection, and considering the actual needs, inputting too much irrelevant data will greatly prolong the model training time, which is not conducive to experimental analysis. Therefore, in this experiment, CAN ID is extracted as the feature required for the experiment. At the same time, considering that most real security detections are detections in continuous time periods, detecting message by message is prone to false alarms and consumes too many computing resources. Therefore, every 30 consecutive CAN IDs are spliced ​​into a new CAN ARRAY feature (observing the data set, it is found that the maximum interval of the attack sequence is 29 messages) to retain the timing information.

[0061] The data is then labeled and encoded, with the labels being encoded 0-4 in the order of Dos, Fuzzy, Gear, RPM, and Normal. The duplicate data is then cleaned, and the processing is as follows:

[0062] First, the duplicate data is deleted. After the original Car Hacking dataset is processed with the above data features, there are 576,563 data in total. After deleting the duplicate data, there are 488,596 data in total, of which 279,752 are normal data and 208,844 are abnormal data, including 36,002 Dos attacks, 42,073 Fuzzy attacks, 62,441 Gear attacks, and 68,328 RPM attacks.

[0063] Finally, the data set is divided into training set, validation set and test set, which are randomly divided according to the ratio of 8:1:1. After the division is completed, it is saved as a local file, and the subsequent model training will directly read the file. Among them, after data preprocessing, the vehicle network experimental data set containing different attack types is divided as follows: 28,834 Dos attacks, accounting for 9% of the total data; 33,760 Fuzzy attacks, accounting for 10% of the total data; 49,755 Gear attacks, accounting for 13% of the total data; 54,709 RPM attacks, accounting for 14% of the total data; 223,819 normal data, accounting for 54% of the total data.

[0064] See also Figure 4 In this example, the Transformer encoding layer feature learning module consists of an embedding encoding layer data dimension expansion module, a position embedding encoding layer data feature learning module, and an encoder update module. The embedding encoding layer data dimension expansion module enters the embedding encoding layer of the Transformer according to the preprocessed data. This layer expands the dimension of the preprocessed data and converts the discrete variables into continuous vector representations. In this module, the model expands the input data to 64 dimensions. The position embedding encoding layer data feature learning module uses sin and cos functions to perform linear transformation based on the data processed by the position embedding encoding layer to provide position information. The update module contains six identical sub-encoder layers, and each sub-layer structure includes two main components: a multi-head attention layer and a feedforward neural network layer. Between two adjacent layers, connections are established through residual connections and normalization. The design of residual connections is to prevent gradient explosion caused by gradient descent, and the role of the normalization layer is to normalize the hidden layers in the neural network to a normal distribution, thereby improving the training speed and performance of the model. This not only helps to accelerate the convergence speed of the training model, but also improves the generalization ability of the model. The above three constitute a complete Transformer encoding layer feature learning module, which is used to further enable the deep learning network to effectively extract time series features in the data.

[0065] Accordingly, if Figure 4 As shown in the figure, the calculation formula corresponding to the Transformer encoding layer feature learning module is:

[0066] PE (pos,2i) =sin(pos / 10000 2i / dmodel ) (1)

[0067] PE (pos,2i+1) =cos(pos / 10000 2i / dmodel ) (2)

[0068]

[0069]

[0070] The sin and cos functions correspond to a set of odd and even numbered dimensions respectively. i is the sequence number. Here, pos refers to the position information of the feature in the sequence, and dmodel represents the dimension of the encoding, which is set to 64. At the same time, the output period of the position embedding function PE(·) is designed to be in the range of 2π to 2π×10000, so that each position can obtain different position encodings in different dimensions. The position embedding encoding layer learns the data feature module as shown in formulas 1 and 2. By combining the values ​​of sin and cos functions of different periods, a unique position encoding is achieved, providing the model with key position information. The specific form of this key position information can be manifested as time series features in experimental data, thereby improving the model's ability to model actual sequence data.

[0071] After the data input is embedded in the encoding layer to expand the data dimension module, it is directly added to the position vector of the position embedding encoding layer to learn the data feature module as the input of the encoder update module. The encoder update module is shown in Formulas 3 and 4. It consists of 6 identical sub-layers. Each sub-layer includes two parts: a multi-head attention layer and a feedforward neural network layer, and the connection between each two layers is realized through residual connection and normalization. The multi-head attention layer adopts the self-attention mechanism. Different from the traditional seq2seq model, the multi-head attention layer divides the attention module into 8 heads, and each element of the input sequence interacts with other elements, as shown in Formula 3. Among them, Q, K, and V are the query vector sequence, the key vector sequence, and the value vector sequence, respectively. First, the encoding vector of the input sequence is mapped to a high-dimensional space through a linear transformation to obtain the initial query, key, and value matrices. For each query vector, its similarity score with all key vectors is calculated, and the score is normalized to obtain the attention score. The attention score is multiplied by the value matrix to obtain the attention weight. The attention weights are then calculated through multiple heads to obtain multiple weighted sum vectors, which are concatenated together and then mapped to a low-dimensional space through a linear transformation, i.e., the output of the multi-head self-attention layer. The multi-head self-attention layer is followed by a Softmax sublayer, as shown in Formula 4, d kThe dimensions of the Q, K, and V matrices are used to output the relevant position weight information. The encoder update module is finally connected to the feedforward neural network layer, which is used to perform nonlinear transformation on the output of the encoder. The feedforward neural network layer contains two fully connected layers and a GELU activation function. The GELU activation function is used to avoid the problem of being too linear in the negative range. This design further enables the network to effectively extract time series features from the data.

[0072] See also Figure 5 In this example, the above-mentioned coding layer feature learning modules are connected in sequence to form the multi-classification neural network output module based on the DNN network. Exemplarily, the multi-classification neural network output module based on the DNN network includes two hidden layers, a cross entropy function and an optimizer. Each hidden layer includes a fully connected layer, a ReLU activation function and a Dropout function. After two hidden layers, the DNN network can map the high-dimensional features extracted by the coding layer feature learning module to a dimension suitable for classification, and finally output the classification results for the intrusion detection task. The Dropout function is used to improve the generalization of the model.

[0073] Furthermore, if Figure 5 As shown in the figure, the cross entropy loss function, after the preprocessed data is trained through the constructed Transformer encoding layer feature learning module, can quantify the difference between the model training data and the initial data annotation, and measure the performance of the proposed intrusion detection model classification task.

[0074] The formula for the cross entropy loss function is as follows:

[0075]

[0076] Among them, y ij Indicates whether the true label of the i-th sample belongs to the j-th category. It represents the model's predicted probability that the i-th sample belongs to the j-th category, C represents the total number of attack types, and N is the batch size of the model.

[0077] Furthermore, if Figure 5 As shown in the figure, the optimizer uses the stochastic gradient descent SGD optimizer, which randomly selects intrusion data samples for update, thereby improving the speed of model training. The stochastic gradient descent SGD optimizer contains multiple hyperparameters: the learning rate is set to 0.001, the momentum parameter is set to 0.99, the weight_decay, dampening parameters are set to the default 0, and the nesterov parameter is set to the default False. By updating the weights during the gradient descent iteration process, the loss function value is reduced and the model performance is improved.

[0078] See also Figure 6 , a schematic diagram of the structure of the intelligent transportation vehicle safety detection and identification module;

[0079] Exemplarily, the learned feature matrix representation output of the Transformer encoding layer feature learning module is passed through a multi-classification neural network output module based on a DNN network, and the dimensions of the two hidden layers are transformed to obtain an updated high-dimensional feature security detection classification result.

[0080] Furthermore, in this embodiment, the intelligent traffic vehicle data preprocessing module, the Transformer coding layer feature learning module, and the multi-classification neural network output module based on the DNN network are sequentially connected to form an intelligent traffic vehicle safety detection and system based on Transformer transfer learning; the intelligent traffic vehicle safety detection and identification module uses the transfer learning method to further adjust the proposed model on the M-CAN and B-CAN intrusion attack data sets, including:

[0081] Through experimental research, the proposed model has better detection accuracy in the intelligent traffic data set Car Hacking than previous security detection models, which is mainly due to the full use of the temporal features in the data by our model. However, considering that there are relatively few attack types in this intrusion detection data set and there are clear attack annotations, the detection accuracy of most models on this data set is relatively high, which makes it difficult to show the discrimination of the model. In order to further highlight the generalization of our model, an intelligent traffic vehicle safety detection and identification module is added, which uses the transfer learning method to further adjust the model in two other more complex M-CAN and B-CAN intrusion attack data sets. This strategy aims to enable the proposed model to maintain efficient detection performance when facing more diverse and complex intelligent traffic scenarios.

[0082] Further, in this embodiment, the use of the adjusted model parameters and multiple training results on the M-CAN and B-CAN intrusion data sets to select a model with the best performance accuracy, and save the best model and results, includes:

[0083] The intelligent traffic vehicle safety detection model is further trained on the time series features and attack features learned in the Car Hacking dataset. This step aims to obtain more complex features of different attack types through further training on the M-CAN and B-CAN intrusion attack datasets, thereby further improving the generalization ability of the model.

[0084] Furthermore, in this embodiment, in order to verify the effectiveness of the feature selection method and evaluate the impact of specific features on the model results, the process of performing an ablation experiment on the proposed model is as follows, including:

[0085] Using the Transformer+DNN method as the baseline, the separate DNN method, the Transformer method, and the complete module security detection model were experimented on the M-CAN and B-CAN intrusion attack datasets, respectively, to further verify the correctness of the model and the importance of the timing features on the intrusion attack datasets. The best performance intelligent transportation vehicle safety detection model that passed multiple rounds of tests was encapsulated to build an intelligent transportation vehicle safety detection system with excellent performance and strong generalization.

[0086] Embodiment 2

[0087] The present invention also provides an intelligent transportation vehicle safety detection system based on transfer learning, comprising: a data preprocessing module, a first model training module, a first adjustment module, a second adjustment module, a second model training module and a detection module;

[0088] The data preprocessing module is used to perform data preprocessing on the intelligent traffic data set Car Hacking, and extract the time series features and attack features in the intelligent traffic data set Car Hacking, wherein the intelligent traffic data set Car Hacking includes Dos attack, Fuzzy attack, Spoofing and normal data;

[0089] The first model training module is used to train the intelligent transportation vehicle safety detection model built based on the Transformer multi-type neural network by using the time series features and attack features;

[0090] The first adjustment module is used to process the prediction of the training data and the initial labeling of the training data in the first model training module, calculate the prediction error of the intelligent transportation vehicle safety detection model, and fine-tune and optimize the parameters of the intelligent transportation vehicle safety detection model based on the prediction error;

[0091] The second adjustment module is used to test the fine-tuned and optimized intelligent transportation vehicle safety detection model using the intelligent transportation data set Car Hacking, and further adjust the intelligent transportation vehicle safety detection model that has passed the test on the M-CAN and B-CAN intrusion attack data sets using the transfer learning method;

[0092] The second model training module is used to train the further adjusted intelligent transportation vehicle safety detection model using the M-CAN and B-CAN intrusion attack data sets to obtain an intelligent transportation vehicle safety attack detection model that reaches a preset accuracy;

[0093] The detection module is used to perform ablation experiments on the intelligent transportation vehicle safety attack detection model that achieves a preset accuracy, select the intelligent transportation vehicle safety attack detection model with the best performance for encapsulation, and complete the safety detection of the intelligent transportation vehicle based on the intelligent transportation vehicle safety attack detection model.

[0094] The present invention discloses a smart traffic carrier security attack detection model based on Transformer transfer learning, and divides the traffic vehicle carrier security attack detection model into two parts: a data preprocessing module and a security detection module. For the smart traffic vehicle data preprocessing part, we use principal component analysis and decision tree methods to reduce the dimension of data features, eliminate most of the irrelevant features in the data, and retain the most critical attack features and time series features of the data. For the security detection model part, it is regarded as a target detection task to determine whether the smart traffic vehicle is under external attack. Transformer combines a multi-head self-attention mechanism and a target classification technology. The multi-head self-attention mechanism can well learn the time series features of the smart traffic vehicle network data, while the target classification technology can be used to identify different intrusion attack data types. Its advantage lies in its lightweight time series feature extraction design, which enables it to run efficiently in a resource-constrained environment and achieve higher detection accuracy. This means that the model can be deployed on smart traffic vehicle-mounted detection terminal devices and provide real-time attack security detection for the smart traffic safety industry. By detecting and analyzing the intelligent transportation vehicle network, it is possible to timely discover whether the intelligent transportation vehicle is under attack, and then adopt corresponding security strategies to improve the overall security of the intelligent transportation carrier. The method and system of the present invention have achieved remarkable results in relevant application scenarios and provided a reliable solution for the field of intelligent transportation information security.

[0095] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.

Claims

1. A smart traffic vehicle safety detection method based on transfer learning, characterized in that: The following steps are involved: S1. Preprocess the data of Car Hacking, an intelligent traffic data set, and extract the time series features and attack features in the Car Hacking, wherein the Car Hacking, an intelligent traffic data set, includes Dos attacks, Fuzzy attacks, Spoofing, and normal data. S2. Using the time series features and attack features, train an intelligent transportation vehicle safety detection model based on a Transformer multi-type neural network; S3, processing the prediction of the training data in S2 and the initial labeling of the training data, calculating the prediction error of the intelligent transportation vehicle safety detection model, and fine-tuning and optimizing the parameters of the intelligent transportation vehicle safety detection model based on the prediction error; S4, using the Car Hacking intelligent traffic data set to test the fine-tuned and optimized intelligent traffic vehicle safety detection model, and using the transfer learning method to further adjust the intelligent traffic vehicle safety detection model that has passed the test on the M-CAN and B-CAN intrusion attack data sets; S5. Using the M-CAN and B-CAN intrusion attack data sets to train the further adjusted intelligent transportation vehicle safety detection model, to obtain an intelligent transportation vehicle safety attack detection model that achieves a preset accuracy; S6. Perform an ablation experiment on the intelligent transportation vehicle safety attack detection model that has achieved a preset accuracy, select the intelligent transportation vehicle safety attack detection model with the best performance for encapsulation, and complete the safety detection of the intelligent transportation vehicle based on the intelligent transportation vehicle safety attack detection model; In S1, the method for preprocessing the data of the intelligent traffic data set Car Hacking includes: The PCA decision tree method is used to reduce the feature dimension of the intelligent traffic dataset Car Hacking and retain the time series information. Performing label encoding on the Car Hacking intelligent traffic data set after feature dimension reduction, wherein the label encoding is performed in the order of Dos, Fuzzy, Gear, RPM, and Normal; Cleaning the repeated data in the intelligent traffic data set Car Hacking after label encoding, extracting the time series features and attack features in the intelligent traffic data set Car Hacking; Car Hacking, an intelligent traffic data set, is analyzed and data features are extracted. The data set contains Dos attack, fuzzy attack, spoofing and normal data, totaling 17,558,462 data items, of which 15,226,830 items are normal data items and 2,331,517 items are abnormal data items, accounting for 13% of the total items. PCA decision tree method is used to perform appropriate feature processing to retain the temporal characteristics of the data. First, the data is reduced in dimension and the timing information is retained. The data attribute features of the intelligent traffic data set Car Hacking include Timestamp, CAN ID, DLC, DATA, and Flag, where Timestamp is the timestamp information, CAN ID is the identifier of the hexadecimal CAN message, DLC is the data byte length, the DATA segment is a 32-bit hexadecimal number, and the FLAG flag indicates whether it is attacked, including two categories, T and R. The characteristics of various attacks are analyzed: Dos attack injects high-priority CAN messages in a short period, Fuzzy attack injects completely random CAN ID and data value messages every 0.5 milliseconds, and Spoofing attack injects certain CAN ID messages related to RPM / Drive Gear information every 1 millisecond; CAN ID is extracted as the feature required for the experiment, and every 30 consecutive CAN IDs are spliced ​​into a new CAN ARRAY feature to retain the timing information; The data is then labeled and encoded, with the labels being encoded 0-4 in the order of Dos, Fuzzy, Gear, RPM, and Normal. The duplicate data is then cleaned, and the processing process is as follows: First, duplicate data is deleted. The original Car Hacking dataset has 576,563 data after being processed with the above data features. After deleting duplicate data, there are 488,596 data in total, including 279,752 normal data and 208,844 abnormal data, including 36,002 Dos attacks, 42,073 Fuzzy attacks, 62,441 Gear attacks, and 68,328 RPM attacks. Finally, the data set is divided into training set, validation set and test set, which are randomly divided according to the ratio of 8:1:

1. After the division, they are saved as local files, and the subsequent model training will directly read the files. Among them, after data preprocessing, the division of the vehicle network experiment data set containing different attack types is as follows: 28,834 Dos attacks, accounting for 9% of the total data; 33,760 Fuzzy attacks, accounting for 10% of the total data; 49,755 Gear attacks, accounting for 13% of the total data; 54,709 RPM attacks, accounting for 14% of the total data; 223,819 normal data, accounting for 54% of the total data; In S2, the method for training the intelligent traffic vehicle safety detection model based on the Transformer multi-type neural network by using the time series features and attack features includes: Input the time series features and attack features into the vector embedding coding layer of the Transformer to expand the dimension, convert the discrete variables into continuous vector representation, and obtain the coding vector; The timing features and attack features are input into the position embedding encoding layer of the Transformer, and the position information is provided by linear transformation using sin and cos functions to obtain a position vector; The encoding vector is directly added to the position vector to obtain the input of the Transformer encoding layer; wherein the Transformer encoding layer is composed of 6 identical sub-layers, each sub-layer includes two parts: a multi-head attention layer and a feedforward neural network layer, and the connection between each two layers is realized by residual connection and normalization; After the Transformer encoding layer, a Softmax sublayer is connected to output the relevant position weight information; Based on the relevant position weight information, a DNN network is used to classify and output high-dimensional features; The Transformer encoding layer feature learning module consists of an embedding encoding layer data dimension expansion module, a position embedding encoding layer learning data feature module and an encoder update module; the embedding encoding layer data dimension expansion module enters the embedding encoding layer of the Transformer according to the preprocessed data, expands the dimension of the preprocessed data, and converts the discrete variables into continuous vector representations; in the module, the model expands the input data to 64 dimensions; the position embedding encoding layer learning data feature module uses sin and cos functions for linear transformation according to the data processed by the position embedding encoding layer to provide position information; the update module contains six identical sub-encoder layers, and each sub-layer structure includes two main components: a multi-head attention layer and a feedforward neural network layer; between two adjacent layers, a connection is established through residual connection and normalization; the design of the residual connection is to prevent the gradient explosion caused by gradient descent, and the role of the normalization layer is to standardize the hidden layer in the neural network to a normal distribution, thereby improving the training speed and performance of the model; the three constitute a complete Transformer encoding layer feature learning module, which is used to further enable the deep learning network to effectively extract time series features in the data; Methods for linear transformation using sin and cos functions include: ON (pos,2i) =sin(pos / 10000 2i / dmodel ) ON (pos,2i+1) =cos(pos / 10000 2i / dmodel ) Among them, the sin and cos functions correspond to a set of odd and even numbered dimensions respectively; i is the sequence number; pos represents the position information of the feature in the sequence; dmodel represents the encoding dimension, which is set to 64; at the same time, the output period of the position embedding function PE(·) is designed to be in the range of 2π to 2π×10000, so that each position can obtain different position encodings in different dimensions; The multi-head attention layer divides the attention module into 8 heads, and interacts each element of the input sequence with other elements; specifically: first, the encoding vector of the input sequence is mapped to a high-dimensional space through a linear transformation to obtain the initial query, key and value matrices; the similarity score between each query vector and all key vectors is calculated, and the score is normalized to obtain the attention score; the attention score is multiplied by the value matrix to obtain the attention weight; the attention weight is then calculated through multiple different heads to obtain multiple weighted sum vectors, which are spliced ​​together and then mapped to a low-dimensional space through a linear transformation to obtain the output of the multi-head self-attention layer; After the data input is embedded in the coding layer to expand the data dimension module, it is directly added to the position vector of the data feature module learned by the position embedding coding layer as the input of the encoder update module; it is composed of 6 identical sub-layers, each of which consists of two parts: a multi-head attention layer and a feedforward neural network layer, and the connection between each two layers is realized through residual connection and normalization; the multi-head attention layer adopts the self-attention mechanism. The multi-head attention layer divides the attention module into 8 heads, and interacts each element of the input sequence with other elements, where Q, K, and V are the query vector sequence, the key vector sequence, and the value vector sequence, respectively. columns; first, the encoding vector of the input sequence is mapped to a high-dimensional space through a linear transformation to obtain the initial query, key and value matrices; for each query vector, the similarity score with all key vectors is calculated, and the score is normalized to obtain the attention score; the attention score is multiplied by the value matrix to obtain the attention weight; the attention weight is then calculated through multiple different heads to obtain multiple weighted sum vectors, which are concatenated together and then mapped to a low-dimensional space through a linear transformation to obtain the output of the multi-head self-attention layer; the multi-head self-attention layer is connected to a Softmax sublayer, d k The dimensions of the Q, K, V matrices are used to output the relevant position weight information; the encoder update module is finally connected to the feedforward neural network layer to perform a nonlinear transformation on the encoder output; the feedforward neural network layer contains two fully connected layers and a GELU activation function; The DNN network includes two hidden layers, each hidden layer includes a fully connected layer, a ReLU activation function and a Dropout function.

2. The intelligent transportation vehicle safety detection method based on transfer learning according to claim 1 is characterized in that: In S6, the method of performing an ablation experiment on the intelligent transportation vehicle security attack detection model that reaches a preset accuracy includes: Using the Transformer+DNN method as the baseline, the separate DNN method, the Transformer method and the intelligent transportation vehicle safety attack detection model were experimented on the M-CAN and B-CAN intrusion datasets respectively, and the best performance security detection model that passed multiple rounds of tests was encapsulated to build an intelligent transportation vehicle safety detection system.

3. An intelligent traffic vehicle safety detection system based on transfer learning, wherein the intelligent traffic vehicle safety detection system applies the intelligent traffic vehicle safety detection method according to any one of claims 1 to 2, characterized in that: include: A data preprocessing module, a first model training module, a first adjustment module, a second adjustment module, a second model training module and a detection module; The data preprocessing module is used to perform data preprocessing on the intelligent traffic data set Car Hacking, and extract the time series features and attack features in the intelligent traffic data set Car Hacking, wherein the intelligent traffic data set Car Hacking includes Dos attack, Fuzzy attack, Spoofing and normal data; The first model training module is used to train the intelligent transportation vehicle safety detection model built based on the Transformer multi-type neural network by using the time series features and attack features; The first adjustment module is used to process the prediction of the training data and the initial labeling of the training data in the first model training module, calculate the prediction error of the intelligent transportation vehicle safety detection model, and fine-tune and optimize the parameters of the intelligent transportation vehicle safety detection model based on the prediction error; The second adjustment module is used to test the fine-tuned and optimized intelligent transportation vehicle safety detection model using the intelligent transportation data set Car Hacking, and further adjust the intelligent transportation vehicle safety detection model that has passed the test on the M-CAN and B-CAN intrusion attack data sets using the transfer learning method; The second model training module is used to train the further adjusted intelligent transportation vehicle safety detection model using the M-CAN and B-CAN intrusion attack data sets to obtain an intelligent transportation vehicle safety attack detection model that achieves a preset accuracy; The detection module is used to perform an ablation experiment on the intelligent transportation vehicle safety attack detection model that reaches a preset accuracy, select the intelligent transportation vehicle safety attack detection model with the best performance for encapsulation, and complete the safety detection of the intelligent transportation vehicle based on the intelligent transportation vehicle safety attack detection model.

Citation Information

Patent Citations

  • Text semantic similarity analysis method and device and computer equipment

    CN111368024A

  • Vehicle-mounted network intrusion detection method based on improved visual self-attention model

    CN117040939A