Internet of vehicles unsupervised intrusion detection method and system based on GAN and LSTM-Autoencoder

Through the unsupervised intrusion detection method of the Internet of Vehicles based on GAN and LSTM-Autoencoder, data similar to abnormal data is generated and thresholds are set using reconstruction errors, which solves the problem that intrusion detection methods in the prior art are vulnerable to adversarial attacks and data deviations. Achieve higher detection accuracy and feature selectivity.

CN118890165APending Publication Date: 2024-11-01SUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410777024.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

The existing Internet of Vehicle Intrusion Detection Methods are vulnerable to adversarial attacks, and abnormal data often deviates significantly from normal characteristics during data preprocessing, resulting in loose boundaries during model training and making it difficult to detect abnormal data.

Method used

Unsupervised intrusion detection method based on GAN and LSTM-Autoencoder is adopted to generate data similar to abnormal data by generating adversarial networks, train the LSTM-Autoencoder model, and use reconstruction errors to set thresholds for abnormal data detection, combining LSTM's sequence modeling Ability and autoencoder feature learning ability to improve detection accuracy.

Benefits of technology

A tightly bounded normal feature space is designed, which reduces the problem of difficult detection of boundary anomalies, improves the accuracy of detection and the selectivity of the model, and enhances the ability to identify abnormal data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890165A_ABST
    Figure CN118890165A_ABST
Patent Text Reader

Abstract

The invention discloses an Internet of Vehicles unsupervised intrusion detection method and system based on a GAN and an LSTM-Autoencoder, and belongs to the field of Internet of Vehicles security. The Internet of Vehicles unsupervised intrusion detection method based on the GAN and the LSTM-Autoencoder comprises the following steps: acquiring data from a CICIDS2017 data set and an IoT-23 data set, and respectively preprocessing the data; generating data similar to the abnormal data through a generative adversarial network to train an LSTM-Autoencoder model; an LSTM-Autoencoder model is used for reconstructing input data, and a threshold value is set through reconstruction errors and used for abnormal data detection; through the confrontation of the generator and the discriminator, a closely bounded normal feature space can be obtained, so that the problem that boundary abnormal data is difficult to detect is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of vehicle networking security, and specifically relates to a vehicle networking unsupervised intrusion detection method and system based on GAN and LSTM-Autoencoder. Background Art

[0002] With the continuous advancement of science and technology and the rapid development of Internet of Vehicles technology, cars are no longer just traditional means of transportation, but have become an intelligent platform that integrates advanced electronic technology and Internet functions. However, at the same time, the rapid development of Internet of Vehicles has also caused a series of security risks, among which the continuous evolution of attack methods makes today's threats more complex, more deceptive, and difficult to easily identify.

[0003] At present, the research on IoV intrusion detection methods is mainly divided into two categories: feature-based intrusion detection methods and reconstruction-based unsupervised intrusion detection methods. Feature-based intrusion detection algorithms extract relevant features from network traffic. By analyzing and modeling these features, the algorithms can identify abnormal patterns and behaviors. However, feature-based methods are vulnerable to adversarial attacks. Attackers can deceive intrusion detection systems through minor changes, making it unable to accurately identify malicious behavior.

[0004] In network traffic analysis, abnormal data is not representative, that is, it is highly unbalanced with normal samples. To solve this problem, many scholars use oversampling (SMOTE), undersampling (ENN) and integration methods (e.g., Bagging, Boosting). However, these existing methods often produce synthetic abnormal data that deviates significantly from normal features during data preprocessing, resulting in loose boundaries in the normal feature space during model training, making it difficult to detect abnormal data at the boundaries. Summary of the invention

[0005] In view of the deficiencies in the prior art, the purpose of the present invention is to provide an unsupervised intrusion detection method and system for Internet of Vehicles based on GAN and LSTM-Autoencoder, which solves the problems in the prior art.

[0006] The purpose of the present invention can be achieved through the following technical solutions:

[0007] The unsupervised intrusion detection method of Internet of Vehicles based on GAN and LSTM-Autoencoder includes the following steps:

[0008] Obtain data from the CICIDS2017 dataset and IoT-23 dataset and preprocess them respectively;

[0009] Generate data similar to abnormal data through generative adversarial networks to train the LSTM-Autoencoder model;

[0010] The LSTM-Autoencoder model is used to reconstruct the input data, and the threshold is set by the reconstruction error for abnormal data detection.

[0011] Furthermore, ADASYN-ENN is used to preprocess the data obtained from the CICIDS2017 dataset;

[0012] The steps for preprocessing the data obtained from the IoT-23 dataset include: using a deletion or interpolation strategy for missing values; using statistical methods and visualization tools to detect and handle outliers; and then handling duplicate values.

[0013] Furthermore, the generative adversarial network includes a generator and a discriminator, and the discriminator is an LSTM-Autoencoder model; the data samples generated by the generator and the samples of real data are input into the discriminator together for anomaly detection to distinguish the data samples generated by the generator from the samples of real data, and finally a probability value is output through the Sigmoid function, indicating the probability that the input data is real data, and is fed back to the generator.

[0014] Furthermore, the optimization objective function of the generator is:

[0015] LG=-log(sigmoid(D(G(z))))

[0016] Among them, G and D are the generator output and discriminator output respectively;

[0017] The optimization objective function of the discriminator is:

[0018] LD=-log(sigmoid(D(x)))-log(sigmoid(D(G(z))))

[0019] The objective function of the generative adversarial network is:

[0020] m G inm D axV(D,G)=E x~pdata(x) [logD(x)]+E z~pz(z) [log(1-D(G(z)))]

[0021] Among them, p data and p z is the probability distribution of real data and fake data, x and z are the inputs of the generator and output respectively.

[0022] Furthermore, the LSTM-Autoencoder model combines the sequence modeling capability of LSTM and the feature learning capability of autoencoder, including LSTM encoder and LSTM decoder; the LSTM encoder maps the input sequence to the latent representation space to capture the key information in the input sequence, and the LSTM decoder maps the latent representation back to the original sequence, reconstructs the input sequence, and sets the threshold through the reconstruction error for anomaly detection.

[0023] Furthermore, the workflow of the LSTM encoder includes:

[0024] Processing input sequence: The input sequence is fed into the LSTM encoder one element at a time in a step-by-step manner, with each element corresponding to one time step in the sequence;

[0025] Capturing relevant information: At each time step, the LSTM unit processes the input and updates its hidden state and memory cells;

[0026] Generate a fixed-size context vector: After processing the entire input sequence, the final hidden state of the LSTM layer contains a condensed representation of the entire sequence. This final hidden state serves as the context vector for the input.

[0027] Copy Vector: Replicate the context vector across multiple time steps, which prepares the context vector for input to the LSTM decoder, ensuring that the LSTM decoder receives the same information at each time step.

[0028] Furthermore, the workflow of the LSTM decoder includes:

[0029] Input latent representation: The input of the LSTM decoder is the context vector obtained from the LSTM encoder;

[0030] Initialize hidden state and cell state: For each time step, the LSTM cell of the LSTM decoder has a hidden state and a cell state. At the beginning of the LSTM decoding sequence, these states are initialized to all zeros.

[0031] Time-step recurrence: The LSTM decoder processes the input at each time step by recurring to gradually reconstruct the original input sequence;

[0032] Calculate output: The LSTM decoder uses the updated LSTM cell state to calculate the output of the current time step;

[0033] Repeat the above steps until the sequence ends: The above steps are repeated at each time step until the LSTM decoder generates the entire sequence;

[0034] Output reconstructed sequence: The final output of the LSTM decoder is the entire reconstructed sequence.

[0035] Furthermore, the reconstruction loss function of the LSTM-Autoencoder model is:

[0036]

[0037] Where n is the number of samples, y i is the actual observed value, is the model prediction value.

[0038] The unsupervised intrusion detection system for Internet of Vehicles based on GAN and LSTM-Autoencoder includes:

[0039] Data preprocessing module: obtains data from the CICIDS2017 dataset and IoT-23 dataset, and preprocesses them respectively;

[0040] Model training module: Generate data similar to abnormal data through generative adversarial network to train LSTM-Autoencoder model;

[0041] And, the detection module: uses the LSTM-Autoencoder model to reconstruct the input data and sets the threshold through the reconstruction error for abnormal data detection.

[0042] A computer storage medium stores a readable program, which can execute the above-mentioned GAN and LSTM-Autoencoder-based vehicle network unsupervised intrusion detection method when the program is run.

[0043] Beneficial effects of the present invention:

[0044] 1. The present invention designs a data enhancement algorithm based on GAN, which can generate new data similar to normal data. Through similar abnormal data, a tightly bounded normal feature space can be obtained, thereby solving the problem that boundary abnormal data is difficult to detect.

[0045] 2. The present invention proposes an intrusion detection method based on LSTM and autoencoder, which combines the sequence modeling ability of LSTM and the feature learning ability of autoencoder, helps to learn the pattern of normal data and improves the accuracy of detection.

[0046] 3. The present invention designs a feature engineering module, which reduces the impact of redundant features captured by the autoencoder by constraining weights, and helps the model select more important features. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0048] Figure 1 It is a schematic diagram of the unsupervised intrusion detection structure of the present invention;

[0049] Figure 2 It is a schematic diagram of the LSTM model structure of the present invention;

[0050] Figure 3 It is the LSTM encoder workflow diagram of the present invention;

[0051] Figure 4 It is the LSTM decoder workflow diagram of the present invention;

[0052] Figure 5 It is the average time series graph of various labels of the CICIDS2017 data set of the present invention;

[0053] Figure 6 It is the average time series graph of various labels of the Iot-23 data set of the present invention;

[0054] Figure 7 It is the loss statistics smoothing graph of CICIDS2017 and Iot-23 training sets of the present invention;

[0055] Figure 8 This is a comparison chart of the reconstruction loss of the CICIDS2017 dataset of the present invention;

[0056] Fig. 9 This is a comparison chart of the reconstruction loss of the Iot-23 dataset of the present invention;

[0057] Fig.10 It is the confusion matrix of the CICIDS2017 dataset experimental results of the present invention;

[0058] Fig.11 It is the confusion matrix of the experimental results of the Iot-23 data set of the present invention. DETAILED DESCRIPTION

[0059] 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.

[0060] Example 1

[0061] like Figure 1 As shown in the figure, the unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder includes the following steps:

[0062] S1, obtain data from the dataset and perform preprocessing;

[0063] The data sets in this embodiment include the CICIDS2017 data set and the IoT-23 data set;

[0064] The CICIDS2017 dataset (https: / / www.unb.ca / cic / datasets / ids-2017.html) contains benign and common attacks, including source data (PCAP) and network traffic analysis results based on timestamps, source and destination IPs, source and destination ports, protocols, and attack token flows. The dataset includes abstract behaviors of 25 users based on HTTP, HTTPS, FTP, SSH, and email protocols. Brute force attacks include FTP, SSH, DoS, Heartbleed, Web attacks, penetration, botnets, and DDoS.

[0065] Table 1 Class labels and sample numbers of CICIDS-2017 dataset

[0066]

[0067]

[0068] As can be seen from Table 1, there is a problem of data imbalance. In order to solve the problem of data imbalance, ADASYN-ENN is used to preprocess the dataset. First, ENN (Edited Nearest Neighbors) classifies the samples to check whether they should be retained. If a sample does not belong to the same category as most of the samples in its nearest k neighbors, the sample will be deleted. Then ADASYN will generate new minority class samples.

[0069] The IoT-23 dataset (https: / / mcfp.felk.cvut.cz / publicDatasets / IoT-23-Dataset / iot_23_datasets_small.tar.gz) consists of 23 network captures of IoT traffic, including 20 from infected IoT devices (PCAP files) and three real IoT network traffic, as detailed in Table 2. The network traffic captures of the benign scenarios are from three real IoT devices: Philips HUE smart LED lights, Amazon Echo home smart personal assistant, and Somfy smart door locks. Both malicious and benign scenarios are run in a controlled network environment with unrestricted Internet connectivity, just like any real IoT device.

[0070] Table 2 Class labels and sample numbers of IoT-23 dataset

[0071]

[0072]

[0073] The Iot-23 dataset contains a large number of duplicate values, so data cleaning is required first. First, check whether the data contains missing values ​​or outliers. For missing values, a deletion or interpolation strategy is used. For outliers, statistical methods and visualization tools are used to detect and process them. Then, duplicate values ​​are processed. When processing duplicate values, data balance needs to be considered. This dataset has more abnormal data than normal data, so it is necessary to retain the duplicate values ​​of the minority class abnormal data and normal data, and delete the duplicate values ​​of the majority class abnormal data.

[0074] like Figure 5 and Figure 6 As shown in the figure, the average time series of various labels of the two data sets are displayed (the horizontal axis is the feature and the vertical axis is the feature value). Figure 5 and Figure 6 The average time series of each type of label for the two datasets shows that the patterns of normal data and abnormal data are different. This helps detect anomalies during reconstruction.

[0075] S2, generate data similar to abnormal data through the generative adversarial network GAN to train the discriminator (LSTM-Autoencoder model);

[0076] Generative Adversarial Network (GAN) is a game process. It consists of two parts, a generator and a discriminator. These two parts are trained to be in a confrontational relationship, and the performance of the generator and the discriminator is improved through this confrontation.

[0077] The task of the generator is to generate data that looks similar to real data. It receives a random noise vector as input and then maps it into the data space to generate samples similar to real data. The optimization objective function for the generator is as follows:

[0078] LG=-log(sigmoid(D(G(z))))(1)

[0079] Among them, G and D are the generator output and discriminator output respectively.

[0080] The task of the discriminator is to distinguish the data generated by the generator from the real data. In this embodiment, the LSTM-Autoencoder model is used as the discriminator of GAN. The data samples generated by the generator and the samples of the real data are input into the LSTM-Autoencoder model together. The LSTM-Autoencoder model is used to perform anomaly detection to distinguish the data samples generated by the generator from the samples of the real data. Finally, a probability value is output through the Sigmoid function, indicating the probability that the input data is the real data, and fed back to the generator. The optimization objective function for the discriminator is:

[0081] LD=-log(sigmoid(D(x)))-log(sigmoid(D(G(z)))))(2)

[0082] The generator G aims to generate synthetic data close to real data, while the discriminator D aims to distinguish between real data and fake data. These two components have opposite goals during training. The objective function V(D, G) of the GAN composed of the generator G and the discriminator D is a minimax game, as follows:

[0083]

[0084] Among them, p data and p z is the probability distribution of real data and fake data, x and z are the inputs of the generator and output respectively.

[0085] S3, using LSTM-Autoencoder model to reconstruct input data for abnormal data identification;

[0086] The LSTM-Autoencoder model combines the sequence modeling capability of LSTM and the feature learning capability of autoencoders. The model uses LSTM networks for the encoder and decoder parts of the autoencoder, including LSTM encoders and LSTM decoders; the LSTM encoder maps the input sequence to the latent representation space to capture the key information in the input sequence, and the LSTM decoder maps the latent representation back to the original sequence to reconstruct the input sequence. The threshold is set by the reconstruction error for anomaly detection.

[0087] like Figure 3 As shown in Figure 1, the workflow of the LSTM encoder includes processing the input sequence, capturing relevant information, generating a fixed-size context vector, and copying the vector;

[0088] 1) Processing input sequence: The LSTM encoder takes an input sequence of data. The input sequence is fed into the LSTM encoder one element at a time in a step-by-step manner. Each element corresponds to one time step in the sequence.

[0089] 2) Capture relevant information: At each time step, the LSTM unit processes the input and updates its hidden state and memory cells; the hidden state and memory cells capture information from previous time steps, allowing the LSTM to retain context vectors over longer sequences; one of the key features of the LSTM is its ability to capture long-term dependencies in sequence data; the hidden state and memory cells allow the LSTM to learn and remember patterns that occur at different positions in the sequence.

[0090] 3) Generate a fixed-size context vector: After processing the entire input sequence, the final hidden state of the LSTM layer contains a condensed representation of the entire sequence. This final hidden state acts as the context vector for the input. The context vector represents the essential information extracted from the input sequence. It is a fixed-size vector.

[0091] 4) Repeat Vector: This layer is used to replicate the context vector across multiple time steps. It prepares the context vector for input to the decoder, ensuring that the decoder receives the same information at each time step.

[0092] It is worth mentioning that during the training process, the weights and biases of the LSTM encoder are updated using Back Propagation Through Time (BPTT). The goal is to minimize the difference between the predicted context vector and the true context vector.

[0093] like Figure 4 As shown, the workflow of the LSTM decoder includes:

[0094] 1) Input latent representation: The input of the LSTM decoder is the context vector obtained from the LSTM encoder. This context vector is a compact, low-dimensional representation learned by the encoder on the input sequence, which captures the key features of the input data.

[0095] 2) Initialize hidden state and cell state: For each time step, the LSTM cell of the LSTM decoder has a hidden state and a cell state. At the beginning of the LSTM decoding sequence, these states are initialized to all zeros.

