Intrusion detection method and system based on Pearson-Bi-MobileNet

By applying the Pearson-Bi-MobileNet model in intrusion detection, combined with data preprocessing and feature selection, combined with the BLRA self-attention mechanism and depth-separable convolution, the computational overhead of deep learning intrusion detection methods in resource-constrained environments is solved. problem, achieving efficient network intrusion detection.

CN118779871APending Publication Date: 2024-10-15SHANGHAI UNIVERSITY OF ELECTRIC POWER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410794520.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-10-15

Smart Images

  • Figure CN118779871A_ABST
    Figure CN118779871A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of lightweight intrusion detection and edge networks, in particular to an intrusion detection method and system based on Pearson-Bi-MobileNet. Intrusion data is collected, data preprocessing is carried out, and a training set and a test set are divided; the intrusion data character features are coded, and a sampling method of synthetic minority class oversampling and VAE are used to generate minority sample data to complete data set balance; performing pearson feature selection on the data set, and determining the number of features needing to be trained; and adding a self-attention mechanism BLRA in the mobilenet, and performing classification test on the intrusion detection model trained by the training data set by using the test data set. Feature selection is carried out on the data, and effective features are well reserved. Compared with a simple convolutional network, the bi-mobilenet has the advantages that the number of parameters is smaller, the precision is higher, and lightweight network intrusion detection can be carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of lightweight intrusion detection and edge network technology, and specifically to an intrusion detection method and system based on Pearson-Bi-MobileNet. Background Art

[0002] Intrusion detection refers to the process of analyzing the activities of a computer network or system in order to identify potential malicious behavior or illegal operations. Its main goal is to promptly detect and respond to various types of security threats, including but not limited to malware, network attacks, unauthorized access, etc., so as to protect the integrity, availability and confidentiality of information systems. Intrusion detection systems can usually be classified according to factors such as their detection methods, data sources, and deployment locations

[36] . The following are some common classification methods:

[0003] (1) Detection method

[0004] Signature-based detection: This method uses predefined patterns or features to identify known attack patterns, similar to anti-virus software, which relies on the characteristics of known malicious code. Anomaly-based detection: This method identifies potential attacks or abnormal activities by building a model of normal behavior and detecting behaviors that deviate significantly from the model. It is suitable for detecting unknown attacks and changes.

[0005] (2) Classification of data sources

[0006] Host-based Intrusion Detection Systems (HIDS) run on a single host, monitoring and analyzing logs and activities generated by the host to detect potential intrusions. Network-based Intrusion Detection Systems (NIDS) monitor network traffic and detect potential intrusions on the network.

[0007] (3) Deployment location

[0008] Inline Intrusion Detection Systems are directly embedded in the network traffic path and can detect and block potential intrusions in real time. Out-of-band Intrusion Detection Systems run on the side of network traffic, analyzing copies or logs to detect and analyze intrusions, but do not directly affect the transmission of traffic.

[0009] The main application scenario of convolutional networks is the image field. The data object of intrusion detection is network traffic. The data form of the network is text and numerical. Applying convolutional neural networks to intrusion detection requires converting network traffic into image form. Inappropriate conversion methods will lead to feature loss. The convolution operation of convolutional neural networks is very expensive and lacks the ability to extract global features. At the same time, convolutional neural networks tend to use multi-level stacked convolution modules to extract features, which causes the intrusion detection method based on convolutional neural networks to occupy too many system resources, which limits the application scenarios of intrusion detection methods based on convolutional neural networks. Summary of the invention

[0010] In view of the above-mentioned problems, the present invention is proposed.

[0011] Therefore, the technical problem solved by the present invention is that the existing deep learning intrusion detection method has too high computational overhead and occupies too many resources in an environment with limited computing resources, while the intrusion detection system based on machine learning algorithm is not effective in complex network traffic detection.

[0012] To solve the above technical problems, the present invention provides the following technical solutions: an intrusion detection method based on Pearson-Bi-MobileNet, comprising: collecting network traffic data and intrusion data set data, performing data preprocessing, and dividing the data set into a training set and a test set; using the SMOTE algorithm to balance the network traffic data set; performing feature selection on the training set data, and using the Person correlation coefficient feature selection algorithm to remove features from the data set, removing only a small number of features, thereby retaining most of the effective features; performing customized combination optimization on the lightweight self-attention mechanism BLRA and the deep separable convolution in the Mobilenet network to obtain a lightweight neural network Bi-MobileNet, applying it to intrusion detection to obtain an intrusion detection method based on Pearson-Bi-MobileNet, and using the test data set to perform classification test on the intrusion detection model trained with the training data set.

[0013] As a preferred solution of the intrusion detection method based on Pearson-Bi-MobileNet described in the present invention, the data preprocessing includes removing missing values ​​and abnormal values ​​in the data set and digitizing the data set;

[0014] Suppose a data set D contains non-numeric features N and numerical features V. For the non-numeric feature N, one-hot encoding is applied to convert it into a binary space vector E. For the numerical feature V, the MIN-MAX scaling method is used for normalization to obtain the normalized feature V′.

[0015]

[0016] After the data set is preprocessed, it is necessary to divide the training set and the test set into D=D 测试 +D 训练 .

[0018] As an intrusion detection method based on Pearson-Bi-MobileNet described in the present invention, wherein: the SMOTE algorithm includes using a hybrid sampling method of SMOTE synthesized minority class oversampling to complete data set balancing;

[0019] SMOTE sampling technology selects several random points around a certain item in the minority class in N-dimensional space, adds the distance between this item and any other items, and then obtains a new minority class item. SMOTE does not perform dimensionality transformation. When the amount of data is too small, there are few points that can be processed, and the generated new data is not ideal and prone to overfitting. The advantage is that it is processed on the original data set to fit the original data to the maximum extent.

[0020] SMOTE oversampling first digitizes the data set, then obtains a small number of samples X[x1,x2,...xn] of the data set, where the number of samples is n, each sample is x, and then traverses the entire sample, and calculates the k (k can be obtained based on experiments) points closest to xi in X in turn, using Euclidean distance, which is a common method in distance measurement and is usually used to calculate the absolute distance between each point in multidimensional space. The formula is as follows:

[0021]

[0022] If the two vectors are normalized, the meaning of Euclidean distance is the same as cosine similarity. Then oversample each xi and first randomly select the vector at a distance from x. i Select a point from the nearest m points, and then get the new point x according to the formula new , repeat the operation as many times as needed.

[0023] x new =x i +rand(0,1)*|x i -x select |

[0024] As an intrusion detection method scheme based on Pearson-Bi-MobileNet described in the present invention, wherein: the Person correlation coefficient feature selection algorithm includes using the person correlation coefficient for feature selection to prevent overfitting of network training.

[0025] Assume that the data set has a total of 42 features. According to the calculation results of the Pearson coefficient, since the Pearson correlation coefficient reflects a linear relationship, only the least relevant features can be deleted to reduce the neural network calculation time. For the data set, the features with the smallest Pearson correlation coefficient are selected for deletion. Since the input data is converted into a two-dimensional representation, it is best that the height and width are equal, so that the number of remaining features is 36, so 6 features are chosen to be deleted.

[0026] As an intrusion detection method scheme based on Pearson-Bi-MobileNet described in the present invention, wherein: the lightweight self-attention mechanism BLRA includes, the BLRA attention mechanism Bi-Level-Routing-Attention is a lightweight self-attention operation method, which performs self-attention operation by selecting several regions with the largest correlation coefficient of the QK matrix in the input. The principle of BLRA is to calculate the adjacency matrix of QK by multiplying the QK matrix once, and then select the k regions with the highest attention for self-attention operation. The calculation steps are:

[0027] (1) For an input matrix X, X∈RHWC, use an S×S region to divide the H×W image, and the size of each grid is S×S. There are a total of (H×W) / (S×S) grids, so the entire matrix is

[0028] (2) The three matrices q, k, and v also have this shape. Then Wq, Wk, Wv∈RCxC. The average value of the second dimension of q and v is obtained, and the shape of A is S2×S2. Then, by taking the largest first k values, we get the area that needs to be self-attentioned. Then, the selected k areas are aggregated for parallel operation. Finally, the self-attention of k areas is calculated. The size of each area is S×S

[0029] As an intrusion detection method based on Pearson-Bi-MobileNet described in the present invention, wherein: the lightweight neural network Bi-MobileNet is selected to design a lightweight deep learning network Mobile-BIVIT with very low computational overhead by combining MobileNet and BLRA self-attention mechanism, so that it can be deployed on a lightweight computing platform without the need for network compression;

[0030] (1) Basic computing module of Bi-MobileNet: The advantage of MobileNet network is that it uses depthwise separable convolution to replace the original ordinary convolution, which reduces the computational complexity of convolution operation. Therefore, the model proposed in this paper uses depthwise separable convolution as its basic module. However, the global feature extraction capability of convolution network is relatively weak. This is due to the computational characteristics of convolution itself. The field of view of convolution operation depends on the size of convolution kernel. Global features can be obtained through large convolution kernel or pooling operation, but the computational overhead will be very large. Better global features can also be obtained by stacking multiple layers of convolution. Considering that the application object of this paper is 12×12 size image, the number of convolution layers is not large. In order to keep the network structure relatively small and the operation speed relatively fast, the model proposed in this paper uses self-attention mechanism to extract global features. The self-attention mechanism itself is to calculate the global elements once, which is similar to the correlation. At the same time, because it is a global calculation, the computational complexity is relatively large. However, compared with using multi-layer convolution to extract global features, the self-attention operation is much smaller and the quality of extracted features is better and more comprehensive.

[0031] (2) Number of network layers of BI-Mobilenet: For the original MobileNet, the input accepted is a 224×224 image. Considering the application scenario of intrusion detection, the image size after network traffic conversion is usually 12×12. The data volume of the two is very different. In order to reduce unnecessary calculations, the number of layers of biMobilenet should be much smaller than that of MobileNet.

[0032] (3) The composition order of the Bi-Mobilenet network: When the self-attention module and the convolution module form a neural network, the position of the self-attention layer in the network may affect the effect of feature extraction. At the beginning of the network, the length and width of the input data are the largest. After passing through the convolution layer, the HW of the matrix will become smaller. As the network operation proceeds, the image becomes smaller and smaller. The lightweighting of the self-attention module BLRA used here is based on the image size. Therefore, the image cannot be too small, otherwise the lightweight effect of the self-attention will be weakened. However, if it is placed in the first layer, the features have not been convolved and the local features are not obvious. Therefore, it is a better choice to place the self-attention layer closer to the middle of the entire network.

[0033] An intrusion detection system based on Pearson-Bi-MobileNet using any of the methods described in the present invention, comprising: a data acquisition module, a data processing module, a feature selection module, a network training and detection module;

[0034] Data collection module, which collects data from network traffic or log files;

[0035] The data processing module uses the SMOTE algorithm to balance the collected data set and determine the number of balanced data samples;

[0036] The feature selection module performs feature selection on the data set, including calculating the person correlation coefficient of various samples, determining the number of selected features, and verifying the selection results through experiments;

[0037] The network training and detection module uses the lightweight neural network Bi-MobileNet to analyze and process the processed data set to detect potential intrusion behaviors.

[0038] A computer device comprises: a memory and a processor; the memory stores a computer program, wherein the processor implements the steps of a method described in an intrusion detection method based on Pearson-Bi-MobileNet when executing the computer program.

[0039] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the method described in the intrusion detection method based on Pearson-Bi-MobileNet are implemented.

[0040] Beneficial effects of the present invention: The intrusion detection method based on Pearson-Bi-MobileNet provided by the present invention applies lightweight computer vision models to the field of intrusion detection. In terms of processing, Pearson feature selection is performed on the data to prevent network overfitting. Compared with simple convolutional networks, Bi-MobileNet has fewer parameters and higher accuracy. Under the condition of ensuring a certain accuracy, Bi-MobileNet is tailored to enable lightweight network intrusion detection. Compared with traditional linear intrusion detection systems, the model proposed in this study has better performance and stronger generalization ability. Compared with existing lightweight intrusion detection models, it has shorter calculation time and less computing resource overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0042] Figure 1An overall flow chart of an intrusion detection method based on Pearson-Bi-MobileNet provided for the first embodiment of the present invention.

[0043] Figure 2 A lightweight neural network Bi-MobileNet network structure diagram of an intrusion detection method based on Pearson-Bi-MobileNet provided in the first embodiment of the present invention.

[0044] Figure 3 A method step diagram of an intrusion detection method based on Pearson-Bi-MobileNet provided in the first embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0046] Example 1

[0047] Reference Figure 1-Figure 3 , as an embodiment of the present invention, provides an intrusion detection method based on Pearson-Bi-MobileNet, including:

[0048] S1: Collect network traffic data and intrusion data set data, perform data preprocessing, and divide them into training sets and test sets.

[0049] Furthermore, the data preprocessing includes: using a MIN-MAX scaling method in numerical data preprocessing to reduce the data to a specific interval [0,1], performing normalization processing, and using label coding in character data preprocessing;

[0050] Perform MIN-MAX scaling on the numerical feature V to obtain normalized features, which helps to avoid problems such as inefficient model training or difficult convergence due to large differences in feature value ranges.

[0051] Label encoding converts a categorical variable into a numeric type by assigning a value to each category. For example, if there is a column [dog, cat, dog, mouse, cat], it is converted to [1, 2, 1, 3, 2]. This produces a strange phenomenon: the average value of dog and mouse is cat. Therefore, the most intuitive disadvantage of label encoding is that the assignment is difficult to explain and its application scenarios are narrower.

[0052] For the imbalanced distribution problem in the data set, the VAE method is used to balance. First, a minority sample is selected. The number of samples is n. A VAE encoder is created using Python. The autoencoder model is mainly composed of two parts: encoder and decoder. The preprocessed data x of the minority sample is input into the VAE for training. After obtaining the relevant parameters, the network parameters are saved. A random sample is input into the trained VAE network to obtain a generated sample. Then, various minority samples are generated to obtain the generated sample.

[0053] S2: Use the SMOTE algorithm to balance the network traffic dataset.

[0054] The data set is divided into training data set, test data set, and validation data set. The method used is hold-out. In order to ensure the consistency of data distribution, stratified sampling is usually used to sample the data. The training set, validation set, and test set are divided as follows: 60% training set, 20% validation set, and 20% test set. Only a small part is needed as the test set and validation set, and the rest are used as the training set. Then use the training set to generate the model, the validation set to select the model, and finally use the test set to test the accuracy and error of the model to verify the effectiveness of the model. This method is common in tasks such as decision trees, naive Bayes classifiers, linear regression, and logistic regression. Disadvantages: Only one division is performed, and the data results are accidental.

[0055] Divide the original training data set into K non-overlapping sub-data sets, and then perform K model training and validation. Each time, use a sub-data set to validate the model, and use the other K-1 sub-data sets to train the model. Finally, average the K training errors and validation errors. Specific steps: Cross validation is to divide an entire data set into K parts on average. First take the first subset data as the test set, and the remaining K-1 subset data as the training set. Then take the second subset data as the test set, and the remaining K-1 subset data as the training set. Repeat this process K times. Then take a weighted average of the results obtained as the final evaluation result. Advantages: Reduce the randomness caused by a random division, improve its generalization ability, and improve the efficiency of data use. Encode the character features of the data, and use adversarial learning to balance the data set. Here we choose the K-fold cross validation method.

[0056] It should be noted that the present invention proposes a novel data processing and balancing method by combining label coding, MIN-MAX scaling and VAE technology. This method not only optimizes the representation of data, but also solves the problem of data imbalance through innovative adversarial learning strategies, thereby improving the accuracy and robustness of the model on complex data sets. In addition, the method of the present invention has a wide range of application prospects. It is not only suitable for network intrusion detection, but also can be extended to other machine learning tasks that need to process unbalanced data sets. Through this method, the generalization ability and performance of the model can be effectively improved while ensuring data quality, providing a new solution for the field of machine learning and data science.

[0057] S3: Pearson correlation system feature selection, feature selection of data sets, reducing the number of features, thereby reducing network calculation time, and inputting the data after feature selection into the neural network. Reducing the number of features will prevent dimensionality disasters and reduce training time; enhance the generalization ability of the model and reduce overfitting; enhance the understanding of features and feature values.

[0058] Furthermore, the feature selection includes, after calculating the Pearson system and classification categories for the feature values ​​of each type, sorting them according to size, selecting 1, 2, 3, n feature values ​​in turn for elimination, and then performing classification tests on the data set after eliminating the feature values, obtaining corresponding test results, and drawing a curve graph to obtain which feature elimination value is the best for a specific data set;

[0059] Furthermore, after obtaining the optimal feature value, the data set is feature eliminated, and then k-fold cross classification is performed, and the training data set is input into the neural network.

[0060] Furthermore, after the neural network training is completed, the parameters with the best classification effect are taken, and then the test data is input into the saved neural network to obtain the classification result.

[0061] Furthermore, the steps of the Pearson feature selection operation are for two vectors: X:{x 1 ,x 2 ,...x n},Y{y 1 ,y 2 ...y n}, the steps include:

[0062] First, the overall mean of vector X is:

[0063]

[0064] Then find the overall mean of vector Y:

[0065]

[0066] Then the overall covariance of vector X and vector Y is:

[0067]

[0068] The overall Pearson correlation coefficient of vector X and vector Y is:

[0069]

[0070] All features are sorted according to the overall Pearson correlation coefficient, and features with relatively low Pearson correlation coefficients are selected and eliminated, and then the remaining features are subjected to the next step of data processing and neural network training.

[0071] It should be noted that the data is processed using a deep separable convolutional neural network (CNN) to extract spatial features. BLRA layer: After the convolution layer, a self-attention mechanism is applied to process sequence data or consider features in the time dimension to capture the dynamic characteristics of the data. Model training: The model combining deep classifiable convolution and BLRA attention mechanism is trained on the training set, with the goal of learning how to accurately classify or predict based on the features in the image data.

[0072] It should be noted here that the depthwise convolution and pointwise convolution of the depthwise separable convolutional network. The depthwise separable convolution groups convolutions in the feature dimension, performs independent depthwise convolution on each channel, and uses a 1x1 convolution (pointwise convolution) to aggregate all channels before output.

[0073] Depthwise convolution can be understood as channel-wise convolution. For the input matrix, there are as many convolution kernels as there are channels. Each convolution kernel is responsible for one channel, and the number of output channels is the same as the number of input channels. Point-wise convolution is a convolution with an ordinary convolution kernel of one. The following is a comparison of the difference in computational complexity between ordinary convolution and depthwise separable convolution (here taking two-dimensional convolution as an example). Assume that the length and width of the input size are both F, the number of input channels is M, the length and width of the output are both P, the number of output channels is N, and the length and width of the convolution kernel are both set to k:

[0074] (1) The computational complexity of standard convolution: If the standard convolution kernel is used for convolution, the computational complexity should be Flops = (k2*M)*P2N

[0075] (2) Convolution is performed in a depth-separable manner. First, channel-wise convolution is performed on each dimension of the input matrix. The output shape is P2M, because each output element is obtained by one convolution. The computational complexity of one convolution is k2, and the computational complexity of this step is k2*P*P*M. Then, a convolution kernel with a length and width of 1 is used to perform point-by-point convolution to obtain the output. The output of this step is P*P*N, and the computational complexity of each convolution is 1x1xM. Therefore, the computational complexity of this step is FLOPs=P2*M*N. The total computational complexity is P2k2M+P2MN

[0076] (3) Therefore, by dividing the two computational amounts, we can get the ratio of depthwise separable convolution to standard convolution as shown in the following formula. Since N is generally large, if a 3x 3 convolution kernel is used, depthwise separable convolution can reduce the amount of computation by about 9 times compared to standard convolution. In addition to reducing the amount of computation, depthwise separable convolution only requires fewer parameters to train the model.

[0077]

[0078] S4: Input the data after feature selection into bi-mobilenet, and use the test data set to perform classification test on the intrusion detection model trained with the training data set.

[0079] Furthermore, the Bi-MobileNet network: The structure of the Bi-MobileNet network is as follows Figure 2As shown in the figure, the preprocessing layer consists of a convolutional layer, BatchNorm2d and Relu6. The main function of the convolutional layer is to convert the input single-channel matrix from CHW to 3-channel 3×CHW, and extract certain local features. BatchNorm2d can accelerate the training of neural networks. At the same time, BatchNorm2d can be used as a regularization technology to help reduce the risk of overfitting of the model and improve the generalization ability of the model. The computational complexity of ReLU6 is relatively small and is suitable for scenarios with limited resources.

[0080] The convolution layer is mainly composed of four InvertedResidual layers. The size of the convolution kernel is 1 for only the second one, and 2 for the rest. After two layers of InvertedResidual, enough local features have been extracted. Then, they are input into a self-attention layer composed of BLRA, and then passed through another convolution layer, and finally the classification result is output.

[0081] Furthermore, the BLRA mechanism includes: Bi-Level-Routing-Attention is a lightweight self-attention operation method, which performs self-attention operation by selecting several regions with the largest QK matrix correlation coefficient in the input. The principle of BLRA is to calculate the adjacency matrix of QK by multiplying the QK matrix once, and then select the k regions with the highest attention for self-attention operation.

[0082] Furthermore, the self-attention mechanism is a calculation method in the network. Its full name is Multi-Head Attention. The purpose of the self-attention mechanism calculation is to obtain the attention value. The calculation method is as follows:

[0083]

[0084] Among them, Q, K, and V are three matrices, which are obtained by performing three linear transformations on the input vector X. Among them, dk refers to the dimension of the input vector. The purpose of dividing by the square root of dk here is to perform a normalization-like operation on the product of the Q and K matrices to prevent the value of the input Softamx from being too large, which would cause the partial derivative to approach 0.

[0085] It should be noted that the present invention provides a new solution for the field of network intrusion detection through the design of a lightweight bi-mobilenet model and the introduction of a self-attention mechanism. Compared with traditional deep learning models, the present invention significantly reduces the complexity and computational requirements of the model while maintaining high accuracy, and is particularly suitable for resource-constrained environments. In addition, the application of the self-attention mechanism enables the model to better understand the inherent correlation and structure of image data, providing strong support for detecting complex network attack behaviors. These innovations not only promote the development of network security technology, but also provide new ideas for the design of deep learning models.

[0086] During the neural network training process, the Adam optimizer is also used. The advantage is that the learning rate step size and gradient direction can be effectively controlled through the first-order momentum and second-order momentum to prevent the gradient from oscillating and standing still at the saddle point.

[0087] Adam's update rule is as follows:

[0088] Calculate the gradient at time t, where is the gradient update function;

[0089] m0 is initialized to 0. Similar to the Momentum algorithm, it takes into account the gradient momentum of the previous time step. The β1 coefficient is an exponential decay rate, which controls the weight distribution (first-order momentum) and usually takes a value close to 1. The default value is 0.9, g t is the historical gradient, so we get mt

[0090] m t =β 1 m t-1 +(1-β 1 ) t

[0091] Calculate the exponential moving average of the squared gradient, v0 is initialized to 0, the β2 coefficient is the exponential decay rate, which controls the influence of the previous squared gradient (second-order momentum), similar to the RMSProp algorithm, and performs a weighted average on the squared gradient, with a default value of 0.999, so that v is obtained. t

[0092]

[0093] Since m0 is initialized to 0, mt will be biased towards 0, especially in the early stages of training. Therefore, it is necessary to correct the deviation of the gradient mean mt to reduce the impact of the deviation on the early stages of training.

[0094]

[0095] Similar to m0, because v0 is initialized to 0, vt is biased towards 0 in the initial stage of training, which needs to be corrected.

[0096]

[0097] Update the parameters, the initial learning rate α is multiplied by the ratio of the gradient mean to the square root of the gradient variance, where the default learning rate α=0.001, ε=10^-8 to avoid the divisor becoming 0.

[0098]

[0099] θ t This is the updated parameter, θ t-1 is the parameter of the previous moment

[0100] On the other hand, this embodiment also provides an intrusion detection system based on Pearson-Bi-MobileNet, including a data acquisition module, a data processing module, a feature selection module, and a network training and detection module;

[0101] Data collection module, which collects data from network traffic or log files;

[0102] The data processing module uses the SMOTE algorithm to balance the collected data set and determine the number of balanced data samples;

[0103] The feature selection module performs feature selection on the data set, including calculating the person correlation coefficient of various samples, determining the number of selected features, and verifying the selection results through experiments;

[0104] The network training and detection module uses the lightweight neural network Bi-MobileNet to analyze and process the processed data set to detect potential intrusion behaviors.

