End-to-end vehicle networking intrusion detection method, system and device based on learnable mask

By jointly training sparse learnable masks and multi-layer CNN convolutional neural networks, the problems of fixed feature selection rules and low update efficiency in traditional vehicle network intrusion detection methods are solved. This achieves efficient detection of novel attacks and collaborative updating of feature selection and detection, improving the adaptability and detection efficiency of vehicle network intrusion detection.

CN122120019APending Publication Date: 2026-05-29SOUTHEAST UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTHEAST UNIV
Filing Date
2026-04-22
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Traditional vehicle network intrusion detection methods suffer from fixed feature selection rules, low update efficiency, and inability to adapt to new types of attacks. Furthermore, deep learning methods do not integrate adaptive feature selection mechanisms, resulting in low detection efficiency.

Method used

An end-to-end vehicle network intrusion detection method based on learnable masks is adopted. By using sparse learnable masks and multi-layer CNN convolutional neural networks, joint training and collaborative updating of feature selection and intrusion detection are achieved. The method is optimized using a joint loss function of multi-class cross-entropy loss and learnable mask mutual information loss.

Benefits of technology

It improves the model's adaptability and detection efficiency to new types of attacks, enhances its generalization ability and attack detection coverage, shortens the iteration cycle, and provides good interpretability and traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122120019A_ABST
    Figure CN122120019A_ABST
Patent Text Reader

Abstract

The application discloses an end-to-end vehicle networking intrusion detection method, system and equipment based on a learnable mask, and relates to the technical field of automatic driving.The application constructs an end-to-end architecture comprising data processing, sparse learnable mask selection, multi-layer CNN feature extraction and classification, generates a sparse mask through a trainable mask parameter, realizes adaptive and accurate screening of features, inputs the screened features into a feature intrusion detection model for feature extraction and classification detection output, and simultaneously trains the feature selection and the intrusion detection model in a joint manner and updates the end-to-end parameters by using a joint loss function.The application does not need an independent feature selection process, the model parameters can be updated in a cooperative manner, is suitable for adapting to new attack scenarios of vehicle networking, takes into account the real-time performance and explainability of detection, and is suitable for multi-type network intrusion detection of automatic driving vehicle networking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of autonomous driving technology, specifically to an end-to-end vehicle-to-everything (V2X) intrusion detection method, system, and device based on learnable masks. Background Technology

[0002] With the rapid development of autonomous driving technology, vehicles are evolving towards greater intelligence and connectivity. Vehicle-to-everything (V2X) communication, as a core support for autonomous driving, constructs a distributed collaborative architecture through onboard terminals, roadside equipment, and communication networks. However, this architecture has a large network attack surface; network intrusion behaviors such as packet forgery, denial-of-service attacks, and man-in-the-middle attacks directly threaten the safety of autonomous driving. Therefore, V2X intrusion detection has become a key technology for ensuring V2X security.

[0003] Traditional vehicle-to-everything (V2X) intrusion detection methods employ a decoupled process between feature selection and detection model training. First, V2X features are manually selected using traditional algorithms, and then these selected features are input into the detection model for training. This approach has significant drawbacks: First, the fixed feature selection rules cannot adapt to the constantly emerging new attacks in V2X, and are prone to detection failure due to missed feature selection. Second, feature updates require separate re-selection and model retraining, resulting in low update efficiency and failing to meet the real-time detection requirements of V2X. While existing deep learning-based intrusion detection methods have improved feature extraction capabilities, they lack an adaptive feature selection mechanism and still rely on manual preprocessing for feature selection, failing to address the inherent problems of the decoupled process. Therefore, an end-to-end V2X intrusion detection method is urgently needed to achieve joint training and collaborative updating of feature selection and intrusion detection, adapting to new attacks and improving detection efficiency.

[0004] To this end, the present invention proposes an end-to-end vehicle network intrusion detection method, system and device based on learnable masks. Summary of the Invention

[0005] The purpose of this invention is to provide an end-to-end vehicle network intrusion detection method based on learnable masks, which realizes joint training and collaborative updating of feature selection and intrusion detection to adapt to new attacks and improve detection efficiency, and solves the problems of poor adaptability and low update efficiency caused by decoupling in traditional methods.

[0006] According to a first aspect of the present invention, in order to achieve the above objective, the present invention provides the following technical solution: an end-to-end vehicle network intrusion detection method based on learnable masks, comprising the following steps: The system receives raw data from the Internet of Vehicles (IoV) and preprocesses it. The preprocessed data is then used to construct an IoV feature matrix, which serves as the input feature tensor. A feature selection model based on sparse learnable masks is constructed. The input feature tensor is input into the feature selection model, a sparse mask is generated through trainable mask parameters, and the sparse mask is multiplied element-wise with the input feature tensor to obtain the selected feature tensor. An intrusion detection model is constructed based on a multi-layer CNN convolutional neural network, and a joint loss function including multi-class cross-entropy loss and learnable mask mutual information loss is constructed. The intrusion detection model is trained with the goal of minimizing the joint loss function to obtain the trained intrusion detection model. The intrusion detection model includes convolutional layers, activation layers, pooling layers, fully connected layers and Softmax activation function. The filtered feature tensors are input into the trained intrusion detection model. Through stacked multi-layer convolution, activation and pooling operations, deep spatial features for intrusion detection are extracted and a one-dimensional deep feature vector is output. The one-dimensional deep feature vector is input into a fully connected layer and a Softmax activation function to output the probability distribution of vehicle network intrusion types, thus obtaining the detection result.

[0007] Furthermore, the raw data from the vehicle network is received and preprocessed. The preprocessed data is then used to construct a vehicle network feature matrix, which serves as the input feature tensor, as follows: The raw data of the Internet of Vehicles (IoV) consists of IoV message characteristic data, which specifically includes message time, protocol, traffic, and command characteristics. One-hot encoding is performed on non-numerical features in the vehicle network message feature data. All numerical features are normalized, and the one-dimensional feature vector is padded with zeros to reconstruct it into an N×N two-dimensional feature matrix, resulting in the input feature tensor. in Input tensors into the preprocessed model. This is a one-dimensional feature vector derived from the encoded and normalized original feature data of the vehicle network. 1 represents the single-channel dimension, and N×N represents the spatial dimension of the two-dimensional feature matrix. This is a dimensional reshaping operation.

[0008] Furthermore, a feature selection model based on sparse learnable masks is constructed. The input feature tensor is input into the feature selection model, and a sparse mask is generated through trainable mask parameters. The sparse mask is then multiplied element-wise with the input feature tensor to obtain the selected feature tensor, as follows: Mask parameter initialization: Perform Gaussian initialization on the mask parameters. , For learnable mask parameters, It follows a Gaussian distribution, with 0 as the mean and 0.01 as the variance; Mask scaling: Calculates a scaling scalar to precisely control the number of features selected. The formula is: in, Scalar scaling of the mask, Select the number of features for the manually specified target. mask parameters The th sorted in descending order One element, It is a sparse maximization activation function; Sparse mask generation: The scaled mask parameters are projected onto the probability simplex to generate a sparse mask, as shown in the formula: in, For sparse masking, It is a probabilistic simplex; Feature selection: Feature filtering is achieved by performing element-wise multiplication between the sparse mask and the preprocessed input tensor. The formula is as follows: in, For the filtered feature tensor, This is element-wise multiplication, ensuring the mask matches the dimension of the input tensor.

[0009] Furthermore, the joint loss function is used to perform end-to-end joint gradient updates on the mask parameters in the feature selection model, the convolutional parameters in the intrusion detection model, and the fully connected layer parameters, as specifically expressed below: In the formula, For joint losses, For multi-class cross-entropy loss, The mutual information loss weighting coefficient, 0 < ≤1, For learnable mask mutual information loss; The formula for multi-class cross-entropy loss is: in, True intrusion type tags for one-hot encoding It is a numerically stable term; The formula for the mutual information loss of the learnable mask is: in, For consistency regularization, Ypred Label prediction results for one-hot encoding Ypred (y) represents the predicted probability of the non-true category y.

[0010] Furthermore, the filtered feature tensors are input into the trained intrusion detection model. Through stacked multi-layer convolution, activation, and pooling operations, deep spatial features for intrusion detection are extracted, and a one-dimensional deep feature vector is output, as follows: The filtered feature tensors The input is a multi-layer CNN convolutional neural network, with each layer having independently configured convolutional parameters. Through layer-by-layer feature transformation, the deep spatial features of vehicle network intrusion are extracted, ultimately outputting a one-dimensional deep feature vector. Specifically: No. Layer convolution calculation: in, , This represents the total number of layers in the CNN. For the first The linear output of a convolutional layer. For the first Layer convolution kernel weights, This is a two-dimensional convolution operation. This is the input to the first layer of a CNN convolutional neural network. For the first Output features after layer pooling For the first Layer convolution bias; No. The ReLU activation formula for the layer is: in, For the first Layer activation output, To modify the activation function of the linear unit, ; No. Max pooling: Downsampling the activation output reduces the feature dimensionality while preserving core features. The formula is: in, For the first Layered pooling output, For pooling core size, The pooling step size; Feature flattening: Take the output of the last pooling layer. Perform a dimension flattening operation to obtain a one-dimensional depth feature vector. .

[0011] Furthermore, the one-dimensional deep feature vector is input into a fully connected layer and a Softmax activation function to output the probability distribution of vehicle network intrusion types, thus obtaining the detection results, as follows: The deep feature vector is input into a fully connected layer and a softmax activation function, and the probability distribution of vehicle network intrusion types is output to achieve multi-class detection. The formula is as follows: in, For linear output of fully connected layers, For the weights of the fully connected layer, For biasing the fully connected layer, To predict the probability distribution, For the number of vehicle network intrusion types, For the first Linear output values ​​for the class.

[0012] According to a second aspect of the present invention, the present invention provides an end-to-end vehicle network intrusion detection system based on learnable masks, for implementing the end-to-end vehicle network intrusion detection method based on learnable masks described in the first aspect, comprising: The data preprocessing module is used to receive raw data from the vehicle network, preprocess it, and construct a vehicle network feature matrix from the preprocessed data as an input feature tensor. The feature filtering module is used to build a feature filtering model based on sparse learnable masks. The input feature tensor is input into the feature filtering model, a sparse mask is generated through trainable mask parameters, and the sparse mask is multiplied element-wise with the input feature tensor to obtain the filtered feature tensor. The model building and training module is used to build an intrusion detection model based on a multi-layer CNN convolutional neural network, and to build a joint loss function that includes multi-class cross-entropy loss and learnable mask mutual information loss. The intrusion detection model is trained with the goal of minimizing the joint loss function to obtain the trained intrusion detection model. The intrusion detection model includes convolutional layers, activation layers, pooling layers, fully connected layers and Softmax activation function. The feature extraction module is used to input the filtered feature tensors into the trained intrusion detection model, and extract the deep space features for intrusion detection through stacked multi-layer convolution, activation and pooling operations, and output a one-dimensional deep feature vector. The prediction output module is used to input the one-dimensional deep feature vector into the fully connected layer and the Softmax activation function, output the probability distribution of the vehicle network intrusion type, and obtain the detection result.

[0013] According to a third aspect of the present invention, the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores the computer program capable of running on the processor, and when the processor loads and executes the computer program, it employs the end-to-end vehicle network intrusion detection method based on learnable masks described in the first aspect.

[0014] According to a fourth aspect of the present invention, the present invention provides a storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to perform the end-to-end vehicle network intrusion detection method based on a learnable mask as described in the first aspect.

[0015] According to a fifth aspect of the present invention, the present invention provides a computer program product comprising a computer program, which, when executed by a processor, is used to load and execute the end-to-end vehicle network intrusion detection method based on a learnable mask as described in the first aspect.

[0016] The present invention has at least the following beneficial effects: 1. This invention innovatively introduces a sparse feature selection mechanism based on learnable masks. This mechanism does not rely on fixed manual feature selection rules, but can adaptively and dynamically capture core features that are highly related to new attacks on the Internet of Vehicles according to the target of the intrusion detection task. This enables the model to maintain stable detection performance when facing unknown or mutated network attacks, effectively solving the problem that traditional methods cannot adapt to new attacks due to the solidification of feature selection rules, and greatly enhancing the model's generalization ability and attack detection coverage.

[0017] 2. This invention achieves end-to-end joint training of feature selection and intrusion detection models, fundamentally breaking the decoupling process between feature selection and model training in traditional methods. By embedding learnable masks into a deep learning architecture, the mask parameters of feature selection, convolutional neural network parameters, and classification parameters can be updated collaboratively under a unified optimization framework. All learnable parameters are synchronously optimized through the backpropagation algorithm, eliminating the need for separate feature re-selection and retraining of the detection model. This significantly shortens the model iteration cycle and substantially improves the response speed and update efficiency of the vehicle-to-everything (V2X) intrusion detection model to new threats, better adapting to the business needs of real-time detection in V2X.

[0018] 3. The sparse mask generated by this invention can directly and quantitatively reflect the contribution and importance of the original features of the Internet of Vehicles (IoV) to the final intrusion detection result. This feature makes the detection decision process of the model highly interpretable, and can clearly trace and locate the key message features that trigger the intrusion alarm. It provides an intuitive and reliable basis for IoV security operation and maintenance personnel to conduct abnormal behavior analysis, attack path reconstruction and the formulation of targeted security protection strategies.

[0019] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart illustrating the method described in this invention; Figure 2 This is a schematic diagram comparing the learnable mask before and after training in Embodiment 1 of the present invention; Figure 3 This is a confusion matrix diagram of the detection results in Embodiment 1 of the present invention. Detailed Implementation

[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] Example 1: Please see Figure 1 This invention provides a technical solution: an end-to-end vehicle network intrusion detection method based on learnable masks, comprising the following steps: Step 1: Receive raw vehicle network data and preprocess it. Construct a vehicle network feature matrix from the preprocessed data, which will serve as the input feature tensor. The network packet feature data of the vehicle network is collected, and core features such as time, protocol, traffic, and command are extracted. These features are then preprocessed by encoding, normalizing, and padding (one-dimensional to two-dimensional) to construct an N×N dimensional vehicle network feature matrix, which serves as the model input. Specifically: Non-numerical features are converted to numerical values ​​using one-hot encoding; all numerical features are normalized to eliminate dimensional differences; the one-dimensional feature vector is padded with zeros to reconstruct an N×N two-dimensional feature matrix, yielding the model's standard input tensor, as shown in the formula: in Input tensors into the preprocessed model. This is a one-dimensional feature vector derived from the encoded and normalized original feature data of the vehicle network. 1 represents the single-channel dimension, and N×N represents the spatial dimension of the two-dimensional feature matrix. For dimensional reshaping operations; It should be further explained that non-numerical features refer to discrete and categorical features in vehicle network communication messages, such as protocol type (TCP / UDP / ICMP), service type, connection status, flag bits, vehicle identification, etc., which cannot be directly involved in numerical calculations and therefore need to be converted into numerical vectors through one-hot encoding. Numerical characteristics: These refer to continuous and statistical characteristics in vehicle-to-everything (V2X) communication messages, such as message length, packet sending rate, connection duration, latency, and packet loss rate. Step 2: Construct a feature selection model based on sparse learnable masks. Input the input feature tensor into the feature selection model, generate a sparse mask using trainable mask parameters, and perform element-wise multiplication between the sparse mask and the input feature tensor to obtain the selected feature tensor. End-to-end feature selection is achieved based on learnable masks, accurately filtering features highly correlated with vehicle network intrusion and filtering noisy features, specifically including: Step 2-1 Mask parameter initialization: Perform Gaussian initialization on the mask parameters. , For learnable mask parameters, It follows a Gaussian distribution, with 0 as the mean and 0.01 as the variance; Step 2-2 Mask Scaling: Calculate the scaling scalar to precisely control the number of selected features. The formula is: in, Scalar scaling of the mask, Select the number of features for the manually specified target. mask parameters The th sorted in descending order One element, It is a sparse maximization activation function; Step 2-3 Sparse Mask Generation: Project the scaled mask parameters onto the probability simplex to generate a sparse mask, using the following formula: in, For sparse masking, It is a probabilistic simplex; Step 2-4 Feature Selection: Perform element-wise multiplication between the sparse mask and the preprocessed input tensor to achieve feature selection. The formula is as follows: in, For the filtered feature tensor, For element-wise multiplication, the mask is matched to the dimension of the input tensor; Step 3: Construct an intrusion detection model based on a multi-layer CNN convolutional neural network. The intrusion detection model includes convolutional layers, activation layers, pooling layers, fully connected layers, and a softmax activation function. The multi-layer CNN feature extraction module extracts the deep features of vehicle network intrusion, as detailed below: The filtered feature tensors The input is a multi-layer CNN, stacked with L layers of convolutional-activation-pooling units (L≥2). Each layer has independently configured convolutional parameters. The deep spatial features of vehicle network intrusion are extracted through layer-by-layer feature transformation, and the final output is a one-dimensional deep feature vector, specifically: Step 3-1: The layer( , Convolution calculation (total number of layers in the CNN): in, For the first The linear output of a convolutional layer. For the first Layer convolution kernel weights, This is a two-dimensional convolution operation. This is the input to the first layer of the CNN. For the first Output features after layer pooling For the first Layer convolution bias.

[0024] Step 3-1: The Layer ReLU activation: Introduces non-linearity to enhance feature representation ability, the formula is: in, For the first Layer activation output, To modify the activation function of the linear unit, .

[0025] Step 3-1: The Max pooling: Downsampling the activation output reduces the feature dimensionality while preserving core features. The formula is: in, For the first Layered pooling output, For pooling core size, This is the pooling step size.

[0026] Step 3-1: Feature Flattening: Take the output of the last pooling layer Perform a dimension flattening operation to obtain a one-dimensional depth feature vector. , as a classification input; Step 4: Input the one-dimensional deep feature vector into a classifier consisting of a fully connected layer and a Softmax activation function. The classifier outputs the probability distribution of vehicle network intrusion types to obtain the detection results, thus achieving multi-class detection of vehicle network intrusion types, as detailed below: The deep feature vector is input into a fully connected layer and a softmax activation function, and the probability distribution of vehicle network intrusion types is output to achieve multi-class detection. The formula is as follows: in, For linear output of fully connected layers, For the weights of the fully connected layer, For biasing the fully connected layer, To predict the probability distribution, For the number of vehicle network intrusion types, For the first Linear output values ​​for the class; Step 5: Construct a joint loss function that includes multi-class cross-entropy loss and learnable mask mutual information loss. With the goal of minimizing this joint loss function, perform end-to-end joint training and parameter updates on the intrusion detection model and the feature selection model, as detailed below: A joint loss function is constructed, consisting of multi-class cross-entropy loss and learnable mask mutual information loss. This joint loss is minimized via gradient descent, enabling end-to-end joint updates of mask parameters, multi-layer CNN convolutional parameters, and classification parameters. The joint loss formula is as follows: in, For joint losses, For multi-class cross-entropy loss, Mutual information loss weighting coefficient (0 < ≤1), The learnable mask mutual information loss is used. The multi-class cross-entropy loss formula is: in, True intrusion type tags for one-hot encoding For numerically stable terms, avoid This results in numerical overflow; The formula for the mutual information loss of the learnable mask is: in, This is a consistency regularization term used to avoid redundant feature selection and improve the correlation between feature selection and intrusion detection. Ypred Label prediction results for one-hot encoding Ypred (y) represents the predicted probability of the non-true category y.

[0027] The technical solution of this invention will be further elaborated below with reference to specific simulation experiments: This embodiment uses the NSL-KDD dataset as the experimental object to implement the end-to-end intrusion detection method of this invention, clarify the specific parameter values ​​of each module, and verify the effectiveness of the method. NSL-KDD contains 41-dimensional raw network traffic features, covering five typical intrusion types in vehicle-to-everything (V2X) networks: "normal traffic," "DoS," "Probe," "R2L," and "U2R," making it suitable for intrusion detection scenarios in autonomous driving V2X networks.

[0028] Specific implementation steps: Step 1: Preprocessing the NSL-KDD dataset (1) Non-numerical feature one-hot encoding One-hot encoding was performed on the three non-numerical features in NSL-KDD: protocol_type (3 classes), service (70 classes), and flag (11 classes), expanding the feature dimension from 41 to 122. (2) Max-Min Normalization The encoded 122-dimensional numerical features are mapped to the [0,1] interval: (3) Zero padding and two-dimensional matrix reconstruction To adapt to the 12×12 matrix input format, 22 zero-value features were added to the 122-dimensional normalized features, resulting in a 144-dimensional one-dimensional vector, which was then reshaped into a single-channel two-dimensional matrix. Step 2: Sparse Learnable Mask Selection Module First, the mask parameters are Gaussian initialized, and the number of target selection features is set. To preserve core features; rules are generated through sparse masking. After obtaining the mask matrix, feature selection operation is then performed. This completes the selection of core features; the learnable masks before and after training are as follows: Figure 2 As shown; Step 3: Two-layer CNN feature extraction module This module uses a hierarchical CNN structure to implement feature extraction: The first CNN layer uses 32 3×3 convolutional kernels with a stride of 1, padding of 1, and a bias dimension of 32, employing the ReLU activation function. After 2×2 max pooling (stride 2), the output feature map size is 6×6. The second CNN layer uses 64 3×3 convolutional kernels with a stride of 1, padding of 1, and a bias dimension of 64, employing the ReLU activation function. After 2×2 max pooling (stride 2), the output feature map size is 3×3. Finally, the 64×3×3 pooling output is flattened into a 576-dimensional one-dimensional feature vector for subsequent classification. Step 4: Classification Module To address the classification requirements for intrusion and normal traffic, the fully connected layer parameters are configured as follows: the weight dimension of the fully connected layer is 576×5, and the bias dimension is 5; the output layer uses Softmax normalization to output a 5-class probability distribution, with the expression as follows: Step 5: End-to-end joint training Set mutual information loss weights Numerical stability term The combined loss is: The model was trained using the Adam optimizer with a learning rate of [missing information]. Weight decay If the training rounds are 100 and the validation set loss does not decrease for 5 consecutive rounds, the training will stop early.

[0029] The results show that, Figure 3 As shown, the model achieves an overall detection accuracy of approximately 98.96% on the test set. While ensuring high-precision detection, it meets the real-time and efficient iteration requirements of vehicle terminals and can effectively adapt to the detection tasks of various types of attacks in the Internet of Vehicles scenario.

[0030] Example 2: This invention provides an end-to-end vehicular network intrusion detection system based on learnable masks, used to implement the end-to-end vehicular network intrusion detection method based on learnable masks described in Embodiment 1, comprising: The data preprocessing module is used to receive raw data from the vehicle network, preprocess it, and construct a vehicle network feature matrix from the preprocessed data as an input feature tensor. The feature filtering module is used to build a feature filtering model based on sparse learnable masks. The input feature tensor is input into the feature filtering model, a sparse mask is generated through trainable mask parameters, and the sparse mask is multiplied element-wise with the input feature tensor to obtain the filtered feature tensor. The model building and training module is used to build an intrusion detection model based on a multi-layer CNN convolutional neural network, and to build a joint loss function that includes multi-class cross-entropy loss and learnable mask mutual information loss. The intrusion detection model is trained with the goal of minimizing the joint loss function to obtain the trained intrusion detection model. The intrusion detection model includes convolutional layers, activation layers, pooling layers, fully connected layers and Softmax activation function. The feature extraction module is used to input the filtered feature tensors into the trained intrusion detection model, and extract the deep space features for intrusion detection through stacked multi-layer convolution, activation and pooling operations, and output a one-dimensional deep feature vector. The prediction output module is used to input the one-dimensional deep feature vector into the fully connected layer and the Softmax activation function, output the probability distribution of the vehicle network intrusion type, and obtain the detection result.

[0031] Example 3: The present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores the computer program capable of running on the processor. When the processor loads and executes the computer program, it employs the end-to-end vehicle network intrusion detection method based on learnable mask described in Embodiment 1.

[0032] It should be noted that the terminal device can be a computer device such as a desktop computer, a laptop computer, or a cloud server, and the terminal device includes, but is not limited to, a processor and a memory. For example, the terminal device may also include input / output devices, network access devices, and buses.

[0033] Furthermore, the processor can be a central processing unit (CPU). Of course, depending on the actual use, other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be used. The general-purpose processor can be a microprocessor or any conventional processor, etc., and this application does not limit it in this regard.

[0034] Example 4: The present invention provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the end-to-end vehicle network intrusion detection method based on a learnable mask described in Embodiment 1.

[0035] The computer program can be stored in a computer-readable medium. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or certain middleware. The computer-readable medium includes any entity or device capable of carrying computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the computer-readable medium includes, but is not limited to, the above-mentioned components.

[0036] Example 5: The present invention provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it is used to load and execute the end-to-end vehicle network intrusion detection method based on learnable mask described in Embodiment 1.

[0037] In the description of this specification, the references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0038] The foregoing has shown and described the basic principles, main features, and advantages of this application. Those skilled in the art should understand that this application is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of this application. Various changes and modifications can be made to this application without departing from the spirit and scope thereof, and all such changes and modifications fall within the scope of the claims of this application.

Claims

1. An end-to-end vehicle network intrusion detection method based on learnable masks, characterized in that, Includes the following steps: The system receives raw data from the Internet of Vehicles (IoV) and preprocesses it. The preprocessed data is then used to construct an IoV feature matrix, which serves as the input feature tensor. A feature selection model based on sparse learnable masks is constructed. The input feature tensor is input into the feature selection model, a sparse mask is generated through trainable mask parameters, and the sparse mask is multiplied element-wise with the input feature tensor to obtain the selected feature tensor. An intrusion detection model is constructed based on a multi-layer CNN convolutional neural network, and a joint loss function including multi-class cross-entropy loss and learnable mask mutual information loss is constructed. The intrusion detection model is trained with the goal of minimizing the joint loss function to obtain the trained intrusion detection model. The intrusion detection model includes convolutional layers, activation layers, pooling layers, fully connected layers and Softmax activation function. The filtered feature tensors are input into the trained intrusion detection model. Through stacked multi-layer convolution, activation and pooling operations, deep spatial features for intrusion detection are extracted and a one-dimensional deep feature vector is output. The one-dimensional deep feature vector is input into a fully connected layer and a Softmax activation function to output the probability distribution of vehicle network intrusion types, thus obtaining the detection result.

2. The end-to-end vehicle network intrusion detection method based on learnable masks according to claim 1, characterized in that: The system receives raw data from the vehicle network, preprocesses it, and then constructs a vehicle network feature matrix from the preprocessed data, which serves as the input feature tensor, as follows: The raw data of the Internet of Vehicles (IoV) consists of IoV message characteristic data, which specifically includes message time, protocol, traffic, and command characteristics. One-hot encoding is performed on non-numerical features in the vehicle network message feature data. All numerical features are normalized, and the one-dimensional feature vector is padded with zeros to reconstruct it into an N×N two-dimensional feature matrix, resulting in the input feature tensor. in Input tensors into the preprocessed model. This is a one-dimensional feature vector derived from the encoded and normalized original feature data of the vehicle network. 1 represents the single-channel dimension, and N×N represents the spatial dimension of the two-dimensional feature matrix. This is a dimensional reshaping operation.

3. The end-to-end vehicle network intrusion detection method based on learnable masks according to claim 1, characterized in that: A feature selection model based on sparse learnable masks is constructed. The input feature tensor is fed into the feature selection model, and a sparse mask is generated through trainable mask parameters. The sparse mask is then multiplied element-wise with the input feature tensor to obtain the selected feature tensor, as follows: Mask parameter initialization: Perform Gaussian initialization on the mask parameters. , For learnable mask parameters, It follows a Gaussian distribution, with 0 as the mean and 0.01 as the variance; Mask scaling: Calculates a scaling scalar to precisely control the number of features selected. The formula is: in, Scalar scaling of the mask, Select the number of features for the manually specified target. mask parameters The th sorted in descending order One element, It is a sparse maximization activation function; Sparse mask generation: The scaled mask parameters are projected onto the probability simplex to generate a sparse mask, as shown in the formula: in, For sparse masking, It is a probabilistic simplex; Feature selection: Feature filtering is achieved by performing element-wise multiplication between the sparse mask and the preprocessed input tensor. The formula is as follows: in, For the filtered feature tensor, This is element-wise multiplication, ensuring the mask matches the dimension of the input tensor.

4. The end-to-end vehicle network intrusion detection method based on learnable masks according to claim 1, characterized in that: The joint loss function is used to perform end-to-end joint gradient updates on the mask parameters in the feature selection model, the convolutional parameters in the intrusion detection model, and the fully connected layer parameters, as specifically expressed below: In the formula, For joint losses, For multi-class cross-entropy loss, The mutual information loss weighting coefficient, 0 < ≤1, For learnable mask mutual information loss; The formula for multi-class cross-entropy loss is: in, True intrusion type tags for one-hot encoding It is a numerically stable term; The formula for the mutual information loss of the learnable mask is: in, For consistency regularization, Ypred Label prediction results for one-hot encoding Ypred (y) represents the predicted probability of the non-true category y.

5. The end-to-end vehicle network intrusion detection method based on learnable masks according to claim 3, characterized in that: The selected feature tensors are input into the trained intrusion detection model. Through stacked multi-layer convolution, activation, and pooling operations, deep spatial features for intrusion detection are extracted, and a one-dimensional deep feature vector is output, as follows: The filtered feature tensors The input is a multi-layer CNN convolutional neural network, with each layer having independently configured convolutional parameters. Through layer-by-layer feature transformation, the deep spatial features of vehicle network intrusion are extracted, ultimately outputting a one-dimensional deep feature vector. Specifically: No. Layer convolution calculation: in, , This represents the total number of layers in the CNN. For the first The linear output of a convolutional layer. For the first Layer convolution kernel weights, This is a two-dimensional convolution operation. This is the input to the first layer of a CNN convolutional neural network. For the first Output features after layer pooling For the first Layer convolution bias; No. The ReLU activation formula for the layer is: in, For the first Layer activation output, To modify the activation function of the linear unit, ; No. Max pooling: Downsampling the activation output reduces the feature dimensionality while preserving core features. The formula is: in, For the first Layered pooling output, For pooling core size, The pooling step size; Feature flattening: Take the output of the last pooling layer. Perform a dimension flattening operation to obtain a one-dimensional depth feature vector. .

6. The end-to-end vehicle network intrusion detection method based on learnable masks according to claim 5, characterized in that: The one-dimensional deep feature vector is input into a fully connected layer and a Softmax activation function to output the probability distribution of vehicle network intrusion types, thus obtaining the detection results, as follows: The deep feature vector is input into a fully connected layer and a softmax activation function, and the probability distribution of vehicle network intrusion types is output to achieve multi-class detection. The formula is as follows: in, For linear output of fully connected layers, For the weights of the fully connected layer, For biasing the fully connected layer, To predict the probability distribution, For the number of vehicle network intrusion types, For the first Linear output values ​​for the class.

7. An end-to-end vehicle network intrusion detection system based on learnable masks, used to implement the end-to-end vehicle network intrusion detection method based on learnable masks as described in any one of claims 1 to 6, characterized in that, include: The data preprocessing module is used to receive raw data from the vehicle network, preprocess it, and construct a vehicle network feature matrix from the preprocessed data as an input feature tensor. The feature filtering module is used to build a feature filtering model based on sparse learnable masks. The input feature tensor is input into the feature filtering model, a sparse mask is generated through trainable mask parameters, and the sparse mask is multiplied element-wise with the input feature tensor to obtain the filtered feature tensor. The model building and training module is used to build an intrusion detection model based on a multi-layer CNN convolutional neural network, and to build a joint loss function that includes multi-class cross-entropy loss and learnable mask mutual information loss. The intrusion detection model is trained with the goal of minimizing the joint loss function to obtain the trained intrusion detection model. The intrusion detection model includes convolutional layers, activation layers, pooling layers, fully connected layers and Softmax activation function. The feature extraction module is used to input the filtered feature tensors into the trained intrusion detection model, and extract the deep space features for intrusion detection through stacked multi-layer convolution, activation and pooling operations, and output a one-dimensional deep feature vector. The prediction output module is used to input the one-dimensional deep feature vector into the fully connected layer and the Softmax activation function, output the probability distribution of the vehicle network intrusion type, and obtain the detection result.

8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, The memory stores a computer program that can run on a processor. When the processor loads and executes the computer program, it employs the end-to-end vehicle network intrusion detection method based on a learnable mask, as described in any one of claims 1 to 6.

9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the end-to-end vehicle network intrusion detection method based on a learnable mask as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, is used to load and execute the end-to-end vehicle network intrusion detection method based on a learnable mask as described in any one of claims 1 to 6.