CN113255725A - Automobile sensor attack detection and repair method based on two-stage LSTM - Google Patents
Automobile sensor attack detection and repair method based on two-stage LSTM Download PDFInfo
- Publication number
- CN113255725A CN113255725A CN202110422459.0A CN202110422459A CN113255725A CN 113255725 A CN113255725 A CN 113255725A CN 202110422459 A CN202110422459 A CN 202110422459A CN 113255725 A CN113255725 A CN 113255725A
- Authority
- CN
- China
- Prior art keywords
- data
- value
- automobile
- lstm
- attack
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 238000001514 detection method Methods 0.000 title claims description 34
- 230000008439 repair process Effects 0.000 title claims description 8
- 230000008859 change Effects 0.000 claims abstract description 5
- 230000006870 function Effects 0.000 claims description 30
- 238000012549 training Methods 0.000 claims description 29
- 210000002569 neuron Anatomy 0.000 claims description 21
- 238000004422 calculation algorithm Methods 0.000 claims description 17
- 238000012360 testing method Methods 0.000 claims description 13
- 230000008569 process Effects 0.000 claims description 12
- 230000002159 abnormal effect Effects 0.000 claims description 10
- 230000015654 memory Effects 0.000 claims description 10
- 210000004027 cell Anatomy 0.000 claims description 9
- 230000000694 effects Effects 0.000 claims description 8
- 230000007246 mechanism Effects 0.000 claims description 7
- 230000011218 segmentation Effects 0.000 claims description 7
- 230000001133 acceleration Effects 0.000 claims description 6
- 238000009825 accumulation Methods 0.000 claims description 6
- 230000004913 activation Effects 0.000 claims description 6
- 238000010606 normalization Methods 0.000 claims description 6
- 238000005457 optimization Methods 0.000 claims description 6
- 238000004088 simulation Methods 0.000 claims description 6
- 241000270295 Serpentes Species 0.000 claims description 4
- 238000013145 classification model Methods 0.000 claims description 4
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 claims description 3
- 238000004364 calculation method Methods 0.000 claims description 3
- 150000001875 compounds Chemical class 0.000 claims description 3
- 238000011156 evaluation Methods 0.000 claims description 3
- 238000012886 linear function Methods 0.000 claims description 3
- 238000013507 mapping Methods 0.000 claims description 3
- 238000012545 processing Methods 0.000 claims description 3
- 230000001502 supplementing effect Effects 0.000 claims description 2
- SAZUGELZHZOXHB-UHFFFAOYSA-N acecarbromal Chemical compound CCC(Br)(CC)C(=O)NC(=O)NC(C)=O SAZUGELZHZOXHB-UHFFFAOYSA-N 0.000 claims 2
- 238000005067 remediation Methods 0.000 claims 1
- 238000010801 machine learning Methods 0.000 description 5
- 238000013135 deep learning Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013136 deep learning model Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 230000006386 memory function Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000306 recurrent effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000006403 short-term memory Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/243—Classification techniques relating to the number of classes
- G06F18/2433—Single-class perspective, e.g. one-against-all classification; Novelty detection; Outlier detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computational Linguistics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Evolutionary Biology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Steering Control In Accordance With Driving Conditions (AREA)
Abstract
A method for detecting and repairing the attack of car sensor based on two-stage LSTM features that the data set is preprocessed to identify the steering state of car according to the intensity of angle change of steering wheel, the CLSTM (class model) is used to extract the characteristics of car, the current steering state of car is accurately identified, the corresponding RLSTM (regression model) is autonomously selected for prediction through the difference of the steering conditions, an error threshold value is set, the difference between the predicted value and the observed value at the current moment is compared, if the difference between the predicted value and the observed value is higher than the error threshold value, the predicted value replaces the observed value and is fed back to the automobile model.
Description
Technical Field
The invention belongs to the technical field of machine learning, and relates to an automobile sensor attack detection and repair method based on two-stage LSTM.
Background
The method for guaranteeing safe driving of the automobile relates to technologies in multiple aspects, automatic and efficient detection of attacks on the automobile is a powerful way for guaranteeing safe driving of the automobile, attack detection on automobile safety problems at home and abroad is mostly applied to a CAN bus at present, a traditional method and a method based on machine learning are mainly adopted, and the two methods have a stage of feature extraction. The traditional method is to manually set a threshold value for detecting the attack according to different attack types, and the machine learning method is to automatically learn the malicious attack pattern from the data set based on a given model. At present, with the wide application of deep learning in image recognition and speech recognition, the learning potential of a deep learning model in a given data set is receiving wide attention, so that many technicians apply the deep learning method to attack detection of an automobile safety problem to obtain good effect, but at present, few people refine the deep learning method to the attack detection of an automobile sensor.
The LSTM (long-short term memory network) can well process the classification and regression problems, and the reason that the LSTM (long-short term memory network) has better performance in time sequence data is that the LSTM is globally processed, has a memory function which is increased compared with the common RNN (recurrent neural network), and can better process the long-short term dependence problem; furthermore, LSTM may autonomously handle related problems depending on the type of input data, handling classification problems if the input data is classified data, and handling regression problems if the input data is numerical data. Based on these characteristics, LSTM has been widely used in many scenes in modern society.
Disclosure of Invention
The existing LSTM has better effect on solving the problems of classification and regression, but cannot simultaneously realize two functions in a model framework, and in order to overcome the defects of the prior art, the invention provides a two-stage LSTM-based automobile sensor attack detection and restoration method.
The technical scheme adopted by the invention for solving the technical problems is as follows:
a two-stage LSTM-based automobile sensor attack detection and repair method comprises the following steps:
step 1: the method comprises the steps that data are collected through combined simulation of Carsim and Simulink simulation software, data of a plurality of sensors of an automobile under different steering conditions are collected to form a data set, the plurality of sensors are selected to be yaw velocity AVz, lateral acceleration Ay and steering wheel turning angle Steer _ SW, and the data set is preprocessed;
step 2: selecting and dividing a data set;
and step 3: training by two-stage LSTM;
and 4, step 4: the method comprises the following steps that a CLOSTM in a training stage uses CrossEntropyLoss as a loss function, an adam is selected as an optimization algorithm, an mse is selected as a loss function in an RLSTM, and an rmsprop is selected as an optimization algorithm;
and 5: when the loss function meets the optimal condition, respectively saving CLSTM and RLSTM, and respectively naming RLSTM as 0, 1 and 2 … n according to different automobile steering degrees;
step 6: designing a two-stage LSTM selection algorithm;
and 7: after model prediction is completed, the observed value is calculatedAnd the actual value of the current momentError e oftJudging whether the data is the data of the attacked automobile sensor by using a window error accumulation method;
and 8: manually setting a threshold value W0Selecting a time sliding window m, and calculating the error accumulation of the predicted value and the observed value under the current windowW is to be0Andcomparing, if greater than threshold value W0Judging the observed value at the time t as an abnormal value, and if the observed value is judged to be abnormal, replacing the observed value with the predicted value at the current time, entering the predicted value into the next window sequence and inputting the predicted value into the RLSTM to participate in calculation;
and step 9: and at the moment when the numerical value of the automobile sensor is attacked, the predicted value of the RLSTM replaces the observed value and enters an automobile control unit for closed-loop operation, so that the aim of eliminating the attack is fulfilled.
Further, in step 1, the data set is preprocessed, and the process is as follows:
step 1-1: checking whether a missing value exists in the data set or not, and if so, supplementing the missing value;
step 1-2: the data set relates to complex automobile steering conditions, and the data set is used for three automobile sensor data through different steering wheel turning angles Steer _ SW: marking the snake shape as 0, the lane change as 1 and the right-angle turn as 2 according to different steering conditions of the automobile by using the yaw angular velocity AVz, the lateral acceleration Ay and the steering wheel turn angle Steer _ SW respectively, and storing the labels and other characteristic attributes separately;
step 1-3: normalizing the data, and normalizing the data in the data set according to the following formula:
in the formula, X*Represents the data after normalization, X represents the data before normalization, XminRepresenting the minimum value, X, of a certain sensor of the vehicle in the current data sequencemaxRepresents a certain sensor of the automobileThe maximum value in the current data sequence.
Still further, the process of step 2 is as follows:
step 2-1: setting sensor data of a very short time at the beginning of automobile running under multiple steering conditions collected in the step 1 as a classification sample;
step 2-2: introducing a data segmentation algorithm, performing equidistant segmentation processing on the data set, and expanding the sample volume of the data set;
step 2-3: repeating the step 2-2, merging all the segmented data into a large sample, and naming the large sample as a Classify _ data sample set;
step 2-4: and (3) independently storing all data sets of the yaw velocity AVz acquired in the step (1), and naming the data sets as Detection sample data sets Detection _ data.
In step 3, the process of training by the two-stage LSTM is as follows:
step 3-1: the two-stage LSTM comprises a CLSTM and an RLSTM, 70% of the data set Classify _ data in the step 2-3 is selected as a training set to be imported into the CLSTM for training, 30% of the data set Classify _ data in the step 2-3 is used as a test set, and a softmax function is used as an activation function;
step 3-2: the LSTM is different from RNN in that a door mechanism and a cell state update are added in a hidden layer, wherein the door mechanism mainly comprises a forgetting door, a memory door, an output door and a gating function ftThe information needing to be forgotten at the last moment is controlled according to the state values (0 and 1, wherein 0 represents forgetting and 1 represents reserving) of the cell units at the last moment. Memory gate itAn output gate O for controlling input information, judging whether memory is neededtOutput information was confirmed based on cell status (0 and 1, where 0 indicates no passage of information and 1 indicates passage of run).
Step 3-3: classifying through a sigmoid function, and expressing evaluation indexes of classification precision by using Accuracy and Error _ rate:
in the formula, TP represents that the real category is a positive example, and the prediction category is a positive example; FP indicates that the real category is a negative example and the prediction category is a positive example; FN indicates that the real category is a positive example, and the prediction category is a negative example; TN represents that the real category is a negative case, the prediction category is a negative case, P represents the total number of positive cases, and N represents the total number of negative cases;
step 3-4: selecting 70% of the data set Detection _ data in the step 2-4 as a training set, importing the training set into the RLSTM for training, using 30% of the data set Detection _ data in the step 2-4 as a test set, and using a linear function as an activation function;
step 3-5: RLSTM adopts a mode of sliding a time window, takes the value of the next time point as a training label of the sample of the previous time point, and gives the previous small-segment sequence in the Detection _ data in the steps 2-4The prediction model can obtain the predicted value of the next moment, namely the t momentThe first t-1 data are sequentially sent to an input layer of the model as input data, and the last data of the sequence in the window is used as an expected label for optimizing the prediction error of the model; formally, a predictive model is represented as an approximate simulation of a function:
in the formula (I), the compound is shown in the specification,the mapping satisfies a timing constraint and the predicted value at the next time is only related to the observed value at the previous time, i.e.Rely on only
In the step 6, the process of the two-stage LSTM selection algorithm is as follows;
step 6-1: taking the test set of Classify _ data in the step 2-3 as the input of CLSTM;
step 6-2: and (5) selecting different RLSTMs according to different model names in the step 5, and predicting the test set data of Detection _ data in the step 2-4.
Preferably: in the step 3-1, the input layer of the classification model CLSTM is 3 neurons, the output is 2 neurons, and the hidden layer is 32 neurons.
Preferably: in the step 3-4, there are 4 layers of networks in the regression model RLSTM, the input is 10 neurons, i.e. the sliding window is 10, the output is 1 neuron, 2 hidden layers are set, the first layer is 50 neurons, and the second layer is 100 neurons.
Preferably: in the step 7, the mentioned attack type is a high-amplitude sound wave attack, specifically, the MEMS gyroscope generates abnormal output and causes the automobile sensor to generate abnormal data through a resonance effect generated by the high-amplitude sound wave and the MEMS gyroscope.
Preferably: in the step 9, the effect of repairing the predicted value replacing the observed value can be embodied from the value of the automobile sensor, and can also be embodied in the actual steering of the automobile through an automobile closed-loop control algorithm.
In the invention, data are acquired by combined simulation of Carsim and Simulink simulation software, the data are preprocessed, CLSTM (Classification model) is used for carrying out dimension reduction and feature extraction on a complex driving scene of an automobile, RLSTM (regression model) is used for training single-dimensional automobile sensor data, the training is stopped when loss functions of the CLSTM and the RLSTM meet conditions, respective models are stored, the trained models are tested on a test set by a two-stage LSTM selection algorithm, whether the current sensor data is attacked or not is judged by using a window accumulated error method after prediction is finished, and an observed value of the sensor data at the attacked part of the automobile is replaced by a predicted value to enter an automobile control unit for closed-loop operation, so that the purpose of eliminating the attack is achieved.
The invention has the following beneficial effects: 1. the application of the deep learning technology to the attack detection of the automobile sensor is probably put forward for the first time in the invention; 2. compared with a single LSTM, the invention provides a two-stage LSTM attack detection method, which improves the attack detection success rate of the automobile sensor in a complex scene; 3. the invention provides an effective repairing method when an automobile sensor is attacked.
Drawings
FIG. 1 is a flow chart of a two-stage LSTM-based method for detecting and remediating an attack on an automotive sensor;
FIG. 2 is a schematic diagram of a sliding time window;
FIG. 3 is a schematic diagram of a predictive replacement mechanism;
FIG. 4 is a graph of an identification accuracy confusion matrix;
FIG. 5 is a diagram of a two-stage LSTM-based attack detection and repair method for an automotive sensor, where (a) the length of the Predicted label is 0.3s, and (b) the length of the Predicted label is 0.7 s.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Referring to fig. 1 to 5, a method for detecting and repairing an attack of an automobile sensor based on a two-stage LSTM, as shown in fig. 1, includes data preprocessing, data set selection and segmentation, two-stage LSTM model training, two-stage LSTM model selection, and attack repair, and the method includes the following steps:
step 1: collecting data of a plurality of sensors of the automobile under different steering conditions to form a data set, wherein the plurality of sensors are selected from AVz (yaw rate), Ay (lateral acceleration) and Steer _ SW (steering wheel angle), and preprocessing the data set, wherein the process is as follows:
step 1-1: the data set relates to complex automobile steering conditions, such as 'snake shape', lane change, right-angle turning and the like, the invention carries out three categories, and therefore, the data of three automobile sensors are mainly obtained through the difference of Steer _ SW (steering wheel) angles: AVz (yaw rate), Ay (lateral acceleration), Steer _ SW (steering wheel angle) respectively mark the 'snake shape' as 0, the lane change as 1 and the quarter turn as 2 according to different steering conditions of the automobile. Storing labels and other characteristic attributes separately
Step 1-2: because the numerical attributes of each sensor of the automobile have larger magnitude difference, the machine learning model is often underperformed, and in order to better and faster make the model converge, the data needs to be normalized, and the data in the data set is normalized according to the following formula:
in the formula, X*Represents the data after normalization, X represents the data before normalization, XminRepresenting the minimum value, X, of a certain sensor of the vehicle in the current data sequencemaxRepresents the maximum value of a certain sensor of the automobile in the current data sequence;
step 2: the data set is selected and divided by the following process:
step 2-1: taking the sensor data of the extremely short time (0.3s or 0.7s) when the automobile starts to run under the multiple steering conditions collected in the step 1 as a classification sample;
step 2-2: introducing a data segmentation algorithm, performing equidistant segmentation processing on the data set, and expanding the sample volume of the data set;
step 2-3: repeating the step 2-2, merging all the segmented data into a large sample, and naming the large sample as a Classify _ data sample set;
step 2-4: all data sets of the sensor data AVz (yaw rate) acquired in the step 1 are independently stored and named as Detection sample data sets Detection _ data;
and step 3: training was performed by a two-stage LSTM (long short term memory network) as follows:
step 3-1: the two-stage LSTM comprises a CLSTM (classification model) and an RLSTM (regression model), 70% of the data set Classify _ data in the step 2-3 is selected as a training set and is imported into the CLSTM for training, 30% of the data set Classify _ data in the step 2-3 is used as a test set, a softmax function is used as an activation function, the CLSTM comprises 3 neurons in an input layer, 2 neurons in an output layer and 32 neurons in a hidden layer;
step 3-2: the LSTM is different from RNN in that a door mechanism and a cell state update are added in a hidden layer, wherein the door mechanism mainly comprises a forgetting door, a memory door, an output door and a gating function ftA memory gate i for controlling the information to be forgotten at the previous moment according to the state values (0 and 1, wherein 0 represents forget and 1 represents reserve) of the cell unit at the previous momenttAn output gate O for controlling input information, judging whether memory is neededtConfirming the output information based on the cell status (0 and 1, wherein 0 indicates that the information is not allowed to pass and 1 indicates that the operation passes);
step 3-3: classifying through a sigmoid function, wherein an evaluation index of classification precision is represented by Accuracy and Error _ rate:
in the formula, TP represents that the real category is a positive example, and the prediction category is a positive example; FP indicates that the real category is a negative example and the prediction category is a positive example; FN indicates that the real category is a positive example, and the prediction category is a negative example; TN represents that the real category is a negative case, the prediction category is a negative case, P represents the total number of positive cases, and N represents the total number of negative cases;
step 3-4: and (3) selecting 70% of the data set Detection _ data in the step 2-4 as a training set and importing the training set into the RLSTM for training, using 30% of the data set Detection _ data in the step 2-4 as a test set, and using a linear function as an activation function, wherein the RLSTM has a 4-layer network. The input is 10 neurons (sliding window is 10), the output is 1 neuron, 2 hidden layers are arranged, the first layer is 50 neurons, and the second layer is 100 neurons.
Step 3-5: RLSTM adopts a mode of sliding a time window, takes the value of the next time point as a training label of the sample of the previous time point, and gives the previous small-segment sequence in the Detection _ data in the steps 2-4The prediction model can obtain the predicted value of the next moment, namely the t momentThat is, the first t-1 data are sequentially sent to the input layer of the model as input data, and a prediction error for optimizing the model is determined according to the last data of the sequence in the window as an expected label, wherein formally, a prediction model can be expressed as an approximate simulation of a function:
in the formula (I), the compound is shown in the specification,the mapping satisfies a timing constraint and the predicted value at the next time is only related to the observed value at the previous time, i.e.Rely on only
And 4, step 4: the method comprises the following steps that a CLOSTM in a training stage uses CrossEntropyLoss as a loss function, an adam is selected as an optimization algorithm, an mse is selected as a loss function in an RLSTM, and an rmsprop is selected as an optimization algorithm;
and 5: when the loss function meets the optimal condition, respectively saving CLSTM and RLSTM, and respectively naming RLSTM as 0, 1 and 2 … n according to different automobile steering degrees;
step 6: the two-stage LSTM selection algorithm is designed by the following process:
step 6-1: taking the test set of Classify _ data in the step 2-3 as the input of CLSTM;
step 6-2: selecting different RLSTMs according to different model names in the step 5, and predicting the Detection _ data test set data in the step 2-4;
and 7: after model prediction is completed, the observed value is calculatedAnd the actual value of the current momentError e oftJudging whether the data is the data of the automobile sensor after being attacked or not by using a window error accumulation method, wherein the attack type is sound wave attack on the automobile sensor by using a resonance effect generated by high-frequency sound waves and an MEMS gyroscope;
and 8: manually setting a threshold value W0Selecting a time sliding window m, and calculating the error accumulation of the predicted value and the observed value under the current windowW is to be0Andcomparing, if greater than threshold value W0Judging the observed value at the time t as an abnormal value, and if the observed value is judged to be abnormal, replacing the observed value with the predicted value at the current time, entering the predicted value into the next window sequence and inputting the predicted value into the RLSTM to participate in calculation;
and step 9: and at the moment when the numerical value of the automobile sensor is attacked, the predicted value of the RLSTM replaces the observed value and enters an automobile control unit for closed-loop operation, so that the aim of eliminating the attack is fulfilled.
Compared with the traditional machine learning method, the method is more complex, but the attack insisting effect is better, and the method has a certain repairing function and certain practicability.
The above is the preferred embodiment of the present invention, and it should be noted that: it will be apparent to those skilled in the art that various modifications and adaptations can be made without departing from the principles of the invention and these are intended to be within the scope of the invention.
Claims (9)
1. A two-stage LSTM-based automobile sensor attack detection and repair method is characterized by comprising the following steps:
step 1: the method comprises the steps that data are collected through combined simulation of Carsim and Simulink simulation software, data of a plurality of sensors of an automobile under different steering conditions are collected to form a data set, the plurality of sensors are selected to be yaw velocity AVz, lateral acceleration Ay and steering wheel turning angle Steer _ SW, and the data set is preprocessed;
step 2: selecting and dividing a data set;
and step 3: training by two-stage LSTM;
and 4, step 4: the method comprises the following steps that a CLOSTM in a training stage uses CrossEntropyLoss as a loss function, an adam is selected as an optimization algorithm, an mse is selected as a loss function in an RLSTM, and an rmsprop is selected as an optimization algorithm;
and 5: when the loss function meets the optimal condition, respectively saving CLSTM and RLSTM, and respectively naming RLSTM as 0, 1 and 2 … n according to different automobile steering degrees;
step 6: designing a two-stage LSTM selection algorithm;
and 7: after model prediction is completed, the observed value is calculatedAnd the actual value of the current momentError e oftJudging whether the data is the data of the attacked automobile sensor by using a window error accumulation method;
and 8: manually setting a threshold value W0Select oneA time sliding window m is used for calculating the error accumulation of the predicted value and the observed value under the current windowW is to be0Andcomparing, if greater than threshold value W0Judging the observed value at the time t as an abnormal value, and if the observed value is judged to be abnormal, replacing the observed value with the predicted value at the current time, entering the predicted value into the next window sequence and inputting the predicted value into the RLSTM to participate in calculation;
and step 9: and at the moment when the numerical value of the automobile sensor is attacked, the predicted value of the RLSTM replaces the observed value and enters an automobile control unit for closed-loop operation, so that the aim of eliminating the attack is fulfilled.
2. The method for detecting and repairing attack on automobile sensors based on two-stage LSTM as claimed in claim 1, wherein in step 1, the data set is preprocessed as follows:
step 1-1: checking whether a missing value exists in the data set or not, and if so, supplementing the missing value;
step 1-2: the data set relates to complex automobile steering conditions, and the data set is used for three automobile sensor data through different steering wheel turning angles Steer _ SW: marking the snake shape as 0, the lane change as 1 and the right-angle turn as 2 according to different steering conditions of the automobile by using the yaw angular velocity AVz, the lateral acceleration Ay and the steering wheel turn angle Steer _ SW respectively, and storing the labels and other characteristic attributes separately;
step 1-3: normalizing the data, and normalizing the data in the data set according to the following formula:
in the formula, X*Represents the data after normalization, X represents the data before normalization, XminRepresenting the minimum value, X, of a certain sensor of the vehicle in the current data sequencemaxRepresenting the maximum value of a certain sensor of the car in the current data sequence.
3. The two-stage LSTM-based attack detection and remediation method for automotive sensors according to claim 2, wherein the process of step 2 is as follows:
step 2-1: setting sensor data of a very short time at the beginning of automobile running under multiple steering conditions collected in the step 1 as a classification sample;
step 2-2: introducing a data segmentation algorithm, performing equidistant segmentation processing on the data set, and expanding the sample volume of the data set;
step 2-3: repeating the step 2-2, merging all the segmented data into a large sample, and naming the large sample as a Classify _ data sample set;
step 2-4: and (3) independently storing all data sets of the yaw velocity AVz acquired in the step (1), and naming the data sets as Detection sample data sets Detection _ data.
4. The method for detecting and repairing attack on sensor of car based on two-stage LSTM as claimed in claim 3, wherein in said step 3, the training process by two-stage LSTM is as follows:
step 3-1: the two-stage LSTM comprises a CLSTM and an RLSTM, 70% of the data set Classify _ data in the step 2-3 is selected as a training set to be imported into the CLSTM for training, 30% of the data set Classify _ data in the step 2-3 is used as a test set, and a softmax function is used as an activation function;
step 3-2: the LSTM is different from the RNN in that a door mechanism and a cell state update are added in a hidden layer, wherein the door mechanism comprises a forgetting door, a memory door, an output door and a gating function ftControlling the information needing to be forgotten at the last moment according to the state value of the cell unit at the last moment, wherein the state value 0 represents forgetting, and the state value 1 represents reserving; memory gate itUsed for controlling input information, judging whether to need to memorize and outputGo out otConfirming output information based on the cell state, wherein 0 represents that the information is not allowed to pass, and 1 represents that the operation passes;
step 3-3: classifying through a sigmoid function, and expressing evaluation indexes of classification precision by using Accuracy and Error _ rate:
in the formula, TP represents that the real category is a positive example, and the prediction category is a positive example; FP indicates that the real category is a negative example and the prediction category is a positive example; FN indicates that the real category is a positive example, and the prediction category is a negative example; TN represents that the real category is a negative case, the prediction category is a negative case, P represents the total number of positive cases, and N represents the total number of negative cases;
step 3-4: selecting 70% of the data set Detection _ data in the step 2-4 as a training set, importing the training set into the RLSTM for training, using 30% of the data set Detection _ data in the step 2-4 as a test set, and using a linear function as an activation function;
step 3-5: RLSTM adopts a mode of sliding a time window, takes the value of the next time point as a training label of the sample of the previous time point, and gives the previous small-segment sequence in the Detection _ data in the steps 2-4The prediction model can obtain the predicted value of the next moment, namely the t momentThe first t-1 data are sequentially sent to an input layer of the model as input data, and the last data of the sequence in the window is used as an expected label for optimizing the prediction error of the model; formally, a prediction model is represented as an approximate simulation of the function f:
5. The method for detecting and repairing attack on sensor of car based on two-phase LSTM as claimed in claim 3 or 4, wherein in step 6, the process of two-phase LSTM selection algorithm is as follows;
step 6-1: taking the test set of Classify _ data in the step 2-3 as the input of CLSTM;
step 6-2: and (5) selecting different RLSTMs according to different model names in the step 5, and predicting the test set data of Detection _ data in the step 2-4.
6. The method for detecting and repairing attack on automobile sensors based on two-stage LSTM as claimed in claim 4, wherein in step 3-1, the input layer of the Classification model CLSTM is 3 neurons, the output layer is 2 neurons, and the hidden layer is 32 neurons.
7. The two-stage LSTM-based automobile sensor attack detection and repair method as claimed in claim 4, wherein in step 3-4, the regression model RLSTM has 4 layers of networks, the input is 10 neurons, i.e. the sliding window is 10, the output is 1 neuron, 2 hidden layers are set, the first layer is 50 neurons, and the second layer is 100 neurons.
8. The method for detecting and repairing the attack of the two-stage LSTM-based automobile sensor according to any of claims 1-4, wherein the attack type mentioned in the step 7 is high-amplitude sound wave attack, specifically, the resonance effect generated by the high-amplitude sound wave and the MEMS gyroscope causes the MEMS gyroscope to generate abnormal output and the automobile sensor to generate abnormal data.
9. The method for detecting and repairing attack on the vehicle sensor based on the two-stage LSTM according to any of claims 1 to 4, wherein in the step 9, the effect of repairing the predicted value replacing the observed value can be represented by the vehicle sensor value and can also be represented by the vehicle closed-loop control algorithm in the actual steering of the vehicle.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110422459.0A CN113255725B (en) | 2021-04-20 | 2021-04-20 | Automobile sensor attack detection and repair method based on two-stage LSTM |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110422459.0A CN113255725B (en) | 2021-04-20 | 2021-04-20 | Automobile sensor attack detection and repair method based on two-stage LSTM |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113255725A true CN113255725A (en) | 2021-08-13 |
CN113255725B CN113255725B (en) | 2024-03-22 |
Family
ID=77221138
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110422459.0A Active CN113255725B (en) | 2021-04-20 | 2021-04-20 | Automobile sensor attack detection and repair method based on two-stage LSTM |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113255725B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111447212A (en) * | 2020-03-24 | 2020-07-24 | 哈尔滨工程大学 | Method for generating and detecting APT (advanced persistent threat) attack sequence based on GAN (generic antigen network) |
CN112364697A (en) * | 2020-10-14 | 2021-02-12 | 陕西师范大学 | Electroencephalogram emotion recognition method based on R-LSTM model |
US20210064689A1 (en) * | 2019-08-27 | 2021-03-04 | Nec Laboratories America, Inc. | Unsupervised multivariate time series trend detection for group behavior analysis |
-
2021
- 2021-04-20 CN CN202110422459.0A patent/CN113255725B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210064689A1 (en) * | 2019-08-27 | 2021-03-04 | Nec Laboratories America, Inc. | Unsupervised multivariate time series trend detection for group behavior analysis |
CN111447212A (en) * | 2020-03-24 | 2020-07-24 | 哈尔滨工程大学 | Method for generating and detecting APT (advanced persistent threat) attack sequence based on GAN (generic antigen network) |
CN112364697A (en) * | 2020-10-14 | 2021-02-12 | 陕西师范大学 | Electroencephalogram emotion recognition method based on R-LSTM model |
Also Published As
Publication number | Publication date |
---|---|
CN113255725B (en) | 2024-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112242059B (en) | Intelligent decision-making method for unmanned vehicle based on motivation and risk assessment | |
CN111310583A (en) | Vehicle abnormal behavior identification method based on improved long-term and short-term memory network | |
LU102710B1 (en) | Input validation method for neural network model by crossing-layer dissection | |
CN111738337B (en) | Driver distraction state detection and identification method in mixed traffic environment | |
CN111114556A (en) | Lane change intention identification method based on LSTM under multi-source exponential weighting loss | |
CN111783943B (en) | LSTM neural network-based driver braking strength prediction method | |
US11790646B2 (en) | Network for interacted object localization | |
CN111931837B (en) | Driving event recognition and training method, device, equipment and storage medium thereof | |
CN113688851A (en) | Data labeling method and device and fine granularity identification method and device | |
CN115496384A (en) | Monitoring management method and device for industrial equipment and computer equipment | |
Schwalbe et al. | Concept enforcement and modularization as methods for the ISO 26262 safety argumentation of neural networks | |
CN116985793B (en) | Automatic driving safety control system and method based on deep learning algorithm | |
Haque et al. | Driving maneuver classification from time series data: a rule based machine learning approach | |
CN112435466B (en) | Method and system for predicting take-over time of CACC vehicle changing into traditional vehicle under mixed traffic flow environment | |
CN113255725B (en) | Automobile sensor attack detection and repair method based on two-stage LSTM | |
Wang et al. | Lane-Change Intention Prediction of Surrounding Vehicles Using BiLSTM-CRF Models with Rule Embedding | |
CN111160089A (en) | Trajectory prediction system and method based on different vehicle types | |
CN116310542A (en) | Image classification method based on improved cross entropy loss function | |
CN116011503A (en) | Traffic vehicle multi-mode track prediction system and method based on track primitives | |
Lee et al. | Individual stable driving pattern analysis for evaluating driver readiness at autonomous driving levels 2 and 3 | |
CN114248780A (en) | IDM-LSTM combined following model establishing method considering driver style | |
CN113722982A (en) | Automobile sensor attack detection and defense method based on multi-model fusion | |
Anil et al. | Driver behavior analysis using K-means algorithm | |
CN111930117B (en) | Steering-based lateral control method, device, equipment and storage medium | |
CN112180913A (en) | Special vehicle identification method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |