A method and device for industrial control network intrusion detection based on knowledge distillation

By encoding network traffic data into grayscale images and using knowledge distillation technology to train the lightweight MobileViT model, it solves the problems of insufficient feature extraction and high computational complexity in existing industrial control network intrusion detection methods, achieving high accuracy and low cost. Complexity of intrusion detection.

CN118233222BActive Publication Date: 2024-09-10ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410651566.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-10
Estimated Expiration
2044-05-24

AI Technical Summary

Technical Problem

Existing industrial control network intrusion detection methods are difficult to fully mine the timing characteristics of traffic data, resulting in a high misjudgment rate. In addition, the deep learning model has high computational complexity and strict hardware requirements, which limits its application.

Method used

Adopt a method based on knowledge distillation to encode network traffic data into grayscale images, use pre-trained large models and CNN-BiLSTM models as teacher models, train lightweight MobileViT models through knowledge distillation technology, and combine projection layers and cross-entropy losses , optimize the training process of the student model to ensure that the model is lightweight and has high detection accuracy.

Benefits of technology

While ensuring the lightweight model, it improves the detection accuracy of industrial control network intrusion detection, reduces hardware performance requirements, effectively mines data features, reduces training consumption, and improves the accuracy of intrusion detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118233222B
    Figure CN118233222B
Patent Text Reader

Abstract

The present invention discloses an industrial control network intrusion detection method based on knowledge distillation. The method uses a pre-trained large model as a main teacher model and a neural network model as an auxiliary teacher model. The network traffic data is converted into a grayscale image to train the main teacher model. The auxiliary teacher model is trained using the network traffic data. The loss function is set so that the student model can learn knowledge from the feature extraction, label prediction and real label of the main teacher model. The auxiliary teacher model only participates in the distillation loss calculation. The auxiliary teacher model corrects the prediction error of the main teacher model, which is equivalent to pruning the distillation process. The training consumption is effectively reduced while retaining most of the effects. The effect of multi-teacher distillation is achieved at a cost similar to that of single-teacher distillation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intrusion detection, and in particular to an industrial control network intrusion detection method and device based on knowledge distillation. Background Art

[0002] Once the industrial control network is attacked, it may cause production interruption, equipment damage, and even cause safety accidents. Therefore, timely and effective detection and defense of network attacks is an important topic in the field of network security. As an effective means of attack protection, network intrusion detection can detect abnormal network traffic data and then protect against network attack behaviors, and is receiving more and more attention.

[0003] Deep learning is a machine learning algorithm that simulates the human brain neural network. In recent years, it has achieved remarkable results in image recognition, speech recognition, natural language processing and other fields. Its application in network intrusion detection has also attracted widespread attention. Since deep learning can automatically learn and extract features from a large amount of data, it is regarded as an effective intrusion detection technology for industrial control networks. However, deep learning technology also has some problems, such as the need for a large amount of labeled data, high computational complexity of the model, and high requirements for hardware equipment, which to some extent limits its application in industrial control network intrusion detection.

[0004] Current industrial control network intrusion detection methods cannot fully exploit the characteristics of traffic data, such as:

[0005] "An Industrial Control Network Intrusion Detection Method Based on 1D CNN-BiSRU" (Application No. CN202211667151.3) proposes a neural network architecture based on CNN-SRU to perform industrial control network intrusion detection. The disadvantage is that 1D CNN is used to extract network traffic features, making it difficult for the neural network to capture the temporal relationship of traffic data, resulting in misjudgment;

[0006] "A method and system for industrial control network intrusion detection based on deep learning" (application number CN202311342868.5) proposes a CNN-LSTM-based network architecture for industrial control network intrusion detection. The disadvantage is that CNN is first used to extract the spatial features of the data, and then LSTM is used to extract the temporal features of the data. The time series of industrial control network traffic data is related in terms of spatial and temporal features. The method of extracting spatial and temporal features separately will weaken this connection and cannot fully mine the data features. Summary of the invention

[0007] In view of the problems existing in the prior art, the purpose of the embodiments of the present application is to provide an industrial control network intrusion detection method and device based on knowledge distillation.

[0008] According to a first aspect of an embodiment of the present application, a method and device for industrial control network intrusion detection based on knowledge distillation are provided, including:

[0009] Obtaining network traffic data and its corresponding actual labels, and encoding the network traffic data into a grayscale image, thereby obtaining a training set;

[0010] Using the training set to fine-tune the pre-trained large model to obtain a main teacher model, using the network traffic data and the corresponding actual labels to train the neural network model to obtain an auxiliary teacher model, and respectively obtain the corresponding first label vector and second label vector;

[0011] Based on the knowledge distillation technology, the main teacher model and the auxiliary teacher model are used to assist in the training of the student model, wherein the distillation loss is calculated based on the first label vector, the second label vector and the third label vector output by the student model, the feature loss is calculated based on the features output by the projection layer in the main teacher model and the student model, and the student loss is calculated based on the third label vector and the corresponding actual label, thereby obtaining the total loss during training;

[0012] Obtain the traffic data of the industrial control network to be tested and convert it into a grayscale image to be tested;

[0013] The trained student model is used to classify the grayscale image to be tested, so as to determine whether the industrial control network to be tested has been invaded.

[0014] Furthermore, network traffic data is obtained and encoded into grayscale images to obtain a training set, including:

[0015] Get the network traffic dataset;

[0016] Each piece of network traffic data in the network traffic data set is cut, the first 1024 bytes are retained, and 0x00 is added to the end of the bytes less than 1024 bytes;

[0017] The intercepted data is converted into a grayscale image in binary form, that is, each byte corresponds to a grayscale pixel value.

[0018] Furthermore, before training the student model, a projection layer is added to the main teacher model and the student model respectively, the third label vector about the grayscale image is obtained through the student model, and the loss between the features output by the projection layers of the teacher model and the student model is calculated as the feature loss.

[0019] Furthermore, the ViT model is adopted as the main teacher model, the CNN-BiLSTM model is adopted as the auxiliary teacher model, the MobileViT model is adopted as the student model, a projection layer is set after the Transformer encoder layer of the main teacher model, and a projection layer is set after the first MobileViT block of the student model.

[0020] Furthermore, during the training of the student model:

[0021] For the features output by the projection layer in the main teacher model and the student model, the feature loss is calculated using the mean square error function;

[0022] Softening the first label vector and the third label vector and calculating the cross entropy loss to obtain a first distillation loss;

[0023] Softening the second label vector and the third label vector and calculating the cross entropy loss to obtain a second distillation loss;

[0024] Softening the third label vector and performing cross entropy loss calculation on the third label vector and the corresponding actual label to obtain the student loss;

[0025] The feature loss, the first distillation loss, the second distillation loss and the student loss are weightedly summed to obtain a total loss, and a round of training of the student model is completed based on the total loss.

[0026] Furthermore, the first label vector and the third label vector are softened and the cross entropy loss is calculated to obtain a first distillation loss, which is specifically:

[0027] Use distillation temperature Softmax function

[0028]

[0029] The first label vector and the third label vector are softened, where is the value of each element in the first label vector and the third label vector before softening, are the values ​​of each element in the first label vector and the third label vector after softening;

[0030] The cross entropy loss of the softened first label vector and the third label vector is calculated and recorded as the first distillation loss.

[0031] Furthermore, the second label vector and the third label vector are softened and the cross entropy loss is calculated to obtain the second distillation loss, which is specifically:

[0032] Use distillation temperature Softmax function

[0033]

[0034] The second label vector and the third label vector are softened, where To soften the values ​​of each element in the second label vector and the third label vector, are the values ​​of each element in the second label vector and the third label vector after softening;

[0035] The cross entropy loss of the softened second label vector and the third label vector is calculated and recorded as the second distillation loss.

[0036] Furthermore, the third label vector is softened, and a cross entropy loss is calculated between it and the corresponding actual label to obtain the student loss, which is specifically:

[0037] Use distillation temperature Softmax function is used to soften the third label vector;

[0038] The softened third label vector is cross-entropy-lossed with the corresponding actual label, which is recorded as student loss.

[0039] According to a second aspect of an embodiment of the present application, a computer program product is provided, comprising a computer program / instruction, which implements the method described in the first aspect when executed by a processor.

[0040] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including:

[0041] one or more processors;

[0042] A memory for storing one or more programs;

[0043] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the first aspect.

[0044] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.

[0045] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0046] It can be seen from the above embodiments that the present application proposes an industrial control network intrusion detection method, which converts industrial control traffic data into image data, constructs a learning system including a main teacher model, an auxiliary teacher model and a student model, utilizes the advantages of the ViT pre-trained large model as the main teacher model, utilizes the advantages of CNN-BiLSTM as a time series model as an auxiliary teacher model, and uses the lightweight MobileViT as the student system to learn the feature extraction and soft label knowledge of the main teacher system, uses the auxiliary teacher model as an aid to the soft label knowledge of the main teacher model, and uses the student system as the final detection model, thereby ensuring the lightweight of the model while obtaining the feature extraction capability and detection accuracy of the teacher model.

[0047] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0049] Figure 1 The present invention is a flowchart of an industrial control network intrusion detection method according to an exemplary embodiment.

[0050] Figure 2 is a schematic diagram of a main teacher model according to an exemplary embodiment.

[0051] Figure 3 is a schematic diagram of a student model according to an exemplary embodiment.

[0052] Figure 4 The present invention is a block diagram of an industrial control network intrusion detection device according to an exemplary embodiment.

[0053] Figure 5 The diagram is a schematic diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0054] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0055] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0056] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0057] Step S1: Obtain network traffic data and encode it into a grayscale image , thus obtaining the training set;

[0058] Specifically, the network traffic data is encoded into a grayscale image and used as the input for fine-tuning the pre-trained large model. The specific encoding method is:

[0059] S11: Obtain a network traffic dataset, such as the KDD99 dataset and the CICIDS2017 dataset, where different labels are encoded using one-hot encoding.

[0060] S12: Cut the network traffic data, keep the first 1024 (32*32) bytes, and add 0x00 to the end if the bytes are less than 1024 bytes. Because the network traffic data varies in length, in order to unify the size of the generated images, this paper intercepts and supplements the network traffic data to make their length uniform to 1024 bytes. The reason for intercepting the header bytes is that the bytes in the header of the network traffic data are generally flags such as traffic identifiers, which can better reflect the characteristics of the network traffic compared to the middle and end of the data.

[0061] S13: Convert the intercepted data into a grayscale image in binary form, that is, each byte corresponds to a grayscale pixel value, such as 0x00 corresponds to black and 0xff corresponds to white, and then output the image in png format.

[0062] The above encoding method encodes the network traffic data visually, retains the spatiotemporal sequence information of the network traffic data, and better retains the data accuracy; at the same time, it unifies the data length and only uses the more representative part of the data, making the subsequent classification more lightweight.

[0063] S2: using the training set to fine-tune the pre-trained large model to obtain a main teacher model, using the network traffic data and the corresponding actual labels to train the neural network model to obtain an auxiliary teacher model, and respectively obtaining the corresponding first label vector and second label vector;

[0064] Knowledge distillation is a model compression technology that aims to transfer the knowledge learned from a complex model (teacher model) to a small model (student model). The core idea of ​​knowledge distillation is to use the teacher model as an intermediary to transfer the knowledge it has learned on the data to the student model in a non-explicit way. Through such model compression, the computing resources occupied can be greatly reduced during deployment, while minimizing the loss of model performance. This technology is widely used in scenarios such as mobile devices and embedded systems that have strict restrictions on model size and computational complexity. Considering that the computational complexity of multi-teacher distillation is too large, this application uses two teacher models. The main computational complexity is on the main teacher model, and the auxiliary teacher model only participates in the distillation loss calculation, which is equivalent to pruning the distillation process. It effectively reduces the training cost while retaining most of the effects. In other words, the effect of multi-teacher distillation is achieved at a cost similar to that of single-teacher distillation. This step includes the following sub-steps:

[0065] S21: Using input data, i.e. grayscale image And the corresponding actual labels train the main teacher model , for the input data Get about The first label vector .

[0066] For the main teacher model, such as Figure 2 As shown, this application uses the ViT model.

[0067] When the input enters the ViT model, the model processes it as follows:

[0068] (1) Linear projection layer. The model divides the input image into non-overlapping image blocks and performs linear mapping on each image block to obtain a set of tensors.

[0069] (2) Position embedding layer. Since ViT does not follow the innate position information of the convolutional layer, it is necessary to explicitly add position information. For each tensor, ViT adds a code representing the position information of the image block in the original image.

[0070] (3) Transformer encoder layer. This layer contains multiple identical Transformer encoders, each of which is mainly composed of two sublayers: multi-head self-attention and feedforward neural network. The multi-head self-attention sublayer performs self-attention calculations on the input tensor with position encoding to capture long-range dependencies; the feedforward sublayer performs nonlinear transformations on the attention output to further fuse and filter information; layer normalization (Layer Norm) and residual connections are applied between the two sublayers to improve model stability.

[0071] (4) The final tensor passes through a classification head and is decoded into the first label vector for image classification.

[0072] The cross entropy function is used to calculate the loss when the teacher model is trained. , compare the difference between the predicted label and the actual label:

[0073]

[0074] in is the number of samples, is the number of categories, : If the sample The true label is If yes, it takes 1, otherwise it takes 0. :sample Belongs to category The predicted probability of .

[0075] S22: Use the network traffic data and the corresponding actual label to train the auxiliary teacher model to obtain the corresponding second label vector .

[0076] For the auxiliary teacher model, this application selects the CNN-BiLSTM model, uses the network traffic data and the corresponding actual labels to train the CNN-BiLSTM model, and obtains a second label vector corresponding to the network traffic data after the training is completed.

[0077] S3: Based on the knowledge distillation technology, the main teacher model and the auxiliary teacher model are used to assist in the training of the student model, wherein the distillation loss is calculated based on the first label vector, the second label vector and the third label vector output by the student model, the feature loss is calculated based on the features output by the projection layer in the main teacher model and the student model, and the student loss is calculated based on the third label vector and the corresponding actual label, thereby obtaining the total loss during training;

[0078] Specifically, a projection layer is added to the main teacher model and the student model. Get the grayscale image The third label vector , calculate the loss between the features of the projection layer output of the main teacher model and the student model, the loss between the first label vector and the third label vector, and the loss between the second label vector and the third label vector, and perform the student model training.

[0079] For the student model, Figure 3 As shown, this application uses the MobileViT model.

[0080] for Figure 1 To input the image, do the following steps:

[0081] (i) Perform a 3×3 standard convolution on the input image;

[0082] (ii) Passing through the MobileNetV2 block three times and performing 2x downsampling; MobileNetV2 is a lightweight CNN network proposed by the Google team in 2018. It uses an inverted residual structure and a linear bottleneck, and has higher accuracy and smaller size than MobileNetV1.

[0083] (iii) Interval through MobileNetV2 block and MobileViT block, repeat three times, and perform 2x downsampling;

[0084] (iv) Channel compression using 1×1 convolution;

[0085] The classification vector of the student model can be obtained through channel compression.

[0086] Specifically, the training process of MobileViT is:

[0087] (i) Perform a 3×3 standard convolution on the input image. To keep the input and output dimensions consistent, the convolution uses a padding of 1 and a stride of 1. In this step, the input dimension is 32×32 and the output dimension is 32×32;

[0088] (ii) Pass through the MobileNetV2 block three times and perform 2x downsampling. The input tensor needs to pass through three convolution layers in MobileNetV2, namely 1×1 expansion layer, 3×3 depthwise convolution and 1×1 projection layer. In the 1×1 expansion layer, the number of channels of the input tensor is expanded by the expansion factor, and the activation function uses ReLU6. In the 3×3 depthwise convolution, the number of channels of the input tensor remains unchanged. This layer filters the tensor, and the activation function uses ReLU6. In the 1×1 projection layer, the number of channels of the input tensor is compressed and no activation function is used. The input dimension of this step is 32×32, and the output dimension is 16×16.

[0089] (iii) Repeat three times by passing through the MobileNetV2 block and the MobileViT block, and do a 2x downsampling. In the MobileViT block, the input tensor X[H,W,C] Using an n×n convolution and a 1×1 convolution, we get X ' [H,W,d] , where n×n convolution is used to learn local spatial information and 1×1 convolution is used to project input features into high-dimensional space. X ' [H,W,d] Expand to X '' [P,N,d] , and then input transformer to extract global space information, and get Y '' [P,N,d] Refold to Y ' [P,N,d] ,in , is the number of patches. Y ' [P,N,d] Use 1×1 convolution to restore Y ' [H,W,C] , with the initial input tensor X[H,W,C] Do splicing to get the output Y[H,W,C] This step is completed X[H,W,C]→Y[H,W,C] The input dimension of the mapping is 16×16 and the output dimension is 8×8.

[0090] (iv) Use 1×1 convolution for channel compression. The input dimension of this step is 8×8 and the output dimension is 8×8.

[0091] During training:

[0092] S31: Calculate feature loss for features output by projection layers in the main teacher model and the student model using a mean square error function;

[0093] In this embodiment, a projection layer is set after the Transformer encoder layer of the main teacher model, and a projection layer is set after the first MobileViT block of the student model to project the features extracted from the two models to the same dimension. Then the feature loss is calculated using the mean square error function for the two projected features. .

[0094] S32: Soften the first label vector and the third label vector and calculate the cross entropy loss to obtain a first distillation loss ;

[0095] Specifically, for and , using distillation temperature Softmax function

[0096]

[0097] To soften the label vector. is the value of each element of the original label vector. When is the ordinary Softmax function, The larger the value, the smaller the value of each element in the softened label vector. The closer. Then the cross entropy loss of the two softened label vectors is calculated and recorded as the first distillation loss This data represents the gap between the predictions of the student model and the main teacher model.

[0098] S33: Soften the second label vector and the third label vector and calculate the cross entropy loss to obtain the second distillation loss ;

[0099] Specifically, for and , using distillation temperature Softmax function

[0100]

[0101] To soften the label vector. is the value of each element of the original label vector. When is the ordinary Softmax function, The larger the value, the smaller the value of each element in the softened label vector. The closer. Then the cross entropy loss of the two softened label vectors is calculated and recorded as the second distillation loss This data represents the prediction gap between the student model and the auxiliary teacher model.

[0102] S34: Soften the third label vector and calculate the cross entropy loss between it and the corresponding actual label to obtain the student loss. ;

[0103] for ,use The ordinary Softmax function is used to soften the label vector, and then the softened label vector is compared with the actual label vector encoded by one-hot encoding to perform cross entropy loss calculation, which is recorded as the student loss . This data represents the prediction gap between the student model and the actual label.

[0104] S35: performing weighted summation on the feature loss, the first distillation loss, the second distillation loss and the student loss to obtain a total loss, and completing a round of training of the student model based on the total loss;

[0105] Specifically, for the loss and , perform weighted summation to obtain the total distillation loss :

[0106]

[0107] in is the first distillation loss, is the second distillation loss, the weight of the two and .

[0108] For loss , and , perform weighted summation and get the total loss :

[0109]

[0110] in is the feature loss, is the total distillation loss, is the student loss, the weight of the three and .

[0111] By setting the above loss function, the student model can learn knowledge from the feature extraction, label prediction and true label of the main teacher model, and the auxiliary teacher model can correct the prediction errors of the main teacher model. As the weight changes, the proportion of knowledge learned from different positions also changes.

[0112] The total loss is used for back propagation to update the parameters of the student model, completing a round of training.

[0113] The student model learns the knowledge of a more complex teacher model while remaining lightweight and can be used as a model for practical applications.

[0114] S3: Obtain the flow data of the industrial control network to be tested and convert it into a grayscale image to be tested;

[0115] Specifically, the flow data of the industrial control network to be detected is obtained. Because the network flow data varies in length, in order to unify the size of the generated image, the network flow data is intercepted and supplemented to make their length unified to 1024 bytes. The reason for intercepting the header bytes is that the bytes in the header of the network flow data are generally flags such as identifiers, which can better reflect the network flow characteristics compared to the middle and rear parts of the data, and can also retain the spatiotemporal sequence information of the network flow data.

[0116] For the intercepted 1024 bytes of data, each byte corresponds to a grayscale pixel value, such as 0x00 corresponds to black and 0xff corresponds to white, and the grayscale image to be tested is obtained.

[0117] S4: using the trained student model to classify the grayscale image to be tested, so as to determine whether the industrial control network to be tested is invaded;

[0118] Specifically, the classification process is as follows:

[0119] (i) Perform a 3×3 standard convolution on the input image. To keep the input and output dimensions consistent, the convolution uses a padding of 1 and a stride of 1. In this step, the input dimension is 32×32 and the output dimension is 32×32;