[0096] 3) Time-step recurrence: The LSTM decoder processes the input at each time step by recurring to gradually reconstruct the original input sequence.

[0097] 4) Calculate output: The LSTM decoder uses the updated LSTM cell state to calculate the output of the current time step. This output is a vector representing the reconstruction of the current time step.

[0098] 5) Repeat the above steps until the end of the sequence: The above steps are repeated at each time step until the LSTM decoder generates the entire sequence.

[0099] 6) Output the reconstructed sequence: The final output of the LSTM decoder is the entire reconstructed sequence

[0100] In this embodiment, the mean absolute error loss function is used as the reconstruction loss of the LSTM-Autoencoder model, which measures the average square difference between the model's predicted value and the actual observed value. The calculation formula of MAE is as follows:

[0101]

[0102] Where n is the number of samples, y i is the actual observed value, is the model prediction value. The smaller the MAE, the better, indicating that the model's prediction value is closer to the actual observed value. Experiments have shown that the detection accuracy of this method using the mean absolute error is between 1% and 2% higher than the mean square error.

[0103] Use normal samples for model training. Input normal samples, generate reconstructions through the model, calculate the reconstruction error, and then optimize the model parameters through gradient descent. Repeat this process until the model converges, that is, the model can generate a lower reconstruction error on the training data.

[0104] Use the trained LSTM-Autoencoder to reconstruct the normal samples in the training set and calculate the reconstruction error. According to the distribution of the reconstruction error of the training set, a threshold is determined at a certain confidence level. In order to ensure that the selected threshold is sensitive to abnormal samples, some known abnormal samples are introduced into the training set and then their reconstruction errors are observed to determine the threshold.

[0105] For new time series data, the trained LSTM-Autoencoder is used to reconstruct the new sample and obtain the reconstruction error of the new sample. The reconstruction error of the new sample is compared with a predetermined threshold. If the reconstruction error exceeds the threshold, the sample is marked as abnormal.

[0106] The pseudo code of the LSTM-Autoencoder model program is as follows:

[0107]

[0108] In addition, this embodiment also designs steps for evaluating model performance and accuracy:

[0109] Step 1, data set segmentation: Split the original data set into a training set and a test set. 80% of the normal data is used as the training set, and the abnormal data and 20% of the normal data are used as the test set.

[0110] Step 2, model training: Train the model using the training set and adjust the model hyperparameters until the best performance is achieved.

[0111] Step 3, model evaluation: Use the test set to evaluate the model. Common evaluation indicators include accuracy, recall, F1 value, etc.

[0112] Step 4, result analysis: Based on the model evaluation results, analyze the performance and accuracy of the model to see if it meets the requirements. If not, retrain the model or adjust the model parameters.

[0113] The calculation formulas for evaluating performance indicators including precision (Pre), recall (Rec), false positive rate (FPR) and F1 value are as follows:

[0114]

[0115] Among them, TP is the number of positive samples correctly identified, TN is the number of negative samples correctly identified, FP is the number of false positive negative samples, and FN is the number of false positive positive samples.

[0116] In an intrusion detection system, the false alarm rate and the false negative rate need to be focused on. The false alarm rate refers to the probability that the model incorrectly classifies normal traffic as attack traffic. The false negative rate refers to the probability that the model incorrectly classifies attack traffic as normal traffic. Therefore, precision and recall are important indicators for evaluating the performance of an intrusion detection system, and a balance between the two needs to be considered comprehensively. In addition, since the intrusion detection system needs to detect and identify in real-time traffic, the response time of the system needs to be considered, and the shorter the response time, the better.

[0117] By comprehensively considering the above evaluation indicators, the performance and reliability of the intrusion detection system can be evaluated, and then the design and implementation of the system can be optimized and improved.

[0118] Example 2

[0119] In this embodiment, experiments are performed to verify the effect and superiority of the above unsupervised intrusion detection method.

[0120] 1. Obtain data from the CICIDS2017 dataset and IoT-23 data and preprocess them according to the corresponding data features;

[0121] 2. Comparative analysis of model performance;

[0122] First, you need to train the LSTM-Autoencoder model. The trained model traverses each example in the training set and records the loss. Then you can get the reconstruction loss on the training set and select the threshold based on the reconstruction loss.

