Edge computing intrusion detection method and system based on combination of Transform and automatic encoder
By combining the edge computing intrusion detection methods of Transformer and automatic encoder, the high-dimensional data features are extracted and fused, and the problem of low detection accuracy in the existing technology is solved, and effective processing of high-dimensional data and detection of new attacks is realized, improving the The security of the Internet of Vehicles System.
Patent Information
- Application Number
- CN202410777027.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-11-05
AI Technical Summary
When faced with complex and diverse high-dimensional data distribution, the existing unsupervised intrusion detection methods cannot accurately capture all the features of high-dimensional data, resulting in low detection accuracy, especially lacking effective detection methods for new unknown attacks.
Adopting an edge computing intrusion detection method based on the combination of Transformer and automatic encoder, spatial features are extracted by stacking autoencoders, variational modal decomposition and multi-head attention mechanism to extract time domain features, and perform spatiotemporal and spatial feature fusion to fusion high-dimensional features To form low-dimensional data, enter the Transformer model and the autoencoder to obtain the detection results.
Effectively process high-dimensional data features, improve detection accuracy, reduce delay, and design a collaboration mode for vehicle intrusion detection, which enhances the system's ability to respond to intrusions.
Smart Images

Figure CN118900189A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of Internet of Vehicles security, and specifically relates to an edge computing intrusion detection method and system based on the combination of Transformer and autoencoder. Background Art
[0002] With the popularity of smart cars, the Internet of Vehicles system has become an important platform connecting vehicles, transportation infrastructure and the Internet, providing drivers with rich information and services. However, the security issues of the Internet of Vehicles system are becoming increasingly prominent, facing threats from cyber attacks and malicious behaviors. According to statistics, the number of intrusion incidents suffered by the Internet of Vehicles system has been on the rise in recent years, posing serious hidden dangers to the safe driving of vehicles.
[0003] At present, many works use machine learning methods to achieve the accuracy of intrusion detection in the Internet of Vehicles, such as random forests, decision trees, and support vector machines. Experimental results show that machine learning methods are effective in intrusion detection. However, this method can often only detect known attack patterns and lacks effective detection methods for new unknown attacks. In order to detect unknown attacks, many workers use reconstruction-based unsupervised intrusion detection methods, such as Boppana et al. proposed an unsupervised GAN and autoencoder-based model, called GAN-AE, for detecting unknown attacks. Their experimental results show that unsupervised methods are superior to other models in detecting unknown attacks. However, when the existing unsupervised intrusion detection methods face high-dimensional data with complex and diverse distributions, the reconstruction model cannot accurately capture all the features of the high-dimensional data, and thus cannot accurately reconstruct the high-dimensional data, resulting in low detection accuracy. Summary of the invention
[0004] In view of the deficiencies in the prior art, the purpose of the present invention is to provide an edge computing intrusion detection method and system based on the combination of Transformer and autoencoder, which solves the problems in the prior art.
[0005] The purpose of the present invention can be achieved through the following technical solutions:
[0006] The edge computing intrusion detection method based on the combination of Transformer and autoencoder includes the following steps:
[0007] Get data from the dataset and perform data preprocessing;
[0008] Use stacked autoencoders to extract spatial features from preprocessed data;
[0009] The variational mode decomposition method is combined with the multi-head attention mechanism to extract temporal features from the preprocessed data, and the spatiotemporal features are fused to fuse high-dimensional features into low-dimensional data.
[0010] The low-dimensional data is input into the Transformer model and the autoencoder to obtain the detection result.
[0011] Furthermore, the data preprocessing includes GMM clustering undersampling and SMOTE oversampling.
[0012] Furthermore, the stacked autoencoder is composed of multiple autoencoders to form a deep network structure, and the output of each autoencoder is used as the input of the next autoencoder, thereby learning the feature representation of the data layer by layer.
[0013] Furthermore, the variational modal decomposition decomposes the input data into a set of modal functions, and applies a multi-head attention mechanism to each modal function; wherein the modal function is estimated by solving an optimization problem, and the optimization problem is expressed as:
[0014]
[0015] Among them, μ k ={μ 1 ,μ 2 ,...,μ k} are the modal functions, ω k ={ω 1 ,ω 2 ,...,ω k} is the center frequency of each mode, and f is the signal.
[0016] Furthermore, the multi-head attention mechanism includes the following steps:
[0017] 1) Linearly map each head and map the modal function to different subspaces;
[0018] 2) For each attention head, the inner product of the query, key, and value is calculated and scaled, and then the attention weight is calculated using the Softmax function, as follows:
[0019]
[0020] Among them, d k is the dimension of the key vector, Q = W q X, K = W k X, V = W v X, W represent weight matrices;
[0021] 3) The outputs of each attention head are concatenated together and linearly transformed to obtain the final attention representation.
[0022] Furthermore, the encoder of the Transformer model includes several identical layers, each of which includes:
[0023] Multi-head self-attention mechanism sublayer: each data in the input sequence is mapped to three different vectors, and then the relevance score of each data with other data is obtained by calculating the dot product between the query vector and the key vector; these relevance scores are normalized by the softmax function to obtain the weight of each data with respect to other data; finally, the weight is multiplied by the corresponding value vector to obtain the weighted vector representation of each data;
[0024] Fully connected feedforward neural network sublayer: It contains two fully connected layers and a ReLU activation function to perform nonlinear transformation on the weighted vector.
[0025] Furthermore, the autoencoder encodes the input data into a low-dimensional representation through training, and then decodes it back to the original data space; after the training is completed, anomalies are detected by calculating the reconstruction error.
[0026] Furthermore, the Transformer model adopts KL divergence D KL As a classification loss function:
[0027]
[0028] Among them, P is the true distribution and W is the predicted distribution;
[0029] The autoencoder uses mean square error MSE as the reconstruction loss, and the calculation formula is:
[0030]
[0031] Where n is the number of samples, y i is the actual observed value, is the predicted value.
[0032] The edge computing intrusion detection system based on the combination of Transformer and autoencoder includes:
[0033] Data preprocessing module: obtain data from the data set and perform data preprocessing;
[0034] Spatial feature extraction module: uses stacked autoencoders to extract spatial features from preprocessed data;
[0035] Temporal feature extraction module: extracts temporal features from preprocessed data through variational mode decomposition combined with multi-head attention mechanism, and performs spatiotemporal feature fusion to fuse high-dimensional features into low-dimensional data;
[0036] And, a detection module: inputting the low-dimensional data into a Transformer model and an automatic encoder to obtain a detection result.
[0037] A computer storage medium stores a calibration program, which can execute the above-mentioned edge computing intrusion detection method based on the combination of Transformer and autoencoder when the program is running.
[0038] Beneficial effects of the present invention:
[0039] 1. The present invention proposes an edge computing intrusion detection method based on the combination of Transformer and autoencoder, which combines the global learning ability of Transformer with the feature learning ability of autoencoder, so that while retaining global information, the relationship between local features can be better understood, thereby effectively processing high-dimensional data features.
[0040] 2. The method of the present invention extracts spatial features through a stacked autoencoder, and extracts time domain features through variational mode decomposition combined with a multi-head attention mechanism, thereby realizing spatiotemporal feature fusion, fusing high-dimensional features into low-dimensional data, and solving the problem of low detection accuracy of high-dimensional data.
[0041] 3. The present invention designs a collaborative mode of intrusion detection in the Internet of Vehicles under an edge computing environment. By performing data processing and analysis locally, the data transmission time is reduced, thereby reducing latency. The edge nodes can work together to improve the overall system's ability to respond to intrusions. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] 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.
[0043] Figure 1 is the edge computing architecture diagram of the present invention;
[0044] Figure 2 It is a flow chart of the intrusion detection structure of the present invention;
[0045] Figure 3 It is a schematic diagram of GMM clustering undersampling and SMOTE oversampling of the present invention;
[0046] Figure 4 is a diagram of the stacked autoencoder training process of the present invention;
[0047] Figure 5 It is a schematic diagram of the structure of the Transformer encoder of the present invention;
[0048] Figure 6 It is a flow chart of the multi-head self-attention mechanism of the present invention;
[0049] Figure 7 It is the Autoencoder abnormal intrusion detection flow chart of the present invention;
[0050] Figure 8 This is the confusion matrix diagram of the experimental results of the Transformer model on the NSL-KDD dataset;
[0051] Fig. 9 This is the confusion matrix diagram of the experimental results of the Transformer model on the UNSW-NB15 dataset;
[0052] Fig.10 It is the smoothed graph of the loss statistics of the NSL-KDD and UNSW-NB15 training sets;
[0053] Fig.11 This is a comparison chart of reconstruction loss of the NSL-KDD dataset;
[0054] Fig.12 This is a comparison chart of reconstruction loss of the UNSW-NB15 dataset;
[0055] Fig.13 This is the confusion matrix diagram of the NSL-KDD dataset experimental results;
[0056] Fig.14 This is the confusion matrix diagram of the experimental results of the UNSW-NB15 dataset. DETAILED DESCRIPTION
[0057] 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.
[0058] Example 1
[0059] like Figure 1 As shown in Figure 1, edge computing places computing resources and data storage at the edge, closer to vehicles and end users, to respond to user requests faster and reduce data transmission delays. Edge computing can monitor vehicle driving status and surrounding environment in real time, detect potential safety hazards in a timely manner, and improve vehicle driving safety. Edge computing plays an important role in the Internet of Vehicles and can improve the real-time, security, and efficiency of the system, as follows:
[0060] Real-time: Edge computing can push data processing and analysis to the edge of the network, reduce data transmission time, achieve faster response speed, and meet the real-time communication needs between vehicles and between vehicles and infrastructure.
[0061] Security: Edge computing can process and store data inside or near the vehicle, reducing the risk of data being stolen or tampered with during network transmission and improving data security.
[0062] Energy saving: Edge computing can process data closer to the vehicle, reducing energy consumption during data transmission and improving the energy efficiency of the system.
[0063] Solve network bottlenecks: Edge computing can process large amounts of data at the edge of the network, reducing the pressure of data transmission to the cloud, reducing the risk of network congestion, and improving data transmission efficiency.
[0064] like Figure 2 As shown in the figure, the edge computing intrusion detection method based on the combination of Transformer and autoencoder includes the following steps:
[0065] S1, obtain data from the data set and perform data preprocessing;
[0066] The datasets include: NSL-KDD dataset and UNSW-NB15 dataset;
[0067] The NSL-KDD dataset (https: / / www.unb.ca / cic / datasets / nsl.html) is a benchmark dataset widely used in intrusion detection system research. The NSL-KDD dataset consists of two parts: a training set and a test set. Each data instance consists of 41 features and a label (normal or attack type). It contains the following four types of attacks: Probe, Denial of Service (Dos), User to Root (U2R), Remote to Local (R2L). The class labels and sample numbers of the NSL-KDD dataset are shown in Table 1.
[0068] Table 1 Class labels and sample numbers of the NSL-KDD dataset
[0069] Class Label KDD Train KDD Test Normal 67343 9711 Probe 11656 2421 Dos 45927 7458 U2R 52 200 R2L 995 2654 Total 125973 22544
[0070] The UNSW-NB15 dataset (https: / / research.unsw.edu.au / projects / unsw-nb15-dataset) is a public dataset for network intrusion detection, which contains a large collection of network trace records for several months. The traces include various types of network traffic, including web browsing, email, file transfer, etc. This dataset is considered a reliable dataset for evaluating existing and new IDS methods, and contains 9 common attacks. The class labels and sample numbers of the UNSW-NB15 dataset are shown in Table 2.
[0071] Table 2 Class labels and sample numbers of the UNSW-NB15 dataset
[0072]
[0073] Data preprocessing includes: GMM clustering undersampling and SMOTE oversampling
[0074] Gaussian Mixture Model (GMM) is a commonly used probability model used to describe data distributions that are a mixture of multiple Gaussian distributions. In GMM, each Gaussian distribution is called a "component", and the weighted sum of these components constitutes the entire data distribution. The probability density function of GMM can be expressed as:
[0075]
[0076] Among them, N(x|μ k ,∑ k ) indicates that the mean is μ k , the covariance matrix is ∑ k The probability density function of the multivariate Gaussian distribution.
[0077] like Figure 3 As shown in the figure, the basic idea of GMM clustering is to assume that the data is composed of multiple Gaussian distributions, and then fit the parameters of these Gaussian distributions through iterative optimization. The algorithm first randomly initializes the mean and variance of each Gaussian distribution, and then optimizes these parameters through iterative steps until convergence. In each iteration, the algorithm calculates the probability that each sample belongs to each cluster based on the current Gaussian distribution parameters, and then obtains the clustering distribution state of each class of samples based on these probabilities. Undersample the majority class samples according to the clustering distribution state, and only retain the most representative core samples of the majority class.
[0078] like Figure 3As shown in Figure 1, SMOTE is an oversampling technique used to deal with the problem of class imbalance. The basic idea is to balance the class distribution in the training data set by synthesizing new minority class samples. First, for each minority class sample, the distance between it and all other minority class samples is calculated using the Euclidean distance, and several of the nearest neighbors are selected. Then, a sample is randomly selected from these nearest neighbors, and a point is randomly selected on the line segment between the sample and the original sample to generate a new synthetic sample. The formula is as follows:
[0079] x new =x i +λ·(x j -x i ) (2)
[0080] Among them, x new is the generated new sample, λ is the parameter, x i is a minority class sample, x j is x i A nearest neighbor of .
[0081] S2, uses stacked autoencoders to extract spatial features of preprocessed data;
[0082] A stacked autoencoder consists of multiple autoencoders, each of which is responsible for learning a different level of abstract representation of the data. By stacking multiple autoencoders, a deep feature learner can be constructed that can learn a richer representation of the data.
[0083] The goal of the autoencoder is to make the output of the decoder as close to the input data as possible, while limiting the encoding dimension and forcing the model to learn the key features of the data. Stacked autoencoders consist of multiple autoencoders to form a deep network structure. The output of each autoencoder is used as the input of the next autoencoder, thereby learning the representation of the data layer by layer. The last layer of the stacked autoencoder is usually considered to be the most important feature representation.
[0084] like Figure 4 As shown in the figure, the stacked autoencoder is trained layer by layer. First, the first autoencoder is trained to convert the input data into the encoded representation of the first layer. Then, the encoded representation of the first layer is used as input to train the second autoencoder, and so on. After the layer-by-layer training is completed, the entire stacked autoencoder can be fine-tuned. The fine-tuning process uses the back-propagation algorithm to adjust the weights of all layers by minimizing the reconstruction error to further improve the model performance.
[0085] S3, extracts the temporal features of the preprocessed data through the variational mode decomposition method combined with the multi-head attention mechanism, and performs spatiotemporal feature fusion;
[0086] Variational Mode Decomposition (VMD) is a signal decomposition method used to decompose a signal into a series of modal functions with different frequency and amplitude modulations. The basic idea is to decompose the signal by minimizing the total variation norm. It assumes that the signal can be represented as a linear combination of a set of vibration modal functions, each with a different center frequency and bandwidth. These modal functions can be estimated by solving an optimization problem.
[0087]
[0088] Among them, μ k ={μ 1 ,μ 2 ,...,μ k} are the modal functions, ω k ={ω 1 ,ω 2 ,...,ω k} is the center frequency of each mode, and f is the signal.
[0089] Variational mode decomposition decomposes the input data into a set of modal functions; a multi-head attention mechanism is applied to each modal function; the multi-head attention mechanism can be divided into the following three steps:
[0090] 1) Linear mapping: Linear mapping is performed on each head to map the modal function to different subspaces.
[0091] 2) Calculate attention weights: For each attention head, calculate the inner product of the query, key, and value and scale them. Then use the Softmax function to calculate the attention weights. The formula is as follows:
[0092]
[0093] Among them, d k is the dimension of the key vector, Q = W q X, K = W k X, V = W v X, W represent weight matrices.
[0094] 3) Output: The output of each attention head is concatenated together and linearly transformed to obtain the final attention representation.
[0095] Based on the weight distribution results of multi-head attention, the modal functions with higher attention weights are selected as feature subsets. By introducing the multi-head attention mechanism, the relationship between modal functions can be modeled from different perspectives, improving the accuracy and robustness of feature selection.
[0096] S4, fuses the high-dimensional features into low-dimensional data, and then inputs the fused low-dimensional data into the classification model to obtain the detection result;
[0097] The classification model includes a Transformer model and an autoencoder. The Transformer model effectively classifies data samples into known attack types. However, some attack features are very similar to normal samples, and the Transformer encoder has difficulty identifying them. Therefore, the autoencoder is used to perform secondary detection on the data.
[0098] like Figure 5 As shown in the figure, the encoder of the Transformer model consists of several identical layers. Each layer contains two sublayers: one is a multi-head self-attention mechanism sublayer, and the other is a fully connected feedforward neural network sublayer;
[0099] like Figure 6 As shown in the figure, the multi-head self-attention mechanism sublayer maps each data in the input sequence to three different vectors (query vector, key vector, value vector), and then obtains the relevance score of each data with other data by calculating the dot product between the query vector and the key vector; these relevance scores are normalized by the softmax function to obtain the weight of each data for other data; finally, the weight is multiplied by the corresponding value vector to obtain the weighted vector representation of each data; the whole calculation process can be expressed as:
[0100]
[0101] Among them, Q, K, and V are query vector, key vector, and value vector respectively.
[0102] Assuming there are h attention heads, the calculation formula of the multi-head attention mechanism is as follows:
[0103] MultiHead(Q,K,V)=Concat(head 1 ,head 2 ,...,head h )W O (6)
[0104] Among them, head i =Attention(QW i Q ,KW i K ,VW i V ), W i Q ,W i K ,W iV is the weight matrix of the linear transformation, W O is the output linear transformation weight matrix.
[0105] The fully connected feedforward neural network sublayer is used to process the weighted vector to obtain a richer feature representation. This sublayer mainly includes two fully connected layers and a ReLU activation function, which can perform nonlinear transformation on the weighted vector to further improve the feature expression ability. The calculation formula of the fully connected feedforward neural network is as follows:
[0106] FFN(x)=ReLU(xW 1 +b 1 )W 2 +b 2 , (7)
[0107] Among them, W 1 ,b 1 and W 2 ,b 2 are the weights and biases of the two linear transformations.
[0108] In the classification stage, in order to achieve accurate classification using the extracted features. First, feature extraction is required, and a tag called "ClassToken" is added to the feature sequence. This tag will participate in the feature extraction process as an independent sequence information unit together with other features. During the feature extraction process, "ClassToken" will interact with other features and perform feature fusion with them. Finally, the "ClassToken" after feature extraction is extracted using the Multi-headSelf-attention structure and input into the fully connected layer for classification. This fully connected layer will output the final classification score, which is used to determine which category the input sample belongs to.
[0109] like Figure 7 As shown, in the autoencoder, the encoding process from the input layer to the hidden layer is:
[0110]
[0111] In the formula, x is the input data, W 1 is the weight matrix, b 1 is the bias vector and σ is the activation function.
[0112] The decoding process from the hidden layer to the output layer is:
[0113]
[0114] Where h is the input data, W 2 is the weight matrix, b 2is the bias vector and σ is the activation function.
[0115] An autoencoder is an artificial neural network that is trained to encode input data into a low-dimensional representation and then decode it back to the original data space. During training, the autoencoder tries to minimize the reconstruction error, which is the difference between the input data and the decoder output data. If the input data belongs to a normal pattern, the reconstruction error should be small; conversely, if the input data belongs to an abnormal pattern, the reconstruction error may be large.
[0116] First, an autoencoder model with one hidden layer is constructed, and mean square error is used as the loss function. Then, the autoencoder model is trained using normal data. During the training process, the autoencoder tries to minimize the reconstruction error between the input data and the decoder output data. After the training is completed, the anomaly is detected by calculating the reconstruction error. A threshold is set, and if the reconstruction error exceeds the threshold, the sample is marked as an anomaly.
[0117] The algorithm procedure for abnormal intrusion detection using autoencoders is as follows:
[0118]
[0119] In addition, in this embodiment, KL divergence is used as the classification loss function of the Transformer model, which measures the difference between an actual probability distribution and a predicted probability distribution. KL The calculation formula is as follows:
[0120]
[0121] Among them, P is the true distribution and W is the predicted distribution.
[0122] The mean square error (MSE) is used as the reconstruction loss of the Autoencoder model, which measures the average square difference between the model's predicted value and the actual observed value. The calculation formula of MSE is as follows:
[0123]
[0124] Where n is the number of samples, y i is the actual observed value, is the predicted value; the smaller the MSE, the better, indicating that the predicted value is closer to the actual observed value.
[0125] It is worth mentioning that model evaluation is mainly used to evaluate the performance and accuracy of the model. The following are the steps for model evaluation:
[0126] Dataset segmentation: The original dataset is divided into a training set and a test set. The ratio used is 80% of the data as a training set and 20% of the data as a test set.
[0127] Model training: Train the model using the training set and adjust the model hyperparameters until optimal performance is achieved.
[0128] Model evaluation: Use the test set to evaluate the model. Common evaluation indicators include accuracy, recall, F1 value, etc.
[0129] 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.
[0130] The calculation formulas for evaluating performance indicators including precision (Pre), recall (Rec), false positive rate (FPR) and F1 value are as follows:
[0131]
[0132] 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.
[0133] 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. By comprehensively considering the above evaluation indicators, the performance and reliability of the intrusion detection system can be evaluated, and the design and implementation of the system can be optimized and improved.
[0134] Example 2
[0135] In this embodiment, experiments are conducted to verify the effectiveness and superiority of the edge computing intrusion detection method based on the combination of Transformer and autoencoder disclosed in Embodiment 1;
[0136] 1. The datasets are NSL-KDD and UNSW-NB15
[0137] 2. Comparative analysis of model performance
[0138] According to the training set and test set of the two data sets set by the present invention, experiments are first conducted on the Transformer model, and the experimental results are displayed in the form of normalized confusion matrix. Figure 8 and Fig. 9This is the confusion matrix of the experimental results of the Transformer-based intrusion detection system. The rows of the confusion matrix represent the predicted labels, and the columns represent the true labels. The results show that the Transformer-based intrusion detection system has a high detection accuracy for known attacks. However, the detection accuracy can be improved by using Autoencoder to perform secondary detection on the data.
[0139] First, the model needs to be trained. The trained model traverses each example in the training set and records the loss. Then the reconstruction loss on the training set can be obtained, and the threshold is selected based on the reconstruction loss. Fig.10 The loss statistics smoothing diagram shown is based on Fig.10 (a) in the figure, the threshold of the NSL-KDD dataset is 17; according to Fig.10 In (a), the threshold of the UNSW-NB15 dataset is 15.
[0140] Then use the test set to experiment with the model. The test set reconstruction loss is as follows Fig.11 (a)-(d) and Fig.12 As shown in (a)-(d) in the figure, 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. 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.
[0141] 3. Comparative analysis of experimental results
[0142] By statistically analyzing the experimental results of Transformer and Autoencoder, we can get the normalized confusion matrix of the experimental results as follows: Fig.13 (a), (b) and Fig.14 As shown in (a) and (b) in the figure, 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 the present invention has a high detection accuracy for abnormal data.
[0143] The performance of the proposed method is compared with other SOTA algorithms, and the results are shown in Table 3;
[0144] Table 3 Comparison of classifier performance of different methods
[0145]
[0146] As shown in Table 3, the proposed model achieves high F1 values of 97.45 and 99.29 on the NSL-KDD dataset and UNSW-NB15 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.
[0147] 4. Ablation experiment and real vehicle test
[0148] 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.
[0149] Table 4 Composition of the comparison model in the ablation experiment
[0150] composition A B C D E F SAE √ √ √ √ √ Vmd √ √ √ √ √ Multiheadattention √ √ √ √ √ Transformer encoder √ √ √ √ √ Autoencoder √ √ √ √ √ MBD √ √ √ √ √ BGD √
[0151] Table 5. Comparison of ablation experiment results
[0152]
[0153]
[0154] From the comparison of the ablation experiment results in Table 5, it can be seen that the performance of the algorithm proposed in the present invention is significantly improved. The details are as follows.
[0155] Model A: It is composed of the algorithm model proposed in this paper and is used to compare the experimental results.
[0156] Model B: Experimental results show that stacking autoencoders significantly improves model performance.
[0157] Model C: VMD and Multi Head Attention extract temporal features. Experimental results show that they have a positive impact on the detection accuracy and F1 value of the model.
[0158] Model D: This group tested the impact of the Transformer encoder on the experiment. The experimental results verified that the Transformer encoder significantly improved the model performance.
[0159] Model E: This group tests the impact of Autoencoder on model performance. Experimental results show that the detection accuracy and F1 value of the model with Autoencoder are 1% to 2% higher than the original model.
[0160] 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.
[0161] In addition, this experiment was conducted on the test site of the Automotive Research Institute, and the trained model was tested on the field. The test accuracy reached 99.49% and the F1 value reached 98.80%.
[0162] 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.
[0163] 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. The edge computing intrusion detection method based on the combination of Transformer and autoencoder is characterized by: The following steps are involved: Get data from the dataset and perform data preprocessing; Use stacked autoencoders to extract spatial features from preprocessed data; The variational mode decomposition method is combined with the multi-head attention mechanism to extract temporal features from the preprocessed data, and the spatiotemporal features are fused to fuse high-dimensional features into low-dimensional data. The low-dimensional data is input into the Transformer model and the autoencoder to obtain the detection result.
2. The edge computing intrusion detection method based on the combination of Transformer and autoencoder according to claim 1 is characterized in that: The data preprocessing includes GMM clustering undersampling and SMOTE oversampling.
3. The edge computing intrusion detection method based on the combination of Transformer and autoencoder according to claim 1 is characterized in that: The stacked autoencoder is composed of multiple autoencoders to form a deep network structure, and the output of each autoencoder is used as the input of the next autoencoder, so as to learn the feature representation of the data layer by layer.
4. The edge computing intrusion detection method based on the combination of Transformer and autoencoder according to claim 1 is characterized in that: The variational modal decomposition decomposes the input data into a set of modal functions, and applies a multi-head attention mechanism to each modal function; wherein the modal function is estimated by solving an optimization problem, and the optimization problem is expressed as: Among them, μ k ={μ1,μ2,...,μ k } are the modal functions, ω k ={ω1,ω2,...,ω k } is the center frequency of each mode, and f is the signal.
5. The edge computing intrusion detection method based on the combination of Transformer and autoencoder according to claim 4 is characterized in that: The multi-head attention mechanism includes the following steps: 1) Linearly map each head and map the modal function to different subspaces; 2) For each attention head, the inner product of the query, key, and value is calculated and scaled, and then the attention weight is calculated using the Softmax function, as follows: Among them, d k is the dimension of the key vector, Q = W q X, K = W k X, V = W v X, W represent weight matrices; 3) The outputs of each attention head are concatenated together and linearly transformed to obtain the final attention representation.
6. The edge computing intrusion detection method based on the combination of Transformer and autoencoder according to claim 1 is characterized in that: The encoder of the Transformer model consists of several identical layers, each of which consists of: Multi-head self-attention mechanism sublayer: each data in the input sequence is mapped to three different vectors, and then the relevance score of each data with other data is obtained by calculating the dot product between the query vector and the key vector; these relevance scores are normalized by the softmax function to obtain the weight of each data with respect to other data; finally, the weight is multiplied by the corresponding value vector to obtain the weighted vector representation of each data; Fully connected feedforward neural network sublayer: It contains two fully connected layers and a ReLU activation function to perform nonlinear transformation on the weighted vector.
7. The edge computing intrusion detection method based on the combination of Transformer and autoencoder according to claim 6 is characterized in that: The autoencoder encodes the input data into a low-dimensional representation through training and then decodes it back to the original data space; After training is completed, anomalies are detected by calculating the reconstruction error.
8. The edge computing intrusion detection method based on the combination of Transformer and autoencoder according to claim 7 is characterized in that: The Transformer model uses KL divergence D KL As a classification loss function: Among them, P is the true distribution and W is the predicted distribution; The autoencoder uses mean square error MSE as the reconstruction loss, and the calculation formula is: Where n is the number of samples, y i is the actual observed value, is the predicted value.
9. The edge computing intrusion detection system based on the combination of Transformer and autoencoder is characterized by: include: Data preprocessing module: obtain data from the data set and perform data preprocessing; Spatial feature extraction module: uses stacked autoencoders to extract spatial features from preprocessed data; Temporal feature extraction module: extracts temporal features from preprocessed data through variational mode decomposition combined with multi-head attention mechanism, and performs spatiotemporal feature fusion to fuse high-dimensional features into low-dimensional data; And, a detection module: inputting the low-dimensional data into a Transformer model and an automatic encoder to obtain a detection result.
10. A computer storage medium storing a calibration program, which, when running, can execute the edge computing intrusion detection method based on the combination of Transformer and autoencoder as described in any one of claims 1-8.
Citation Information
Cited By
Method and system for preventing network content from being synthesized and tampered
CN119383005A
Method and system for preventing network content from being synthetically tampered with
CN119383005B
CAN bus feature fusion intrusion detection method based on adversarial learning
CN119520176A
Intelligent manufacturing system and method based on digital twinning
CN119693177A
Health feature extraction method and device for front-end isolated switching power supply of aging table
CN119885092A