[0120] (ii) Pass through the MobileNetV2 block three times and perform 2x downsampling. The input tensor needs to pass through three convolution layers in MobileNetV2, namely 1×1 expansion layer, 3×3 depthwise convolute and 1×1 projection layer. In the 1×1 expansion layer, the number of channels of the input tensor is expanded by the expansion factor, and the activation function uses ReLU6. In the 3×3 depthwise convolution, the number of channels of the input tensor remains unchanged. This layer filters the tensor and uses ReLU6 as the activation function. In the 1×1 projection layer, the number of channels of the input tensor is compressed and no activation function is used. The input dimension of this step is 32×32 and the output dimension is 16×16.

[0121] (iii) The network is passed through the MobileNetV2 block and the MobileViT block three times at intervals, and then downsampled by a factor of 2. In the MobileViT block, an n×n convolution and a 1×1 convolution are applied to the input tensor X[H,W,C] to obtain X^' [H,W,d], where the n×n convolution is used to learn local spatial information and the 1×1 convolution is used to project the input features into a high-dimensional space. X^' [H,W,d] is then expanded to X^'' [P,N,d], and then input into the transformer to extract global spatial information to obtain Y^'' [P,N,d], which is then folded back to Y^' [P,N,d], where P = H×W and N is the number of patches. Finally, Y^' [P,N,d] is restored back to Y^' [H,W,C] using a 1×1 convolution, and concatenated with the initial input tensor X[H,W,C] to obtain the output Y[H,W,C]. This step completes the mapping from X[H,W,C]→Y[H,W,C], with an input dimension of 16×16 and an output dimension of 8×8.

[0122] (iv) Use 1×1 convolution for channel compression. The input dimension of this step is 8×8 and the output dimension is 8×8.

[0123] (v) Perform global average pooling. The input dimension of this step is 8×8 and the output dimension is 1×1.

[0124] (vi) Get the prediction results.

[0125] The advantages of this design are that MobileViT is used as the classification model, which achieves a lighter model size than the traditional ViT model as the main teacher model, thereby reducing the hardware performance requirements of the running device; compared with the traditional CNN model, the larger teacher model can better mine data features, and then transfer the mined knowledge to the student MobileViT model through distillation. After learning the knowledge of the teacher model, the student model can achieve higher accuracy; compared with the traditional knowledge distillation design, the addition of the auxiliary teacher model can help correct the errors of the main teacher model, so that the student model can obtain relatively objective and accurate knowledge; in addition, when training the student model, a loss is designed that is directly calculated at the feature extraction level, so that the student model can accurately learn the feature mining of the large teacher model to achieve higher prediction accuracy.

[0126] Corresponding to the aforementioned embodiment of the industrial control network intrusion detection method based on knowledge distillation, the present application also provides an embodiment of the industrial control network intrusion detection device based on knowledge distillation.

[0127] Figure 4 FIG. 1 is a block diagram of an industrial control network intrusion detection device according to an exemplary embodiment. Figure 4 , the device may include:

[0128] The training set construction module 21 is used to obtain network traffic data and its corresponding actual labels, and encode the network traffic data into a grayscale image to obtain a training set;

[0129] A training module 22 is used to train the student model based on the knowledge distillation technology using the feature extraction results and output results of the main teacher model, and to assist the training using the auxiliary teacher model;

[0130] The test data acquisition module 23 is used to acquire the flow data of the industrial control network to be tested and convert it into a grayscale image to be tested;

[0131] The intrusion detection module 24 is used to classify the grayscale image to be tested by using the trained student model, so as to determine whether the industrial control network to be tested is invaded.

[0132] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0133] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0134] Accordingly, the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements an industrial control network intrusion detection method based on knowledge distillation.

[0135] Accordingly, the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned industrial control network intrusion detection method based on knowledge distillation. Figure 5 As shown, it is a hardware structure diagram of any device with data processing capability where an industrial control network intrusion detection device provided by an embodiment of the present invention is located, except Figure 5 In addition to the processor, memory and network interface shown, any device with data processing capability in which the apparatus in the embodiment is located may also include other hardware, generally based on the actual functions of the device with data processing capability, which will not be described in detail.

[0136] Correspondingly, the present application also provides a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by the processor, the industrial control network intrusion detection method based on knowledge distillation as described above is implemented. The computer-readable storage medium can be an internal storage unit of any device with data processing capabilities described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium can also be an external storage device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card (Flash Card), etc. equipped on the device. Furthermore, the computer-readable storage medium can also include both an internal storage unit and an external storage device of any device with data processing capabilities. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capabilities, and can also be used to temporarily store data that has been output or is to be output.

[0137] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the contents disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0138] It will be appreciated that the present application is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof.

Claims

1. An industrial control network intrusion detection method based on knowledge distillation, characterized in that: include: Obtaining network traffic data and its corresponding actual labels, and encoding the network traffic data into a grayscale image, thereby obtaining a training set; Using the training set to fine-tune the pre-trained large model to obtain a main teacher model, using the network traffic data and the corresponding actual labels to train the neural network model to obtain an auxiliary teacher model, and respectively obtain the corresponding first label vector and second label vector; Based on the knowledge distillation technology, the main teacher model and the auxiliary teacher model are used to assist in the training of the student model, wherein the distillation loss is calculated based on the first label vector, the second label vector and the third label vector output by the student model, the feature loss is calculated based on the features output by the projection layer in the main teacher model and the student model, and the student loss is calculated based on the third label vector and the corresponding actual label, thereby obtaining the total loss during training; Obtain the traffic data of the industrial control network to be tested and convert it into a grayscale image to be tested; Using the trained student model to classify the grayscale image to be tested, so as to determine whether the industrial control network to be tested has been invaded; Before training the student model, a projection layer is added to the main teacher model and the student model respectively, the third label vector about the grayscale image is obtained through the student model, and the loss between the features output by the projection layers of the teacher model and the student model is calculated as the feature loss.

2. The method according to claim 1, characterized in that Obtain network traffic data and encode it into grayscale images to obtain a training set, including: Get the network traffic dataset; Each piece of network traffic data in the network traffic data set is cut, the first 1024 bytes are retained, and 0x00 is added to the end of the bytes less than 1024 bytes; The intercepted data is converted into a grayscale image in binary form, that is, each byte corresponds to a grayscale pixel value.

3. The method according to claim 1, characterized in that The ViT model is used as the main teacher model, the CNN-BiLSTM model is used as the auxiliary teacher model, and the MobileViT model is used as the student model. A projection layer is set after the Transformer encoder layer of the main teacher model, and a projection layer is set after the first MobileViT block of the student model.

4. The method according to claim 3, characterized in that During the training of the student model: For the features output by the projection layer in the main teacher model and the student model, the feature loss is calculated using the mean square error function; Softening the first label vector and the third label vector and calculating the cross entropy loss to obtain a first distillation loss; Softening the second label vector and the third label vector and calculating the cross entropy loss to obtain a second distillation loss; Softening the third label vector and performing cross entropy loss calculation on the third label vector and the corresponding actual label to obtain the student loss; The feature loss, the first distillation loss, the second distillation loss and the student loss are weightedly summed to obtain a total loss, and a round of training of the student model is completed based on the total loss.

5. The method according to claim 4, characterized in that The first label vector and the third label vector are softened and the cross entropy loss is calculated to obtain the first distillation loss, which is specifically: Use the Softmax function with distillation temperature T=t , Soften the first label vector and the third label vector, where z is the value of each element in the first label vector and the third label vector before softening, and q is the value of each element in the first label vector and the third label vector after softening; The cross entropy loss of the softened first label vector and the third label vector is calculated and recorded as the first distillation loss.

6. The method according to claim 4, characterized in that The second label vector and the third label vector are softened and the cross entropy loss is calculated to obtain the second distillation loss, which is specifically: Use the Softmax function with distillation temperature T=t , Soften the second label vector and the third label vector, where z' is the value of each element in the second label vector and the third label vector before softening, and q' is the value of each element in the second label vector and the third label vector after softening; The cross entropy loss of the softened second label vector and the third label vector is calculated and recorded as the second distillation loss.

7. The method according to claim 4, characterized in that The third label vector is softened, and the cross entropy loss is calculated with the corresponding actual label to obtain the student loss, which is: Softening the third label vector using a Softmax function with a distillation temperature T=1; The softened third label vector is cross-entropy-lossed with the corresponding actual label, which is recorded as student loss.

8. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

9. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.