[0123] Figure 7 (a) and (b) are the loss statistics smoothing graphs of CICIDS2017 and Iot-23 training sets, respectively. Figure 7 The analysis finally shows that the threshold of the CICIDS2017 dataset is 22, and the threshold of the Iot-23 dataset is 18.

[0124] Then, the test set is used to conduct experiments on the model. The reconstruction losses of the test set in the CICIDS2017 dataset are as follows: Figure 8 As shown in (a)-(f) in the figure, the reconstruction loss of the test set in the Iot-23 dataset is as follows: Fig. 9 As shown in (a)-(f) in Figure 8 and Fig. 9 It can be seen that the model training results are obvious. The reconstruction loss of abnormal data is significantly higher than that of normal data.

[0125] 3. Comparative analysis of experimental results

[0126] By using a threshold, the problem can be transformed into a simple binary classification task. If the reconstruction loss of an example is lower than the threshold, it is classified as normal data. Alternatively, if the loss is higher than the threshold, it is classified as abnormal data. The experimental results are then statistically obtained and presented as a normalized confusion matrix. Fig.10 (a) and (b) in the figure represent the confusion matrix of the experimental results of the CICIDS2017 dataset. Fig.11 (a) and (b) represent the confusion matrix of the experimental results of the Iot-23 dataset. The rows of the confusion matrix represent the true labels, and the columns represent the predicted labels. The above results show that the intrusion detection method proposed in this invention has a high detection accuracy for abnormal data.

[0127] The performance of the proposed method is compared with other SOTA algorithms, and the results are shown in Table 3.

[0128] Table 3 Comparison of classifier performance of different methods

[0129]

[0130] As shown in Table 3, the proposed GAN-LSTMAutoencoder-IDS model achieves high F1 values ​​of 99.16 and 98.06 on the CICIDS-2017 dataset and Iot-23 dataset, respectively. Compared with the performance of other SOTA algorithms, the detection accuracy and F1 value of the method proposed in this paper are significantly improved.

[0131] 4. Ablation experiment and real vehicle test

[0132] In order to gain a deeper understanding of the impact of each component of the model on the overall performance, a series of ablation experiments were conducted. The composition of models A to F is shown in Table 4, and the experimental results are shown in Table 5.

[0133] Table 4 Composition of the comparison model in the ablation experiment

[0134] composition A B C D E F IG √ √ √ √ √ GAN √ √ √ √ √ LSTM √ √ √ √ √ Autoencoder √ √ √ √ √ √ Mean square error √ Mean absolute error √ √ √ √ v MBD √ √ √ √ √ BGD √

[0135] Table 5. Comparison of ablation experiment results

[0136]

[0137] From the comparison of the ablation experiment results in Table 5, it can be seen that the performance of the algorithm proposed in this paper has been significantly improved. The details are as follows.

[0138] Model A: It is composed of the algorithm model proposed in this paper and is used to compare the experimental results.

[0139] Model B: Experimental results show that the use of IG feature selection algorithm significantly improves model performance.

[0140] Model C: Considering the effect of GAN on the model, the experimental results verify that the adversarial method of the GAN generator and discriminator has a positive impact on the detection accuracy and F1 value of the model.

[0141] Model D: This group compared the experimental results of LSTM-Autoencoder and autoencoder, and verified that LSTM significantly improved the model performance.

[0142] Model E: This group compared the impact of mean absolute error and mean square error on model performance. Experimental results show that the detection accuracy and F1 value of the model using mean absolute error are 1% to 2% higher than that of the mean square error.

[0143] Model F: Comparing the experimental results of using Mini-batch Gradient Descent (MBGD) and Batch Gradient Descent (BGD), it is verified that MBGD has a small improvement on the performance of the model.

[0144] In this embodiment, a field test was conducted at the test site of the Automobile Research Institute, and the trained model was tested in the field. The test accuracy reached 99.45%, and the F1 value reached 98.03%.