[0105] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0106] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0107] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0108] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0109] Example 2

[0110] The following is an embodiment of the present invention, which provides an intrusion detection method based on Pearson-Bi-MobileNet. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.

[0111] In order to verify the application effect of the lightweight computer vision model Bi-MobileNet in the field of network intrusion detection, a comparative experiment was designed to compare the performance differences between Bi-MobileNet and traditional convolutional neural networks (CNN) and existing lightweight intrusion detection models. The experiment selected the public network intrusion detection dataset CICIDS-2017, which contains normal traffic data and various network attack data, and is suitable for evaluating the performance of intrusion detection models.

[0112] The original network traffic data in the CICIDS-2017 dataset is converted into images. For numerical features, MIN-MAX normalization is used; for categorical features, label-coding is used. Then, feature selection is performed on the data to obtain the processed data.

[0113] The BLRA lightweight self-attention mechanism is added to the mobilenet model to meet the needs of network intrusion detection. The model training uses the feature selected dataset, and the goal is to minimize the classification error and improve the recognition accuracy of network attacks. The traditional CNN model with a similar number of parameters is selected as the comparison group and trained in the same way to evaluate its performance on the network intrusion detection task. An existing lightweight intrusion detection model is selected as another comparison group to evaluate its performance. The classification accuracy, computing time and resource overhead of each model are evaluated using the test set data. The evaluation indicators include accuracy, recall, F1 score, model size, inference time, etc. The specific results are shown in Table 1.

[0114] Table 1 Comparison of model classification accuracy

[0115]

[0116] Table 2 Comparison of model calculation costs

[0117]

[0118] From the above table data, it can be clearly seen that the Pearson-Bi-MobileNet model proposed in this study shows significant advantages in network intrusion detection tasks. Compared with traditional CNN models and existing lightweight intrusion detection models, Pearson-Bi-MobileNet not only achieves higher scores in accuracy, recall and F1 score, but also shows obvious advantages in model size and inference time. This shows that Pearson-Bi-MobileNet has less computing resource consumption and faster processing speed while ensuring high accuracy.

[0119] The lightweight neural network model is applied to the field of intrusion detection. In terms of processing, the data is directly converted into images, and the original features are well preserved during the conversion process. Compared with simple convolutional networks and networks based on self-attention mechanisms, Pearson-Bi-MobileNet has fewer parameters and higher accuracy. Under the condition of ensuring a certain accuracy, Pearson-Bi-MobileNet can perform lightweight network intrusion detection.

[0120] Compared with traditional linear intrusion detection systems, the model proposed in this study has better performance and stronger generalization ability, and compared with existing lightweight intrusion detection models, it has shorter computation time and less computational resource overhead.

[0121] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. An intrusion detection method based on Pearson-Bi-MobileNet, characterized in that: include: Collect network traffic data and intrusion data set data, perform data preprocessing, and divide them into training sets and test sets; The SMOTE algorithm is used to balance the network traffic data set; Perform feature selection on the training set data and use the Person correlation coefficient feature selection algorithm to eliminate features from the data set; The lightweight self-attention mechanism BLRA and the deep separable convolution in the Mobilenet network are customized and combined to obtain the lightweight neural network Bi-MobileNet, which is applied to intrusion detection. An intrusion detection method based on Pearson-Bi-MobileNet is obtained, and the test data set is used to perform classification test on the intrusion detection model trained with the training data set.

2. The intrusion detection method based on Pearson-Bi-MobileNet as claimed in claim 1, characterized in that: The data preprocessing includes: the network traffic data set includes character type, numerical type, and binary type, among which the binary type is regarded as the numerical type, the character type is encoded by labelcoding, and the MIN-MAX scaling method is used for all processed data to reduce the data to a specific interval [0,1] for normalization.

3. The intrusion detection method based on Pearson-Bi-MobileNet as claimed in claim 2, characterized in that: The SMOTE algorithm completes the data set balance by SMOTE-random oversampling to balance the data set. The random oversampling is represented by copying the minority class in the data set and adding it to the original data set. SMOTE is used to balance the data set. The data set D is a network traffic data set. The data set is first digitized, and then the sample X[x1,x2,...xn] of the data set D is obtained. The number of samples is n, and each sample is x. The entire sample is traversed, and the number of samples from x in X is calculated in turn. i The nearest k points, using Euclidean distance, and then for each x i Oversampling is performed by first randomly sampling at a distance x i Select a point from the nearest m points and get the new point x according to the formula new , and obtain a new data set D'.