[0145] The method of the present invention may be implemented in hardware, firmware, or as software or computer code that may be stored in a recording medium (such as a CDROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code that is originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded over a network and will be stored in a local recording medium, so that the method described herein may be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It is understood that a computer, processor, microprocessor controller, or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, processor, or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown herein.

[0146] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements all fall within the scope of the present invention to be protected.

Claims

1. An unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder, characterized in that: The following steps are involved: Obtain data from the CICIDS2017 dataset and IoT-23 dataset and preprocess them respectively; Generate data similar to abnormal data through generative adversarial networks to train the LSTM-Autoencoder model; The LSTM-Autoencoder model is used to reconstruct the input data, and the threshold is set by the reconstruction error for abnormal data detection.

2. The unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder according to claim 1 is characterized in that: ADASYN-ENN is used to preprocess the data obtained from the CICIDS2017 dataset; The steps for preprocessing the data obtained from the IoT-23 dataset include: using a deletion or interpolation strategy for missing values; using statistical methods and visualization tools to detect and process outliers; and then processing duplicate values.

3. The unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder according to claim 1 is characterized in that: The generative adversarial network includes a generator and a discriminator, and the discriminator is an LSTM-Autoencoder model; the data samples generated by the generator and the samples of real data are input into the discriminator together for anomaly detection, and the data samples generated by the generator and the samples of real data are distinguished. Finally, a probability value is output through the Sigmoid function, indicating the probability that the input data is real data, and is fed back to the generator.

4. The unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder according to claim 3 is characterized in that: The optimization objective function of the generator is: LG=-log(sigmoid(D(G(z)))) Among them, G and D are the generator output and discriminator output respectively; The optimization objective function of the discriminator is: LD=-log(sigmoid(D(x)))-log(sigmoid(D(G(z)))) The objective function of the generative adversarial network is: m G inm D axV(D,G)=E x~pdata(x) [logD(x)]+E z~pz(z) [log(1-D(G(z)))] Among them, p data and p z is the probability distribution of real data and fake data, x and z are the inputs of the generator and output respectively.

5. The unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder according to claim 3 is characterized in that: The LSTM-Autoencoder model combines the sequence modeling capability of LSTM and the feature learning capability of autoencoders, including LSTM encoder and LSTM decoder; the LSTM encoder maps the input sequence to the latent representation space to capture the key information in the input sequence, and the LSTM decoder maps the latent representation back to the original sequence, reconstructs the input sequence, and sets the threshold through the reconstruction error for anomaly detection.

6. The unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder according to claim 5 is characterized in that: The workflow of the LSTM encoder includes: Processing input sequence: The input sequence is fed into the LSTM encoder one element at a time in a step-by-step manner, with each element corresponding to one time step in the sequence; Capturing relevant information: At each time step, the LSTM unit processes the input and updates its hidden state and memory cells; Generate a fixed-size context vector: After processing the entire input sequence, the final hidden state of the LSTM layer contains a condensed representation of the entire sequence. This final hidden state serves as the context vector for the input. Copy Vector: Replicate the context vector across multiple time steps, which prepares the context vector for input to the LSTM decoder, ensuring that the LSTM decoder receives the same information at each time step.

7. The unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder according to claim 6 is characterized in that: The workflow of the LSTM decoder includes: Input latent representation: The input of the LSTM decoder is the context vector obtained from the LSTM encoder; Initialize hidden state and cell state: For each time step, the LSTM cell of the LSTM decoder has a hidden state and a cell state. At the beginning of the LSTM decoding sequence, these states are initialized to all zeros. Time-step recurrence: The LSTM decoder processes the input at each time step by recurring to gradually reconstruct the original input sequence; Calculate output: The LSTM decoder uses the updated LSTM cell state to calculate the output of the current time step; Repeat the above steps until the sequence ends: The above steps are repeated at each time step until the LSTM decoder generates the entire sequence; Output reconstructed sequence: The final output of the LSTM decoder is the entire reconstructed sequence.

8. The unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder according to claim 5 is characterized in that: The reconstruction loss function of the LSTM-Autoencoder model is: Where n is the number of samples, y i is the actual observed value, is the model prediction value.

9. Unsupervised intrusion detection system for Internet of Vehicles based on GAN and LSTM-Autoencoder, characterized by: include: Data preprocessing module: obtains data from the CICIDS2017 dataset and IoT-23 dataset, and preprocesses them respectively; Model training module: Generate data similar to abnormal data through generative adversarial network to train LSTM-Autoencoder model; And, the detection module: uses the LSTM-Autoencoder model to reconstruct the input data and sets the threshold through the reconstruction error for abnormal data detection.

10. A computer storage medium storing a readable program, characterized in that: When the program is running, the unsupervised intrusion detection method for Internet of Vehicles based on GAN and LSTM-Autoencoder described in any one of claims 1 to 8 can be executed.