4. The intrusion detection method based on Pearson-Bi-MobileNet as claimed in claim 3, characterized in that: The Person correlation coefficient feature selection algorithm performs feature elimination on the data set, calculates the Pearson correlation coefficient between various features in the network traffic and the classification features, obtains the Pearson value, selects the feature with the smallest Pearson value and deletes it, and obtains the network traffic data set after feature selection.

5. The intrusion detection method based on Pearson-Bi-MobileNet as claimed in claim 4, characterized in that: The depthwise separable convolution in the Mobilenet network splits the standard convolution into depthwise convolution and pointwise convolution. The depthwise convolution is a channel-wise convolution. For the input matrix, the number of channels is the same as the convolution kernel, each convolution kernel is responsible for one channel, and the number of output channels is the same as the number of input channels; and the pointwise convolution is a convolution with an ordinary convolution kernel of one. The following is a comparison of the difference in the amount of computation between ordinary convolution and depthwise separable convolution. The length and width of the input size are H and W, the number of input channels is M, the length and width of the output are h and w, the number of output channels is N, and the length and width of the convolution kernel are set to k. The computational amount of the standard convolution is expressed as, using the standard convolution kernel for convolution, the computational amount is expressed as, Flops=(k 2 *M)*(h×w) 2 N Convolution is performed in a depth-separable manner. First, channel-wise convolution is performed, and convolution is performed on each dimension of the input matrix. The output shape is hw 2 M, because each output element is obtained by one convolution, and the computational complexity of one convolution is k 2 , the calculation amount is k 2 *h*w*M; then use the convolution kernel with length and width of 1 to perform point-by-point convolution to get the output, the output is h*w*N, the calculation amount of each convolution is 1x1xM; the calculation amount is expressed as, FLOPs=(h×w) 2 *M*N The total amount of computation is expressed as, (h×w) 2 k 2 M+P 2 MN Dividing the two calculations, we can get the ratio of depth-separable convolution to standard convolution, expressed as, 6. The intrusion detection method based on Pearson-Bi-MobileNet as claimed in claim 5, characterized in that: The lightweight self-attention mechanism BLRA includes: Bi-Level-Routing-Attention is a lightweight self-attention operation method, which performs self-attention operation by selecting the region with the largest correlation coefficient of the QK matrix in the input. The principle of BLRA is to calculate the adjacency matrix of QK by multiplying the QK matrix once, and select the k regions with the highest attention for self-attention operation. The calculation steps are: For an input matrix X, X∈RHWC, use an S×S area to divide the H×W size picture, the size of each grid is S×S, there are a total of (H×W) / (S×S) grids, then the entire matrix is ​​expressed as, q, k, v are three-dimensional vectors, then Wq, Wk, Wv∈RCxC. The second dimension of q and v is averaged, and the shape of A is S2×S2. The largest first k values ​​are taken to obtain the area that needs self-attention. The selected k areas are aggregated to facilitate parallel operations. Finally, the self-attention of the k areas is calculated. The size of each area is S×S.

7. The intrusion detection method based on Pearson-Bi-MobileNet as claimed in claim 6, characterized in that: The lightweight neural network Bi-MobileNet consists of three parts, where the preprocessing layer consists of a convolutional layer, BatchNorm2d, and Relu6, and the depthwise separable convolutional layer converts the input single-channel matrix from CHW to 3-channel 3CHW to extract local features.

8. A system using the Pearson-Bi-MobileNet-based intrusion detection method according to any one of claims 1 to 7, characterized in that: Including data acquisition module, data processing module, feature selection module, network training and detection module; Data collection module, which collects data from network traffic or log files; The data processing module uses the SMOTE algorithm to balance the collected data set and determine the number of balanced data samples; The feature selection module performs feature selection on the data set, including calculating the person correlation coefficient of various samples, determining the number of selected features, and verifying the selection results through experiments; The network training and detection module uses the lightweight neural network Bi-MobileNet to analyze and process the processed data set to detect potential intrusion behaviors.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

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