Malicious traffic detection method for intelligent Internet of Things based on multi-scale convolutional neural network
Through the intelligent method of multi-scale convolutional neural network, the hyperparameters of the malicious traffic detection model are automatically adjusted, which solves the problem of the performance of the malicious traffic detection model deteriorating when the Internet of Things architecture changes in the existing technology, and improves scenario adaptability and detection results accuracy.
Patent Information
- Application Number
- CN202411359016.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-09-27
AI Technical Summary
The hyperparameter fixation of the existing malicious traffic detection model leads to a degradation in performance when the IoT architecture changes, and it is difficult for ordinary users to set appropriate hyperparameters for different architectures, resulting in poor scenario adaptability.
An intelligent method based on multi-scale convolutional neural network is adopted to sample hyperparameters according to performance indicators during training, and the model parameters are automatically adjusted until preset conditions are met, and a malicious traffic detection model suitable for the target IoT architecture is generated.
The scenario adaptability and performance of the malicious traffic detection model is improved, the number of iterations is reduced, and the adaptability hyperparameter determination is achieved for different IoT architectures is achieved, which improves the accuracy and efficiency of detection results.
Smart Images

Figure CN118890218B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and in particular to a method for detecting malicious traffic in an intelligent Internet of Things based on a multi-scale convolutional neural network. Background Art
[0002] When performing malicious traffic detection in the Internet of Things, technical personnel in related fields are required to set fixed hyperparameters for the malicious traffic detection model to be trained according to the Internet of Things architecture, and then train the malicious traffic detection model to be trained according to the specific data set under the Internet of Things architecture to obtain the malicious traffic detection model. Since the hyperparameters of the malicious traffic detection model are fixed, if the Internet of Things architecture used by the user changes, the malicious traffic detection model obtained according to the above method is often not applicable to the new Internet of Things architecture. In addition, the hyperparameters of the malicious traffic detection model need to be set manually, and setting different hyperparameters for the malicious traffic detection model for different Internet of Things architectures is also a highly professional task, that is, ordinary users cannot set appropriate hyperparameters for the malicious traffic detection model for different tasks, which results in the malicious traffic detection model having poor performance when performing malicious traffic detection on traffic data in the new Internet of Things architecture, that is, the malicious traffic detection model has poor scene adaptability. Summary of the invention
[0003] The purpose of the embodiment of the present application is to provide an intelligent IoT malicious traffic detection method based on a multi-scale convolutional neural network, so as to adaptively set appropriate hyperparameters for the malicious traffic detection model for different scenarios, so as to improve the scenario adaptability of the malicious traffic detection model. The specific technical solution is as follows:
[0004] The embodiment of the present application provides a method for detecting malicious traffic in an intelligent Internet of Things based on a multi-scale convolutional neural network, the method comprising:
[0005] Obtain the traffic data to be detected in the target IoT architecture;
[0006] Inputting the traffic data to be detected into a target malicious traffic detection model to obtain a malicious traffic detection result output by the target malicious traffic detection model;
[0007] The target malicious traffic detection model is trained by the following methods, including:
[0008] Acquire network traffic data in the target IoT architecture as sample data, and use a label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0009] For each of the multiple current hyperparameters, extract feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter, fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0010] Determine respectively the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as a performance indicator of each of the current hyperparameters;
[0011] According to the performance indicators of the current hyperparameters, predict the performance indicators of the candidate hyperparameters in the hyperparameter space, wherein the candidate hyperparameters are hyperparameters that have not been used as the current hyperparameters;
[0012] Sampling multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, returning to execute the step of extracting feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0013] Until a preset iteration end condition is met, a hyperparameter whose performance index meets the preset performance condition is searched in the hyperparameter space as a target hyperparameter;
[0014] Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results;
[0015] Inputting the sample data into the original malicious traffic detection model to obtain a prediction result output by the original malicious traffic detection model;
[0016] According to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model, and the step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end condition is met to obtain the target malicious traffic detection model.
[0017] In a possible embodiment, predicting the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes:
[0018] Predicting the performance indicators of the candidate hyperparameters in the hyperparameter space according to the performance indicators of the current hyperparameters, and obtaining the confidence of the predicted performance indicators;
[0019] The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes:
[0020] A plurality of candidate hyperparameters are sampled from each of the candidate hyperparameters as new current hyperparameters, wherein the probability of a candidate hyperparameter being sampled during sampling is positively correlated with a performance indicator of the candidate hyperparameter and negatively correlated with a confidence level of the performance indicator of the candidate hyperparameter.
[0021] In a possible embodiment, the obtaining of network traffic data in the target IoT architecture as sample data, and using a label of the network traffic data as a true value of the sample data, includes:
[0022] Obtain network traffic data in the target IoT architecture and labels of the network traffic data;
[0023] Perform sample enhancement on the network traffic data to obtain the network traffic data after sample enhancement as sample data, and use the label of the network traffic data after sample enhancement as the true value of the sample data; wherein the sample enhancement includes one or more of the following methods: image transformation, text replacement, hybrid sampling, and generative adversarial network.
[0024] In a possible embodiment, the performance indicator includes: a loss value;
[0025] The respectively determining the matching degree between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters includes:
[0026] Respectively determine the difference between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the loss value of each of the current hyperparameters;
[0027] The predicting of the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes:
[0028] According to the loss values of the current hyperparameters, predict the loss values of the candidate hyperparameters in the hyperparameter space;
[0029] The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes:
[0030] Sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, wherein during sampling, the probability of a candidate hyperparameter being sampled is negatively correlated with the loss value of the candidate hyperparameter;
[0031] The step of searching for a hyperparameter whose performance index satisfies the preset performance condition in the hyperparameter space until the preset iteration end condition is met as the target hyperparameter includes:
[0032] Until the preset iteration end condition is met, a hyperparameter whose loss value meets the preset loss value condition is searched in the hyperparameter space as the target hyperparameter.
[0033] In a possible embodiment, the performance indicators include: accuracy;
[0034] The respectively determining the matching degree between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters includes:
[0035] According to the true value of the sample data, respectively determine the accuracy of the malicious traffic detection result corresponding to each of the current hyperparameters as the accuracy rate of each of the current hyperparameters;
[0036] The predicting of the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes:
[0037] Predicting the accuracy of each candidate hyperparameter in the hyperparameter space according to the accuracy of each current hyperparameter;
[0038] The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes:
[0039] Sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, wherein the probability of a candidate hyperparameter being sampled during sampling is positively correlated with the accuracy of the candidate hyperparameter;
[0040] The step of searching for a hyperparameter whose performance index satisfies the preset performance condition in the hyperparameter space until the preset iteration end condition is met as the target hyperparameter includes:
[0041] Until the preset iteration end condition is met, a hyperparameter whose accuracy meets the preset accuracy condition is searched in the hyperparameter space as the target hyperparameter.
[0042] In a possible embodiment, the performance indicators include: regression rate;
[0043] The respectively determining the matching degree between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters includes:
[0044] Respectively determine the degree of overlap between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the regression rate of each of the current hyperparameters;
[0045] The predicting of the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes:
[0046] Predicting the regression rate of each candidate hyperparameter in the hyperparameter space according to the regression rate of each current hyperparameter;
[0047] The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes:
[0048] Sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, wherein the probability of a candidate hyperparameter being sampled during sampling is positively correlated with a regression rate of the candidate hyperparameter;
[0049] The step of searching for a hyperparameter whose performance index satisfies the preset performance condition in the hyperparameter space until the preset iteration end condition is met as the target hyperparameter includes:
[0050] Until the preset iteration end condition is met, a hyperparameter whose regression rate meets the preset regression rate condition is searched in the hyperparameter space as the target hyperparameter.
[0051] The present application also provides a method for generating a malicious traffic detection model, the method comprising:
[0052] Acquire network traffic data in the target IoT architecture as sample data, and use a label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0053] For each of the multiple current hyperparameters, extract feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter, fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0054] Determine respectively the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as a performance indicator of each of the current hyperparameters;
[0055] According to the performance indicators of the current hyperparameters, predict the performance indicators of the candidate hyperparameters in the hyperparameter space, wherein the candidate hyperparameters are hyperparameters that have not been used as the current hyperparameters;
[0056] Sampling multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, returning to execute the step of extracting feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0057] Until a preset iteration end condition is met, a hyperparameter whose performance index meets the preset performance condition is searched in the hyperparameter space as a target hyperparameter;
[0058] Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results;
[0059] Inputting the sample data into the original malicious traffic detection model to obtain a prediction result output by the original malicious traffic detection model;
[0060] According to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model, and the step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end condition is met to obtain the target malicious traffic detection model.
[0061] The present application also provides an intelligent IoT malicious traffic detection device based on a multi-scale convolutional neural network, the device comprising:
[0062] A module for acquiring traffic data to be detected, used to acquire traffic data to be detected in a target IoT architecture;
[0063] A malicious traffic detection result obtaining module is used to input the traffic data to be detected into a target malicious traffic detection model to obtain a malicious traffic detection result output by the target malicious traffic detection model;
[0064] The target malicious traffic detection model is trained by the following methods, including:
[0065] Acquire network traffic data in the target IoT architecture as sample data, and use a label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0066] For each of the multiple current hyperparameters, extract feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter, fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0067] Determine respectively the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as a performance indicator of each of the current hyperparameters;
[0068] According to the performance indicators of the current hyperparameters, predict the performance indicators of the candidate hyperparameters in the hyperparameter space, wherein the candidate hyperparameters are hyperparameters that have not been used as the current hyperparameters;
[0069] Sampling multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, returning to execute the step of extracting feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0070] Until a preset iteration end condition is met, a hyperparameter whose performance index meets the preset performance condition is searched in the hyperparameter space as a target hyperparameter;
[0071] Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results;
[0072] Inputting the sample data into the original malicious traffic detection model to obtain a prediction result output by the original malicious traffic detection model;
[0073] According to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model, and the step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end condition is met to obtain the target malicious traffic detection model.
[0074] The present application also provides a malicious traffic detection model generation device, the device comprising:
[0075] A sample data acquisition module is used to acquire network traffic data in a target IoT architecture as sample data, and use a label of the network traffic data as a true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0076] The detection result obtaining module is used to extract the feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, and to fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and to perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0077] A performance indicator determination module, used to respectively determine the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters;
[0078] A performance indicator prediction module, used to predict the performance indicator of each candidate hyperparameter in the hyperparameter space according to the performance indicator of each current hyperparameter, wherein the candidate hyperparameter is a hyperparameter that has not been used as the current hyperparameter;
[0079] A hyperparameter sampling module is used to sample multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, and return to execute the step of extracting feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0080] A target hyperparameter search module is used to search for a hyperparameter whose performance index meets a preset performance condition in the hyperparameter space until a preset iteration end condition is met, and use the hyperparameter as the target hyperparameter;
[0081] An original malicious traffic detection model generation module is used to generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and to fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and to perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results;
[0082] A prediction result obtaining module, used for inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model;
[0083] A model parameter adjustment module is used to adjust the model parameters in the original malicious traffic detection model according to the difference between the prediction result and the true value of the training sample data, and use the original malicious traffic detection model after the model parameter adjustment as a new original malicious traffic detection model, and repeatedly execute the step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model until the preset training end condition is met to obtain the target malicious traffic detection model.
[0084] The present application also provides an electronic device, including:
[0085] Memory, used to store computer programs;
[0086] The processor is used to implement any of the above-mentioned intelligent Internet of Things malicious traffic detection methods or malicious traffic detection model generation methods based on multi-scale convolutional neural networks when executing the program stored in the memory.
[0087] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-mentioned intelligent Internet of Things malicious traffic detection methods or malicious traffic detection model generation methods based on a multi-scale convolutional neural network.
[0088] Beneficial effects of the embodiments of the present application:
[0089] The intelligent Internet of Things malicious traffic detection method based on a multi-scale convolutional neural network provided in the embodiment of the present application can, in the process of training to obtain a target malicious traffic detection model, regard the performance index of each current hyperparameter as a true value, regard the performance index of each candidate hyperparameter as a predicted value, obtain the predicted value through the true value, and sample multiple new current hyperparameters from the candidate hyperparameters according to the predicted value to obtain the new performance index of the current hyperparameter, that is, obtain the new true value. Since the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter, that is, the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the predicted value, therefore, the true value of the candidate hyperparameter with a larger predicted value can be preferentially determined through the above sampling method, so that the predicted value can be corrected through the above iterative process, and the method of preferentially determining the true value of the candidate hyperparameter with a larger predicted value can increase the rate of determining the hyperparameter that meets the preset performance conditions, that is, increase the rate of determining the target hyperparameter, and determine a more accurate target hyperparameter while reducing the number of iterations. Since the performance index of the target hyperparameter meets the preset performance condition, the target hyperparameter can be considered as the preferred hyperparameter suitable for the target Internet of Things architecture. Under the target Internet of Things architecture, the network performance of the target malicious traffic detection model obtained by training according to the target hyperparameter and model parameters is good, and malicious traffic detection can be performed on the traffic data to be detected in the target Internet of Things architecture according to the target malicious traffic detection model to obtain a more accurate malicious traffic detection result. In addition, for different target Internet of Things architectures, only the sample data needs to be replaced, and the target hyperparameter can be determined by the malicious traffic detection model itself, so as to more accurately determine the target hyperparameter that can make the malicious traffic detection model have better performance in the target Internet of Things architecture model, and obtain a target malicious traffic detection model that is suitable for the target Internet of Things architecture and has better performance. It can be seen that the embodiment of the present application can realize the adaptive setting of appropriate hyperparameters for the malicious traffic detection model for different Internet of Things architectures, which can improve the scenario adaptability of the malicious traffic detection model.
[0090] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0092] Figure 1 A schematic diagram of a flow chart of a method for detecting malicious traffic in an intelligent Internet of Things based on a multi-scale convolutional neural network provided in an embodiment of the present application;
[0093] Figure 2 A schematic diagram of a structure of a machine learning model provided in an embodiment of the present application;
[0094] Figure 3a A schematic diagram of a flow chart of a method for generating a malicious traffic detection model provided in an embodiment of the present application;
[0095] Figure 3b Another flowchart of the method for generating a malicious traffic detection model provided in an embodiment of the present application;
[0096] Figure 4a A schematic diagram of a flow chart of a sample enhancement method provided in an embodiment of the present application;
[0097] Figure 4b A schematic diagram of an overall process of a method for detecting malicious traffic in an intelligent Internet of Things based on a multi-scale convolutional neural network provided in an embodiment of the present application;
[0098] Figure 5a A schematic diagram of a process for determining target hyperparameters provided in an embodiment of the present application;
[0099] Figure 5b Another schematic diagram of a process for determining target hyperparameters provided in an embodiment of the present application;
[0100] Figure 5c A schematic diagram of another process for determining target hyperparameters provided in an embodiment of the present application;
[0101] Figure 6 A schematic diagram of the structure of an intelligent IoT malicious traffic detection device based on a multi-scale convolutional neural network provided in an embodiment of the present application;
[0102] Figure 7 A schematic diagram of the structure of a malicious traffic detection device provided in an embodiment of the present application;
[0103] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0104] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0105] In order to more clearly explain the intelligent IoT malicious traffic detection method based on a multi-scale convolutional neural network provided by this application, some terms appearing in this article are explained below:
[0106] Deep learning: Deep learning is a branch of machine learning. Deep learning learns the representation of data through a neural network composed of multiple hidden layers. Compared with traditional machine learning methods, deep learning can automatically extract features from sample data without manually designing data features. Therefore, compared with traditional machine learning methods, deep learning, a deep-level feature learning method, can perform tasks better. Deep learning can be applied to many fields, such as computer vision, natural language processing, speech recognition, security detection and other fields.
[0107] Sample augmentation: Sample augmentation is a commonly used data preprocessing technique in machine learning. The main purpose of sample augmentation is to artificially generate more sample data by performing a series of reasonable transformations and amplifications on existing sample data, thereby improving the generalization ability of the model through diverse sample data. Common sample augmentation methods include: image transformation, text replacement, hybrid sampling, generative adversarial networks, etc.
[0108] Hyperparameter optimization: Hyperparameter optimization is a very important process in machine learning model training. Hyperparameters refer to parameters in machine learning models that cannot be learned through model training itself and need to be manually set or adjusted, such as learning rate, regularization coefficient, batch size, etc. Reasonable hyperparameter optimization can significantly improve the performance of machine learning models. Therefore, hyperparameter optimization is an indispensable and important step in the process of machine learning model generation. In addition, the parameters in machine learning models that can be learned through model training itself are referred to as model parameters below.
[0109] Bayesian Optimization: Bayesian optimization is an effective method for optimizing unknown objective functions. Bayesian optimization uses Bayesian statistical reasoning to build a probabilistic model of the objective function and decides which area to explore next based on this probabilistic model. Unlike traditional random search or grid search, Bayesian optimization learns the distribution of the objective function through Bayesian statistical reasoning based on existing observational data. In this way, Bayesian optimization can find a better balance between exploration and exploitation and find the global optimal solution more effectively. Bayesian optimization is an intelligent optimization technology based on a probabilistic model. By effectively balancing exploration and exploitation, it can find a better solution with fewer computing resources.
[0110] Multi-scale convolutional neural network: A multi-scale convolutional neural network is a convolutional neural network architecture used to process multi-scale inputs. The multi-scale convolutional neural network captures both detailed information and global information in the input data by using convolution kernels with different receptive field sizes in the network. In other words, the multi-scale convolutional neural network has the ability to extract multi-scale features. Therefore, the multi-scale convolutional neural network can learn both the detailed features and global semantic features of the input data in a unified network.
[0111] In order to more clearly illustrate the malicious traffic detection method for the intelligent Internet of Things based on a multi-scale convolutional neural network provided by the present application, the possible application scenarios of the malicious traffic detection method for the intelligent Internet of Things based on a multi-scale convolutional neural network provided by the present application will be exemplified below. It can be understood that the following examples are only possible application scenarios of the malicious traffic detection method for the intelligent Internet of Things based on a multi-scale convolutional neural network provided by the present application. In other possible embodiments, the malicious traffic detection method for the intelligent Internet of Things based on a multi-scale convolutional neural network provided by the present application can be applied to other possible application scenarios, and the following examples do not impose any restrictions on this.
[0112] In the application scenario of malicious traffic detection in IoT, the commonly used malicious traffic detection method is: collect network traffic data in the target IoT architecture and perform preprocessing, use principal component analysis and K-means clustering algorithm to automatically select data features of network traffic data, so as to reduce the feature space dimension of network traffic data and improve the accuracy of malicious traffic detection. One-dimensional convolutional neural network and long short-term memory network are used to extract spatial features and temporal dependency features of network traffic data respectively, and the spatial features and temporal dependency features are fused through adaptive feature fusion module, which effectively combines information of different dimensions. At the same time, the key parameters in the detection model can be automatically adjusted through TPE (Tree-structured ParzenEstimator, a hyperparameter optimization algorithm based on tree structure) to obtain the optimal detection model.
[0113] However, the above malicious traffic detection method mainly optimizes and adjusts the one-dimensional convolution combined with the long short-term memory network. The generalization ability of the detection model is weak, and malicious traffic detection is only based on one-dimensional features, which cannot cope with the more complex Internet of Things environment.
[0114] At present, the structures of the models used for malicious traffic detection in IoT are generally the following two:
[0115] (1) Static compact network model. The static compact network model needs to be adjusted and optimized for the data set itself. The model structure is relatively compact, the model training time is short, and it has strong feasibility and can be deployed on edge nodes. Static means that the hyperparameters in the model are fixed; compact refers to a model with low model complexity. Models with low model complexity have low generalization ability and can only be applied to a single scenario or a limited number of scenarios.
[0116] (2) Static universal unified model. The static universal unified model is a network model with a relatively large structure. Universal unified refers to a model with high model complexity. Models with high model complexity have strong generalization capabilities and can be applied to a variety of different scenarios.
[0117] However, both of the above model structures have certain problems in practical applications. The static compact network model will have problems with model transfer and parameter adjustment in practical applications. The static universal unified model will have problems with poor actual use effect and high training cost in practical applications.
[0118] The following will explain the above-mentioned problems and their causes respectively:
[0119] For the model transfer problem of the static compact network model, since the hyperparameters of the static compact network model are fixed and the structure is relatively compact, after setting efficient hyperparameters for the static compact network model according to a specific data set, the static compact network model has good performance on the data set, but often shows problems such as performance degradation on another data set, that is, the generalization of the static compact network model is poor. For example, the data generated by different IoT architectures are different. Suppose there are two different IoT architectures, namely IoT architecture 1 and IoT architecture 2. If efficient hyperparameters are set for the static compact network model according to the data set provided by IoT architecture 1, the static compact network model has a better effect on malicious traffic detection in IoT architecture 1 and a higher accuracy, while the static compact network model may have a poor effect on malicious traffic detection in IoT architecture 2 and a lower accuracy.
[0120] Regarding the parameter adjustment problem of the static compact network model, since the adjustment of hyperparameters needs to be done manually, and adjusting the hyperparameters of the static compact network model for a specific data set is a highly professional task, users who are not technical personnel in the field of deep learning or researchers who want to skip the process of adjusting hyperparameters may not be able to adjust a suitable hyperparameter for the static compact network model. Inappropriate hyperparameters will undoubtedly greatly reduce the detection capability of the static compact network model, making the static compact network model less effective in detecting malicious traffic in the Internet of Things.
[0121] For the static universal unified model, based on the actual application of the static universal unified model, it can be seen that a network model with a large structure does not necessarily have good performance on multiple data sets. In fact, the static universal unified model has poor performance and poor performance on some data sets. In addition, the static universal unified model is a deep network model. When training the static universal unified model, there are many model parameters that need to be trained and adjusted, which makes the training time of the static universal unified model longer and the training cost higher. In addition, the static universal unified model cannot be deployed on edge nodes, which reduces the security of the system.
[0122] Based on this, in order to adaptively set appropriate hyperparameters for malicious traffic detection models for different IoT architectures, so as to improve the scenario adaptability of malicious traffic detection models and reduce model training costs, this application provides an intelligent IoT malicious traffic detection method based on a multi-scale convolutional neural network, such as Figure 1 As shown, the method includes:
[0123] S101, obtaining traffic data to be detected in a target Internet of Things architecture.
[0124] S102, inputting the traffic data to be detected into a target malicious traffic detection model to obtain a malicious traffic detection result output by the target malicious traffic detection model.
[0125] The target malicious traffic detection model is trained by the following methods, including:
[0126] Obtain network traffic data in the target IoT architecture as sample data, and use the label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0127] For each of the multiple current hyperparameters, extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0128] Determine the matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the performance indicator of each current hyperparameter;
[0129] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, wherein the candidate hyperparameter is a hyperparameter that has not been used as the current hyperparameter;
[0130] Sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, returning to execute the step of extracting feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0131] Until the preset iteration end condition is met, the hyperparameter whose performance index meets the preset performance condition is found in the hyperparameter space as the target hyperparameter;
[0132] Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the target hyperparameter to obtain a malicious traffic detection result;
[0133] Input the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model;
[0134] According to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model. The step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end conditions are met to obtain the target malicious traffic detection model.
[0135] By using the embodiments of the present application, on the one hand, in the process of training to obtain the target malicious traffic detection model, the performance index of each current hyperparameter can be regarded as the true value, and the performance index of each candidate hyperparameter can be regarded as the predicted value, and the predicted value can be obtained through the true value, and multiple new current hyperparameters can be sampled from the candidate hyperparameters according to the predicted value to obtain the new performance index of the current hyperparameter, that is, the new true value is obtained. Since the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter, that is, the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the predicted value, therefore, the true value of the candidate hyperparameter with a larger predicted value can be preferentially determined through the above-mentioned sampling method, so that the predicted value can be corrected through the above-mentioned iterative process, and the method of preferentially determining the true value of the candidate hyperparameter with a larger predicted value can increase the rate of determining the hyperparameter that meets the preset performance conditions, that is, increase the rate of determining the target hyperparameter, and determine a more accurate target hyperparameter while reducing the number of iterations. Since the performance index of the target hyperparameter meets the preset performance condition, the target hyperparameter can be considered as the preferred hyperparameter suitable for the target Internet of Things architecture. Under the target Internet of Things architecture, the network performance of the target malicious traffic detection model obtained by training according to the target hyperparameter and model parameters is good, and malicious traffic detection can be performed on the traffic data to be detected in the target Internet of Things architecture according to the target malicious traffic detection model to obtain a more accurate malicious traffic detection result. In addition, for different target Internet of Things architectures, only the sample data needs to be replaced, and the target hyperparameter can be determined by the malicious traffic detection model itself, so as to more accurately determine the target hyperparameter that can make the malicious traffic detection model have better performance in the target Internet of Things architecture model, and obtain a target malicious traffic detection model that is suitable for the target Internet of Things architecture and has better performance. It can be seen that the embodiment of the present application can realize the adaptive setting of appropriate hyperparameters for the malicious traffic detection model for different Internet of Things architectures, which can improve the scenario adaptability of the malicious traffic detection model.
[0136] On the other hand, in the embodiment of the present application, there is no need for manual intervention, and the hyperparameters in the malicious traffic detection model can be automatically adjusted by determining the target hyperparameters, thereby improving the efficiency of adjusting the model hyperparameters. Compared with the method of manually adjusting the hyperparameters by users who are not technical personnel in the field of deep learning, the method of determining the target hyperparameters in the embodiment of the present application is more accurate and reliable. The target malicious traffic detection model includes a multi-scale feature extraction method, which can not only be used to process time series signals, but also can be better applied to multiple fields and has greater application prospects. At the same time, the setting of multi-scale feature extraction and the determination of target hyperparameters also make the target malicious traffic detection model have stronger generalization ability, can adaptively extract feature information of multiple scales, and select the optimal fusion strategy, so that the target malicious traffic detection model can better face the complex environment of the intelligent Internet of Things.
[0137] In order to facilitate the description of the intelligent IoT malicious traffic detection method based on a multi-scale convolutional neural network provided by the present application, the structure of the machine learning model will be first described exemplarily below. The hyperparameters and model parameters in the following machine learning model can be adjusted by the target malicious traffic detection model generation method provided by the present application to generate a target malicious traffic detection model.
[0138] The machine learning model is a network model with multi-scale feature extraction capabilities. The model structure of the machine learning model can be as follows: Figure 2 shown. Figure 2 The machine learning model shown is a multi-level neural network model with parallel branches. The machine learning model has multiple parallel processing branches, each branch has a receptive field of different sizes, which can be used to capture and process the feature information in the input data (i.e., sample data). Feature data of the input data at different scales can be extracted through different branches, and the abstraction and expression capabilities of the machine learning model can be improved by fusing the feature data at different scales. The size of the receptive field of different branches and the fusion method of feature data at different scales are both hyperparameters in the machine learning model. By adjusting the hyperparameters, the feature extraction capabilities of each branch of the machine learning model and the emphasis on feature data at different scales can be changed, so that the machine learning model can be made more versatile and applicable to a variety of different scenarios by adjusting the hyperparameters. The process of extracting feature data of input data at different scales through different branches is referred to as the branch capture stage below.
[0139] See also Figure 2 , each branch of the machine learning model includes four layers: Conv (convolution layer), Selu (activation function), BN (batch normalization), and Pool (pooling layer). Each branch extracts features from the input data and obtains feature data at different scales. The process can be expressed by the following formula (1):
[0140] ;
[0141] Among them, i is the channel number corresponding to each branch; x is the input data; The feature data obtained by branch i for feature extraction of input data x; Pool represents the pooling layer; BN represents batch normalization; Selu represents the activation function; Conv represents the convolutional layer.
[0142] In other possible embodiments, each branch of the machine learning model may also include three levels: Conv, Selu, and BN.
[0143] See again Figure 2 After the machine learning model obtains the feature data of the input data at different scales through different branch extractions, the Merged (fusion strategy) level can fuse the feature data at different scales according to the fusion strategy set by itself to obtain the fused feature data, and further extract the features of the fused feature data through the complete convolution layer to obtain the fused features. This process is referred to as the complete convolution stage below. Among them, the fusion strategy set in the Merged level may include strategies such as splicing and weighted calculation; the complete convolution layer includes four parts: Conv (convolution layer), Selu (activation function), BN (batch normalization) and Pool (pooling layer). The process of obtaining the fused features can be expressed by the following formula (2):
[0144] ;
[0145] Where x is the input data; M1 is the feature data obtained by branch 1 by extracting features from the input data x; M2 is the feature data obtained by branch 2 by extracting features from the input data x; M3 is the feature data obtained by branch 3 by extracting features from the input data x; Merged represents the function of the steps implemented by the fusion strategy level; is the fused feature data; is the fusion feature; Conv represents the function of the steps implemented by the convolutional layer.
[0146] After obtaining the fused features, the machine learning model inputs the fused features into two Dense (fully connected layers) and Softmax (classification layer) in sequence, infers the fused features, and uses the output of Softmax as the inference result of the machine learning model.
[0147] Figure 2 The structure of the machine learning model shown in can enable the machine learning model to better capture the multi-scale features in the input data by introducing convolution kernels with different receptive field sizes for each branch. It can be understood that Figure 2 This is only a possible structural diagram of a machine learning model. In other possible embodiments, the structural diagram of the machine learning model may also be the same as Figure 2 Differently, for example, the structure of the machine learning model may include two branches, or four branches, and so on.
[0148] The above has been combined Figure 2The example shown in the figure is an exemplary description of the structure of the machine learning model provided by the present application. Figure 2 The structure of the machine learning model shown in the figure is an exemplary description of the method of training the target malicious traffic detection model, see Figure 3a ,The target malicious traffic detection model generation method includes:
[0149] S301, obtaining network traffic data in the target Internet of Things architecture as sample data, and taking the label of the network traffic data as the true value of the sample data.
[0150] Among them, the label is used to characterize whether the network traffic data is malicious traffic.
[0151] S302, for each of the multiple current hyperparameters, extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter.
[0152] S303, respectively determining the matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the performance indicator of each current hyperparameter.
[0153] S304: predicting the performance indicators of the candidate hyperparameters in the hyperparameter space according to the performance indicators of the current hyperparameters.
[0154] Among them, the candidate hyperparameters are hyperparameters that have not been used as current hyperparameters.
[0155] S305, sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, returning to execute the step of extracting feature data at different scales of the sample data for each current hyperparameter in the multiple current hyperparameters according to the multi-scale feature extraction method indicated by the current hyperparameter.
[0156] Among them, the probability of a candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter.
[0157] S306, until the preset iteration end condition is met, searching in the hyperparameter space for a hyperparameter whose performance index meets the preset performance condition as the target hyperparameter.
[0158] S307, generating an original malicious traffic detection model according to the target hyperparameters.
[0159] Among them, the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and to fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain the fused features; and to perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain the malicious traffic detection results.
[0160] S308, input the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model.
[0161] S309, according to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model, and the step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end condition is met to obtain the target malicious traffic detection model.
[0162] The above S301-S309 will be described below by way of example:
[0163] In S301, the network traffic data in the target IoT architecture may include: normal traffic data and malicious traffic data in a certain IoT architecture, wherein the types of malicious traffic data include: brute force attempts, DDOS (Distribution Denial of Service) attacks, botnets, automated scripts, and the like.
[0164] The network traffic data and the label of the network traffic data in the target IoT architecture can be directly used as sample data and the true value of the sample data; after obtaining the network traffic data in the target IoT architecture, the network traffic data can be sample enhanced to obtain sample data, and the label of the sample data network traffic data after sample enhancement can be used as the true value of the sample data. How to perform sample enhancement on the network traffic data will be described below, and will not be repeated here.
[0165] The label of the network traffic data can identify whether the network traffic data is malicious traffic. For example, if the network traffic data is malicious traffic, the label of the network traffic data can be set to 1, and correspondingly, if the network traffic data is non-malicious traffic, that is, normal traffic, the label of the network traffic data can be set to 0; or, if the network traffic data is malicious traffic, the label of the network traffic data can be set to 0, and correspondingly, if the network traffic data is normal traffic, the label of the network traffic data can be set to 1.
[0166] In S302, as described above, hyperparameters refer to parameters in a machine learning model that cannot be learned through model training itself and need to be manually set or adjusted. Figure 2 In the machine learning model structure shown, the hyperparameters in the machine learning model may include: the number of convolution kernels, convolution kernel size, convolution kernel step, convolution kernel activation function, pooling layer size, and pooling layer step corresponding to each branch in the aforementioned branch capture phase; the fusion strategy, activation function, pooling layer size, and pooling layer step in the aforementioned complete convolution phase. In other words, the values in the current hyperparameters may be used to represent: the number of convolution kernels, convolution kernel size, convolution kernel step, convolution kernel activation function, pooling layer size, and pooling layer step corresponding to each branch in the aforementioned branch capture phase; the fusion strategy, activation function, pooling layer size, and pooling layer step in the aforementioned complete convolution phase.
[0167] See above Figure 2 In the machine learning model structure shown, if the values of hyperparameters such as the number of convolution kernels and the size of convolution kernels corresponding to a branch are different, then the feature extraction method corresponding to the branch is different. Therefore, the feature extraction method (i.e., the multi-scale feature extraction method) corresponding to each branch can be adjusted by setting the number of convolution kernels and the size of convolution kernels of each branch to the number and size of convolution kernels indicated in the current hyperparameters, that is, determining the multi-scale feature extraction method indicated by the current hyperparameters. For the fusion strategy layer, different hyperparameter values correspond to different fusion strategies. The hyperparameter values here refer to the values of some hyperparameters corresponding to the fusion strategy layer in the current hyperparameters. For example, when the hyperparameter value is 1, the fusion strategy is first-order concatenation, and when the hyperparameter value is 2, the fusion strategy is weighted addition, etc. Therefore, the fusion strategy (i.e., the feature fusion method) can be controlled by setting the hyperparameters of the fusion strategy layer to the current hyperparameters, that is, determining the feature fusion method indicated by the current hyperparameters. For the complete convolution stage (i.e., the stage of malicious traffic detection based on fusion features), Figure 2If the values of hyperparameters such as activation function, pooling layer size, and pooling layer step size in the subsequent activation function layer, pooling layer, and other network layers of the fusion strategy are different, the malicious traffic detection method corresponding to the complete convolution stage is different. Therefore, the malicious traffic detection method corresponding to the complete convolution stage can be determined by setting the hyperparameters such as activation function, pooling layer size, and pooling layer step size in the complete convolution stage as the current hyperparameters, that is, the malicious traffic detection method indicated by the current hyperparameters is determined. Therefore, the multi-scale feature extraction method, feature fusion method, and malicious traffic detection method indicated by the current hyperparameters can be characterized by the various values included in the current hyperparameters, and the sample data in the target scene can be feature extracted according to the multi-scale feature extraction method to obtain the feature data of the sample data at different scales; and the feature data at different scales can be feature fused according to the feature fusion method to obtain the fusion feature; and the fusion feature can be maliciously detected according to the malicious traffic detection method to obtain the malicious traffic detection result of the machine learning model on the sample data, that is, the malicious traffic detection result corresponding to the current hyperparameters is obtained.
[0168] Initially, the value of the current hyperparameter can be randomly selected in the hyperparameter space, or it can be determined by an experienced hyperparameter tuning personnel based on their own experience. In a possible implementation, 30 hyperparameters can be randomly selected in the hyperparameter space as the initial current hyperparameters. It is understandable that if the randomly selected hyperparameters, that is, the initial current hyperparameters, are closely spaced in the hyperparameter space, then when the performance indicators of the candidate hyperparameters are subsequently predicted based on the performance indicators of the current hyperparameters, there are more candidate hyperparameters that are far apart from the initial current hyperparameters in the hyperparameter space, and the accuracy of the predicted performance indicators of these candidate hyperparameters is low. Therefore, in order to maximize the accuracy of the performance indicators of the predicted candidate hyperparameters, in this implementation, the initial current hyperparameters should be spaced as far apart as possible in the hyperparameter space.
[0169] In S303, the malicious traffic detection result corresponding to the current hyperparameter is the inference result of the sample data by the machine learning model set with the current hyperparameter. The network performance of the machine learning model set with the current hyperparameter can be reflected by the degree of matching between the malicious traffic detection result corresponding to the current hyperparameter and the true value of the sample data, that is, the performance index of the current hyperparameter.
[0170] It can be understood that the higher the degree of match between the malicious traffic detection result corresponding to the current hyperparameter and the true value of the sample data, the better the network performance of the machine learning model set with the current hyperparameter, and the lower the degree of match between the malicious traffic detection result corresponding to the current hyperparameter and the true value of the sample data, the worse the network performance of the machine learning model set with the current hyperparameter. Therefore, there should be a positive correlation between the performance index of the current hyperparameter and the degree of match between the malicious traffic detection result corresponding to the current hyperparameter and the true value of the sample data. Since the degree of match between the malicious traffic detection result corresponding to the current hyperparameter and the true value of the sample data can be represented by different evaluation indicators, and the correlation between different evaluation indicators and the degree of match is different, correspondingly, the correlation between different evaluation indicators and the performance indicator of the current hyperparameter is different. Therefore, if the evaluation indicator is positively correlated with the degree of match, then different evaluation indicators can be directly used as the performance indicator of the current hyperparameter, such as accuracy, precision, etc.; if the evaluation indicator is negatively correlated with the degree of match, then the evaluation indicator may not be directly used as the performance indicator of the current hyperparameter, such as loss value, etc.
[0171] For example, if the evaluation indicator is accuracy, the higher the degree of match between the malicious traffic detection result corresponding to the current hyperparameter and the true value of the sample data, the greater the accuracy, and the better the network performance of the machine learning model set with the current hyperparameter, that is, the accuracy is positively correlated with the network performance of the machine learning model set with the current hyperparameter, and the accuracy is positively correlated with the performance indicator of the current hyperparameter, then the evaluation indicator can be directly used as the performance indicator of the current hyperparameter. If the evaluation indicator is loss value, the higher the degree of match between the malicious traffic detection result corresponding to the current hyperparameter and the true value of the sample data, the smaller the loss value, and the better the network performance of the machine learning model set with the current hyperparameter, that is, the loss value is negatively correlated with the network performance of the machine learning model set with the current hyperparameter, and the loss value is negatively correlated with the performance indicator of the current hyperparameter, then the evaluation indicator can be used directly as the performance indicator of the current hyperparameter.
[0172] In S304, since the performance indicator of the current hyperparameter is determined based on the degree of match between the malicious traffic detection result obtained by the machine learning model and the true value of the sample data, there is no need to predict the performance indicator of the current hyperparameter. Therefore, the candidate hyperparameter should be a hyperparameter in the hyperparameter space that has not been used as the current hyperparameter.
[0173] In a possible embodiment, a function with the hyperparameter as the independent variable and the performance indicator of the hyperparameter as the dependent variable can be fitted according to the performance indicator of each current hyperparameter, and each candidate hyperparameter in the hyperparameter space is respectively input into the function to predict the performance indicator of each candidate hyperparameter. In other possible embodiments, the function with the hyperparameter as the independent variable and the performance indicator of the hyperparameter as the dependent variable can be obtained by interpolation or the like instead of directly fitting.
[0174] In S305, the probability of a candidate hyperparameter being sampled is positively correlated with the performance index of the candidate hyperparameter during sampling, which means that if the network performance of the machine learning model with a certain candidate hyperparameter is better, that is, the performance index of the candidate hyperparameter is higher, the probability of the candidate hyperparameter being sampled is greater.
[0175] As described in the aforementioned S303, the correlation between different evaluation indicators and the performance indicator of the current hyperparameter is different. Therefore, when the performance indicator of the hyperparameter is characterized by different evaluation indicators, the correlation between different evaluation indicators and the probability of the candidate hyperparameter being sampled is different. Exemplarily, referring to the example in the aforementioned S303, if the evaluation indicator is a loss value, the loss value is negatively correlated with the performance indicator of the hyperparameter. Correspondingly, the probability of the candidate hyperparameter being sampled during sampling is negatively correlated with the loss value of the candidate hyperparameter. The smaller the loss value of a candidate hyperparameter, the better the network performance of the machine learning model with the candidate hyperparameter, and the greater the probability of the candidate hyperparameter being sampled. If the evaluation indicator is accuracy, the accuracy is positively correlated with the performance indicator of the hyperparameter. The accuracy is positively correlated with the performance indicator of the hyperparameter. Correspondingly, the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the accuracy of the candidate hyperparameter. The greater the accuracy of a candidate hyperparameter, the better the network performance of the machine learning model with the candidate hyperparameter, and the greater the probability of the candidate hyperparameter being sampled.
[0176] According to the probability of each candidate hyperparameter being sampled, multiple candidate hyperparameters are sampled as new current hyperparameters, and the above S302 is returned to be executed to obtain malicious traffic detection results corresponding to each new current hyperparameter. If the current hyperparameter is recorded as current hyperparameter 1, and the new current hyperparameter is recorded as current hyperparameter 2, when obtaining the malicious traffic detection results corresponding to each current hyperparameter 2, the sample data used can be the same as the sample data used when obtaining the malicious traffic detection results corresponding to the current hyperparameter 1, or it can be different, as long as the sample data used is the sample data in the target IoT architecture.
[0177] In S306, the above S302-S305 are repeatedly executed until the preset iteration end condition is reached. The preset iteration end condition may refer to the number of iterations being not less than the preset iteration number threshold, or may refer to the performance indicators of all current hyperparameters and the performance indicators of candidate hyperparameters, and the hyperparameter whose performance indicator meets the preset performance condition can be determined, or may refer to other preset iteration end conditions, and the present application does not impose any restrictions on this.
[0178] The preset performance condition may refer to a performance indicator being greater than a preset performance threshold, or may refer to a maximum performance indicator, and this application does not impose any restrictions on this. As described in the aforementioned S303 and S305 for the evaluation indicator and the performance indicator of the current hyperparameter, different evaluation indicators have different correlations with the performance indicator of the current hyperparameter, and different evaluation indicators have different correlations with the probability of the candidate hyperparameter being sampled during sampling. Therefore, the preset performance conditions corresponding to different evaluation indicators should also be different. The preset performance conditions corresponding to different evaluation indicators will be exemplarily described below, and will not be repeated here.
[0179] In S307, the hyperparameters included in the machine learning model are set as target hyperparameters to obtain the original malicious traffic detection model. Since the performance index of the target hyperparameters meets the preset performance conditions, it can be considered that the target hyperparameters are the preferred hyperparameters suitable for the target scenario. In the target scenario, the network performance of the original malicious traffic detection model generated according to the target hyperparameters is better.
[0180] When performing malicious traffic detection on the traffic data to be detected in the target Internet of Things architecture, the feature data of the traffic data to be detected in the target Internet of Things architecture at different scales can be extracted according to the multi-scale feature extraction method indicated by the target hyperparameter set in the original malicious traffic detection model, and the feature data at different scales can be fused according to the feature fusion method indicated by the target hyperparameter to obtain the fused features, and malicious traffic detection can be performed on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain a more accurate malicious traffic detection result.
[0181] In S308, it can be understood that only the hyperparameters are set in the original malicious traffic detection model, and the model parameters in the original malicious traffic detection model have not been adjusted. Therefore, it is necessary to perform model training on the original malicious traffic detection model to adjust the model parameters.
[0182] In S309, the preset training end condition may refer to the difference between the prediction result and the true value of the training sample data being less than a preset difference threshold, or it may refer to the number of times the model parameters in the original malicious traffic detection model are adjusted reaching a preset adjustment number threshold, or it may be other preset training end conditions, and the present application does not impose any restrictions on this.
[0183] The original malicious traffic detection model can be trained through the method of S308-S309, so as to adjust the model parameters and obtain the target malicious traffic detection model.
[0184] based on Figure 2 The machine learning model structure shown in Figure 3a After the malicious traffic detection model generation method shown in the figure obtains the target malicious traffic detection model, the malicious traffic detection can be performed on the traffic data to be detected in the target Internet of Things architecture through the aforementioned S101-S102. The process of the target malicious traffic detection model performing malicious traffic detection on the traffic data to be detected can be as follows: the traffic data to be detected is input into the target malicious traffic detection model. The target malicious traffic detection model can extract feature data at different scales of the traffic data to be detected according to the multi-scale feature extraction method indicated by the target hyperparameter set by itself, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain the fused feature, and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the target hyperparameter, and output the malicious traffic detection result.
[0185] Specifically, in a possible embodiment, the target IoT architecture may refer to the IoT architecture of a smart factory, that is, the malicious traffic detection method of the IoT of a smart factory based on a multi-scale convolutional neural network provided in the present application may be applied to the IoT architecture of a smart factory. The IoT architecture of a smart factory includes multiple AGVs (Automated Guided Vehicles) and a robot system. During operation, the AGV sends the captured images as image stream data to the robot system. The robot system may plan the route of the AGV according to the images in the image stream data to realize the function of scheduling the AGV or avoiding collisions between different AGVs. In this example, these image stream data and the interactive signaling generated when the robot system realizes the functions of scheduling, collision avoidance, etc. may be regarded as the aforementioned network traffic data. If an AGV is invaded and the AGV launches a DDOS attack on the robot system, the DDOS attack data launched by the AGV to the robot system is malicious traffic data, or the invaded AGV sends a request data instruction to the robot system to obtain the relevant data of other AGVs performing tasks stored in the robot system, then the request data instruction may also be regarded as malicious traffic data. Therefore, in this embodiment, malicious traffic detection can be performed on image stream data in the smart factory Internet of Things architecture according to the intelligent Internet of Things malicious traffic detection method based on a multi-scale convolutional neural network provided by the present application.
[0186] In another possible embodiment, the target Internet of Things architecture may also refer to a smart home Internet of Things architecture, that is, the malicious traffic detection method of the smart Internet of Things based on a multi-scale convolutional neural network provided in this application can be applied to the smart home Internet of Things architecture. The smart home Internet of Things architecture includes multiple sound collection devices, gateways, and multiple smart home devices. The sound collection device can send the collected sound data to the gateway. The gateway can determine the person corresponding to the data and the smart home device that needs to be turned on according to the received sound data, thereby realizing the control of the smart home device. For example, if the gateway detects that the indication of the sound data is "turn on the air conditioner", the gateway can control the air conditioner to turn on. If a sound collection device is invaded, the sound collection device frequently sends invalid data to the gateway, causing the gateway data to be overloaded, and the invalid data sent by the sound collection device can be regarded as malicious traffic data. Therefore, in this embodiment, malicious traffic detection can be performed on the sound data in the smart home Internet of Things architecture according to the malicious traffic detection method of the smart Internet of Things based on a multi-scale convolutional neural network provided in this application. In other possible embodiments, the target Internet of Things architecture may also be other possible Internet of Things architectures, and this application does not make any limitation on this.
[0187] Referring to the aforementioned S304, it can be understood that the performance indicators of the predicted candidate hyperparameters are not accurate. Therefore, when sampling to obtain a new current hyperparameter, if the performance indicator of a predicted candidate hyperparameter is inaccurate, it is necessary to determine the true performance indicator of the candidate hyperparameter through S302-S303 in order to determine a more accurate target hyperparameter. Based on this, in a possible embodiment, the present application also provides a method for sampling candidate hyperparameters to obtain new current hyperparameters, see Figure 3b , methods include:
[0188] S3041, predicting the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter, and obtaining the confidence of each predicted performance indicator.
[0189] Specifically, a Gaussian-based black box model about performance indicators and hyperparameters can be constructed according to the performance indicators of each current hyperparameter. The model can be expressed by the following formula (3):
[0190] ;
[0191] Among them, G(X) is a function of performance indicators and hyperparameters; X is the performance indicator of each candidate hyperparameter; X' is the performance indicator of each current hyperparameter; mean(·) is the mean function; conv(·, ·) is the covariance function.
[0192] The covariance function may be a function of different forms, for example, a Gaussian kernel, a linear kernel, a polynomial kernel, and the like.
[0193] In formula (3), X can represent the performance index of each candidate hyperparameter predicted, and conv(X, X') can represent the confidence of each predicted performance index. If the covariance value conv(X, X') corresponding to the performance index of a candidate hyperparameter is larger, the confidence of the performance index of the candidate hyperparameter is smaller; conversely, if the covariance value conv(X, X') corresponding to the performance index of a candidate hyperparameter is smaller, the confidence of the performance index of the candidate hyperparameter is greater.
[0194] S3051, sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters.
[0195] Among them, the probability of a candidate hyperparameter being sampled during sampling is positively correlated with the performance indicator of the candidate hyperparameter, and negatively correlated with the confidence of the performance indicator of the candidate hyperparameter.
[0196] When predicting the performance indicators of each candidate hyperparameter in the hyperparameter space based on the performance indicators of each current hyperparameter, it can be considered that the closer the distance between the candidate hyperparameter and the current hyperparameter, the higher the confidence of the predicted performance indicator of the candidate hyperparameter should be; if the distance between the candidate hyperparameter and the current hyperparameter is farther, the lower the confidence of the predicted performance indicator of the candidate hyperparameter should be. In other words, the region where the candidate hyperparameter with lower confidence is located contains fewer current hyperparameters or no current hyperparameters. In this case, when sampling, the candidate hyperparameter with lower confidence needs to be used as the new current hyperparameter, so as to explore the region where the candidate hyperparameter with lower confidence is located. That is, the probability of the candidate hyperparameter being sampled is negatively correlated with the confidence of the performance indicator of the candidate hyperparameter.
[0197] Furthermore, if the performance index of a candidate hyperparameter is high, the candidate hyperparameter may be the target hyperparameter to be determined later. Therefore, when sampling, it is necessary to use the candidate hyperparameter with a high performance index to determine the true performance index of the candidate hyperparameter with a high performance index, that is, the probability of the candidate hyperparameter being sampled is positively correlated with the performance index of the candidate hyperparameter.
[0198] Therefore, when sampling, it is necessary to combine the performance index of the candidate hyperparameter and the confidence of the performance index of the candidate hyperparameter to sample the candidate hyperparameter and obtain the new current hyperparameter. Specifically, the performance index of the candidate hyperparameter and the confidence of the performance index of the candidate hyperparameter can be balanced by the following formula (4) to obtain the new current hyperparameter:
[0199] ;
[0200] in, are candidate hyperparameters; is the performance indicator of the candidate hyperparameters; is the confidence of the performance indicator of the candidate hyperparameter; K is a fixed parameter; is the probability that the candidate hyperparameter is sampled.
[0201] The above formula (4) can achieve a balance between the performance index of the candidate hyperparameter and the confidence of the performance index of the candidate hyperparameter, that is, a balance between exploration and utilization. In this embodiment, the process of S302-S306 is the aforementioned Bayesian optimization.
[0202] By selecting this embodiment, the hyperparameters in the machine learning model can be automatically adjusted through Bayesian optimization, the network structure can be adjusted according to the adjustment of the hyperparameters, the better target hyperparameters can be determined, and the target inference model can be generated according to the target hyperparameters. The target inference model is a model with better network performance in the target scenario. Therefore, by automatically adjusting the hyperparameters in different target scenarios, the machine learning model can better adapt to the data characteristics in different target scenarios, thereby solving the problem of poor generalization of static networks.
[0203] In order to further improve the generalization ability of the target malicious traffic detection model, in a possible embodiment, see Figure 4a The intelligent IoT malicious traffic detection method based on a multi-scale convolutional neural network provided by this application also includes:
[0204] S401, obtaining network traffic data in a target IoT architecture and labels of the network traffic data.
[0205] Network traffic data may include normal traffic data and malicious traffic data in a certain IoT architecture.
[0206] S402, perform sample enhancement on the network traffic data to obtain the network traffic data after sample enhancement as sample data, and use the label of the network traffic data after sample enhancement as the true value of the sample data.
[0207] Among them, sample enhancement includes one or more of the following methods: image transformation, text replacement, mixed sampling, and generative adversarial network.
[0208] Image transformation refers to a series of random changes such as random scaling, random cropping, and random arrangement of images in network traffic data to obtain sample data.
[0209] Text replacement refers to replacing non-core words in the original text included in the network traffic data to obtain sample data.
[0210] Mixed sampling means: randomly mixing the data in the network traffic data and the corresponding true value in a certain proportion to obtain sample data.
[0211] Generative adversarial network refers to: inputting network traffic data into the generative adversarial network model to obtain the sample data output by the generative adversarial network model and the true value of the sample data.
[0212] Specifically, in the IoT malicious traffic detection scenario, the methods of sample enhancement for network traffic data may include: random obfuscation, manually designed distinguishable traffic, noise injection, and introduction of similar training task samples. According to the above sample enhancement methods, sample data and the true value of the sample data are obtained.
[0213] In this embodiment, the overall flow chart of the intelligent IoT malicious traffic detection method based on a multi-scale convolutional neural network can be as follows: Figure 4b See Figure 4b , obtain network traffic data and network traffic data labels, and perform sample enhancement on network traffic data (i.e. Figure 4b In the method of data enhancement in the sample, the network traffic data is preprocessed to obtain the network traffic data after sample enhancement and the label of the network traffic data after sample enhancement as the sample data and the true value corresponding to the sample data, and the above S302-S309 is performed based on the sample data and the true value of the sample data to realize automatic model tuning and model parameter training. Specifically, the automatic tuning strategy of the model automatic tuning is: determine the initial current hyperparameters and the performance indicators of each current hyperparameter (i.e. Figure 4b The initialization hyperparameters in ); predict the performance indicators of each candidate hyperparameter (i.e. Figure 4b Model evaluation in); determine the new current hyperparameters, return to the step of determining the current hyperparameters and the performance indicators of each current hyperparameter, and the corresponding number of iterations + 1, repeat the above process until the number of iterations reaches the target number, and determine the target hyperparameters (i.e. Figure 4b According to the target hyperparameters, the original malicious traffic detection model (i.e. Figure 4b The output optimal model in .
[0214] By selecting this embodiment, more sample data is generated through sample enhancement, and the sample data set is expanded. This allows the model to be exposed to richer and more diverse sample data and learn more robust and generalized feature data in the process of generating a target malicious traffic detection model, thereby avoiding model overfitting and improving the generalization ability of the target malicious traffic detection model.
[0215] The sample enhancement method has been exemplarily described above. The following will correspond to different evaluation indicators and exemplarily describe the aforementioned S303-S306. For the sake of ease of description, the malicious traffic detection result will be referred to as the inference result.
[0216] In one possible embodiment, the performance indicator is a loss value; see Figure 5a ,The malicious traffic detection model generation method includes:
[0217] S503, respectively determine the difference between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the loss value of each current hyperparameter.
[0218] It can be understood that the smaller the difference between the inference result corresponding to the current hyperparameter and the true value of the sample data, that is, the smaller the loss value of the current hyperparameter, the higher the degree of match between the inference result corresponding to the current hyperparameter and the true value of the sample data.
[0219] Specifically, the loss value of each current hyperparameter can be calculated according to the following formula (5):
[0220] ;
[0221] in, is the current hyperparameter; is the i-th sample data; is the true value of the i-th sample data; For machine learning models at current hyperparameters The inference result output for the i-th sample data is as follows; is the loss function; N is the number of sample data. The current hyperparameter can be obtained by formula (5): The loss value.
[0222] S504: According to the loss value of each current hyperparameter, the loss value of each candidate hyperparameter in the hyperparameter space is predicted.
[0223] S504 corresponds to the aforementioned S304, the only difference is that the performance indicator in S304 is replaced by the loss value. The specific method of predicting the loss value of each candidate hyperparameter is consistent with the method of predicting the performance indicator of each candidate hyperparameter in the aforementioned S304, which will not be repeated here.
[0224] S505: Sample multiple candidate hyperparameters from the candidate hyperparameters as new current hyperparameters.
[0225] Among them, the probability of a candidate hyperparameter being sampled during sampling is negatively correlated with the loss value of the candidate hyperparameter.
[0226] It can be understood that the higher the degree of match between the inference result corresponding to the current hyperparameter and the true value of the sample data, the smaller the loss value of the current hyperparameter, and the better the network performance of the machine learning model with the current hyperparameter, that is, the loss value is negatively correlated with the network performance of the machine learning model with the current hyperparameter. Correspondingly, the probability of a candidate hyperparameter being sampled is negatively correlated with the loss value of the candidate hyperparameter, that is, the smaller the loss value of a candidate hyperparameter, the better the network performance of the machine learning model with the candidate hyperparameter, and the greater the probability of the candidate hyperparameter being sampled.
[0227] S506, until the preset iteration end condition is met, search for a hyperparameter whose loss value meets the preset loss value condition in the hyperparameter space as the target hyperparameter.
[0228] The preset loss value condition may refer to a loss value being less than a preset loss value threshold, or may refer to a minimum loss value, and this application does not impose any restrictions on this.
[0229] Specifically, the target hyperparameters can be determined by the following formula (6):
[0230] ;
[0231] in, is any hyperparameter in the hyperparameter space; is the i-th sample data; is the true value of the i-th sample data; For machine learning models at current hyperparameters The malicious traffic detection result output for the i-th sample data is as follows; is the loss function; N is the number of sample data; Minimize means taking the minimum value. The current hyperparameter with the minimum loss value can be determined by formula (6): , as the target hyperparameter.
[0232] In another possible embodiment, the performance indicator is accuracy; see Figure 5b ,The malicious traffic detection model generation method includes:
[0233] S513, according to the true value of the sample data, determine the accuracy of the malicious traffic detection result corresponding to each current hyperparameter as the accuracy rate of each current hyperparameter.
[0234] It can be understood that the higher the accuracy of the inference result corresponding to the current hyperparameter, that is, the higher the accuracy of each current hyperparameter, the higher the degree of match between the inference result corresponding to each current hyperparameter and the true value of the sample data.
[0235] Specifically, the number of inference results whose true value of the sample data is the same as the inference result of the sample data corresponding to the current hyperparameter is counted as the accurate number, and the ratio of the accurate number to the number of sample data is taken as the accuracy of the current hyperparameter.
[0236] S514: According to the accuracy of each current hyperparameter, the accuracy of each candidate hyperparameter in the hyperparameter space is predicted.
[0237] S514 corresponds to the aforementioned S304, the only difference is that the performance indicator in S304 is replaced by accuracy. The specific method of predicting the accuracy of each candidate hyperparameter is consistent with the method of predicting the performance indicator of each candidate hyperparameter in the aforementioned S304, and will not be repeated here.
[0238] S515, sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters.
[0239] Among them, the probability of a candidate hyperparameter being sampled during sampling is positively correlated with the accuracy of the candidate hyperparameter.
[0240] It can be understood that the higher the degree of match between the inference result corresponding to the current hyperparameter and the true value of the sample data, the higher the accuracy of the current hyperparameter, and the better the network performance of the machine learning model with the current hyperparameter, that is, the accuracy is positively correlated with the network performance of the machine learning model with the current hyperparameter. Correspondingly, the probability of a candidate hyperparameter being sampled is positively correlated with the accuracy of the candidate hyperparameter, that is, the higher the accuracy of a candidate hyperparameter, the better the network performance of the machine learning model with the candidate hyperparameter, and the greater the probability of the candidate hyperparameter being sampled.
[0241] S516, until the preset iteration end condition is met, search in the hyperparameter space for a hyperparameter whose accuracy meets the preset accuracy condition, and use it as the target hyperparameter.
[0242] The preset accuracy condition may refer to an accuracy rate greater than a preset accuracy rate threshold, or may refer to a maximum accuracy rate, and this application does not impose any restrictions on this.
[0243] In yet another possible embodiment, the performance indicator is a regression rate; see Figure 5c ,The malicious traffic detection model generation method includes:
[0244] S523, respectively determine the degree of overlap between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the regression rate of each current hyperparameter.
[0245] It can be understood that the greater the overlap between the inference result corresponding to the current hyperparameter and the true value of the sample data, that is, the higher the regression rate of each current hyperparameter, the higher the match between the inference result corresponding to each current hyperparameter and the true value of the sample data.
[0246] Specifically, the regression rate of each current hyperparameter can be calculated by using regression equations such as linear regression and autoregression.
[0247] S524: predict the regression rate of each candidate hyperparameter in the hyperparameter space according to the regression rate of each current hyperparameter.
[0248] S524 corresponds to the aforementioned S304, the only difference is that the performance indicator in S304 is replaced by the regression rate. The specific method of predicting the regression rate of each candidate hyperparameter is consistent with the method of predicting the performance indicator of each candidate hyperparameter in the aforementioned S304, and will not be repeated here.
[0249] S525, sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters.
[0250] Among them, the probability of a candidate hyperparameter being sampled during sampling is positively correlated with the regression rate of the candidate hyperparameter.
[0251] It can be understood that the higher the degree of match between the inference result corresponding to the current hyperparameter and the true value of the sample data, the higher the regression rate of the current hyperparameter, and the better the network performance of the machine learning model with the current hyperparameter, that is, the regression rate is positively correlated with the network performance of the machine learning model with the current hyperparameter. Correspondingly, the probability of a candidate hyperparameter being sampled is positively correlated with the regression rate of the candidate hyperparameter, that is, the higher the regression rate of a candidate hyperparameter, the better the network performance of the machine learning model with the candidate hyperparameter, and the greater the probability of the candidate hyperparameter being sampled.
[0252] S526, until the preset iteration end condition is met, a hyperparameter whose regression rate meets the preset regression rate condition is searched in the hyperparameter space as the target hyperparameter.
[0253] The preset regression rate condition may refer to a regression rate being greater than a preset regression rate threshold, or may refer to a maximum regression rate, and this application does not impose any limitation on this.
[0254] For the case where the performance indicators include multiple ones of loss value, accuracy rate and regression rate at the same time, the performance indicators can be calculated according to the cases where the aforementioned performance indicators are loss value, accuracy rate and regression rate respectively, and the calculated performance indicators are weighted and summed, and the sum result is used as the final performance indicator.
[0255] Corresponding to the aforementioned intelligent Internet of Things malicious traffic detection method based on a multi-scale convolutional neural network, the present application also provides an intelligent Internet of Things malicious traffic detection device based on a multi-scale convolutional neural network, such as Figure 6 As shown, the device comprises:
[0256] The to-be-detected traffic data acquisition module 601 is used to acquire the to-be-detected traffic data in the target IoT architecture;
[0257] The malicious traffic detection result obtaining module 602 is used to input the traffic data to be detected into the target malicious traffic detection model to obtain the malicious traffic detection result output by the target malicious traffic detection model;
[0258] The target malicious traffic detection model is trained by the following methods, including:
[0259] Obtain network traffic data in the target IoT architecture as sample data, and use the label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0260] For each of the multiple current hyperparameters, extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0261] Determine the matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the performance indicator of each current hyperparameter;
[0262] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, wherein the candidate hyperparameter is a hyperparameter that has not been used as the current hyperparameter;
[0263] Sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, returning to execute the step of extracting feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0264] Until the preset iteration end condition is met, the hyperparameter whose performance index meets the preset performance condition is found in the hyperparameter space as the target hyperparameter;
[0265] Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the target hyperparameter to obtain a malicious traffic detection result;
[0266] Input the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model;
[0267] According to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model. The step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end conditions are met to obtain the target malicious traffic detection model.
[0268] In a possible embodiment, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted based on the performance indicators of each current hyperparameter, including:
[0269] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, and the confidence of each predicted performance indicator is obtained;
[0270] Multiple candidate hyperparameters are sampled from each candidate hyperparameter as new current hyperparameters, including:
[0271] A plurality of candidate hyperparameters are sampled from each candidate hyperparameter as new current hyperparameters, wherein the probability of a candidate hyperparameter being sampled is positively correlated with a performance indicator of the candidate hyperparameter and negatively correlated with a confidence level of the performance indicator of the candidate hyperparameter.
[0272] In a possible embodiment, network traffic data in a target IoT architecture is obtained as sample data, and a label of the network traffic data is used as a true value of the sample data, including:
[0273] Obtain network traffic data in the target IoT architecture, as well as labels for the network traffic data;
[0274] Perform sample enhancement on the network traffic data to obtain the network traffic data after sample enhancement as sample data, and use the label of the network traffic data after sample enhancement as the true value of the sample data; wherein the sample enhancement includes one or more of the following methods: image transformation, text replacement, hybrid sampling, and generative adversarial network.
[0275] In a possible embodiment, the performance indicator includes: a loss value;
[0276] The matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data is determined respectively as the performance indicator of each current hyperparameter, including:
[0277] Determine the difference between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the loss value of each current hyperparameter;
[0278] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, including:
[0279] According to the loss value of each current hyperparameter, the loss value of each candidate hyperparameter in the hyperparameter space is predicted;
[0280] Multiple candidate hyperparameters are sampled from each candidate hyperparameter as new current hyperparameters, including:
[0281] Sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, wherein the probability of the candidate hyperparameter being sampled is negatively correlated with the loss value of the candidate hyperparameter during sampling;
[0282] Until the preset iteration end condition is met, the hyperparameters whose performance indicators meet the preset performance conditions are found in the hyperparameter space as the target hyperparameters, including:
[0283] Until the preset iteration end condition is met, the hyperparameter whose loss value meets the preset loss value condition is searched in the hyperparameter space as the target hyperparameter.
[0284] In a possible embodiment, the performance indicators include: accuracy;
[0285] The matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data is determined respectively as the performance indicator of each current hyperparameter, including:
[0286] According to the true value of the sample data, the accuracy of the malicious traffic detection result corresponding to each current hyperparameter is determined as the accuracy rate of each current hyperparameter;
[0287] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, including:
[0288] According to the accuracy of each current hyperparameter, the accuracy of each candidate hyperparameter in the hyperparameter space is predicted;
[0289] Multiple candidate hyperparameters are sampled from each candidate hyperparameter as new current hyperparameters, including:
[0290] Sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, wherein the probability of the candidate hyperparameter being sampled is positively correlated with the accuracy of the candidate hyperparameter during sampling;
[0291] Until the preset iteration end condition is met, the hyperparameters whose performance indicators meet the preset performance conditions are found in the hyperparameter space as the target hyperparameters, including:
[0292] Until the preset iteration end condition is met, the hyperparameter whose accuracy meets the preset accuracy condition is searched in the hyperparameter space as the target hyperparameter.
[0293] In a possible embodiment, the performance indicators include: regression rate;
[0294] The matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data is determined respectively as the performance indicator of each current hyperparameter, including:
[0295] Determine the degree of overlap between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the regression rate of each current hyperparameter;
[0296] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, including:
[0297] According to the regression rate of each current hyperparameter, the regression rate of each candidate hyperparameter in the hyperparameter space is predicted;
[0298] Multiple candidate hyperparameters are sampled from each candidate hyperparameter as new current hyperparameters, including:
[0299] Sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, wherein the probability of the candidate hyperparameter being sampled is positively correlated with the regression rate of the candidate hyperparameter during sampling;
[0300] Until the preset iteration end condition is met, the hyperparameters whose performance indicators meet the preset performance conditions are found in the hyperparameter space as the target hyperparameters, including:
[0301] Until the preset iteration end condition is met, the hyperparameter whose regression rate meets the preset regression rate condition is searched in the hyperparameter space as the target hyperparameter.
[0302] Corresponding to the aforementioned malicious traffic detection model generation method, the present application also provides a malicious traffic detection model generation device, such as Figure 7 As shown, the device comprises:
[0303] The sample data acquisition module 701 is used to acquire network traffic data in the target IoT architecture as sample data, and use the label of the network traffic data as the true value of the sample data; wherein the label is used to indicate whether the network traffic data is malicious traffic;
[0304] The detection result obtaining module 702 is used to extract feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each current hyperparameter among the multiple current hyperparameters, and to fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and to perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0305] The performance indicator determination module 703 is used to determine the matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data, as the performance indicator of each current hyperparameter;
[0306] The performance indicator prediction module 704 is used to predict the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter, wherein the candidate hyperparameter is a hyperparameter that has not been used as the current hyperparameter;
[0307] The hyperparameter sampling module 705 is used to sample multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, and return to execute the steps of extracting feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each current hyperparameter among the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0308] A target hyperparameter search module 706 is used to search for a hyperparameter whose performance index meets a preset performance condition in the hyperparameter space until a preset iteration end condition is met, and use the hyperparameter as the target hyperparameter;
[0309] The original malicious traffic detection model generation module 707 is used to generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and to fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain a fusion feature; and to perform malicious traffic detection on the fusion feature according to the malicious traffic detection method indicated by the target hyperparameter to obtain a malicious traffic detection result;
[0310] The prediction result obtaining module 708 is used to input the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model;
[0311] The model parameter adjustment module 709 is used to adjust the model parameters in the original malicious traffic detection model according to the difference between the prediction result and the true value of the training sample data, and use the original malicious traffic detection model after the model parameter adjustment as the new original malicious traffic detection model, and repeatedly execute the step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model until the preset training end condition is met to obtain the target malicious traffic detection model.
[0312] The present application also provides an electronic device, such as Figure 8 As shown, including:
[0313] Memory 801, used for storing computer programs;
[0314] The processor 802 is used to execute the program stored in the memory 801, and implements the following steps:
[0315] Obtain the traffic data to be detected in the target IoT architecture;
[0316] Input the traffic data to be detected into the target malicious traffic detection model to obtain the malicious traffic detection result output by the target malicious traffic detection model;
[0317] The target malicious traffic detection model is trained by the following methods, including:
[0318] Obtain network traffic data in the target IoT architecture as sample data, and use the label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0319] For each of the multiple current hyperparameters, extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0320] Determine the matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the performance indicator of each current hyperparameter;
[0321] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, wherein the candidate hyperparameter is a hyperparameter that has not been used as the current hyperparameter;
[0322] Sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, returning to execute the step of extracting feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0323] Until the preset iteration end condition is met, the hyperparameter whose performance index meets the preset performance condition is found in the hyperparameter space as the target hyperparameter;
[0324] Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the target hyperparameter to obtain a malicious traffic detection result;
[0325] Input the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model;
[0326] According to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model. The step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end conditions are met to obtain the target malicious traffic detection model.
[0327] or,
[0328] Obtain network traffic data in the target IoT architecture as sample data, and use the label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic;
[0329] For each of the multiple current hyperparameters, extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter;
[0330] Determine the matching degree between the malicious traffic detection result corresponding to each current hyperparameter and the true value of the sample data as the performance indicator of each current hyperparameter;
[0331] According to the performance indicators of each current hyperparameter, the performance indicators of each candidate hyperparameter in the hyperparameter space are predicted, wherein the candidate hyperparameter is a hyperparameter that has not been used as the current hyperparameter;
[0332] Sampling multiple candidate hyperparameters from each candidate hyperparameter as new current hyperparameters, returning to execute the step of extracting feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter;
[0333] Until the preset iteration end condition is met, the hyperparameter whose performance index meets the preset performance condition is found in the hyperparameter space as the target hyperparameter;
[0334] Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the target hyperparameter to obtain a malicious traffic detection result;
[0335] Input the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model;
[0336] According to the difference between the prediction result and the true value of the training sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model. The step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end conditions are met to obtain the target malicious traffic detection model.
[0337] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 802, the communication interface, and the memory 801 communicate with each other via the communication bus.
[0338] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0339] The communication interface is used for communication between the above electronic device and other devices.
[0340] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0341] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0342] In another embodiment provided in the present application, a computer-readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned intelligent Internet of Things malicious traffic detection methods based on multi-scale convolutional neural networks or malicious traffic detection model generation methods are implemented.
[0343] In another embodiment provided by the present application, a computer program product comprising instructions is also provided. When the computer is run on a computer, the computer executes any one of the intelligent Internet of Things malicious traffic detection methods or malicious traffic detection model generation methods based on a multi-scale convolutional neural network in the above-mentioned embodiments.
[0344] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0345] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0346] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0347] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for detecting malicious traffic in intelligent IoT based on multi-scale convolutional neural network. It is characterized in that The method comprises: Obtain the traffic data to be detected in the target IoT architecture; Inputting the traffic data to be detected into a target malicious traffic detection model to obtain a malicious traffic detection result output by the target malicious traffic detection model; The target malicious traffic detection model is trained by the following methods, including: Acquire network traffic data in the target IoT architecture as sample data, and use a label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic; For each of the multiple current hyperparameters, extract feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter, fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter; Determine respectively the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as a performance indicator of each of the current hyperparameters; According to the performance indicators of the current hyperparameters, predict the performance indicators of the candidate hyperparameters in the hyperparameter space, wherein the candidate hyperparameters are hyperparameters that have not been used as the current hyperparameters; Sampling multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, returning to execute the step of extracting feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter; Until a preset iteration end condition is met, a hyperparameter whose performance index meets the preset performance condition is searched in the hyperparameter space as a target hyperparameter; Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results; Inputting the sample data into the original malicious traffic detection model to obtain a prediction result output by the original malicious traffic detection model; According to the difference between the prediction result and the true value of the sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model. The step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end condition is met to obtain the target malicious traffic detection model.
2. The method according to claim 1, It is characterized in that The predicting of the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes: Predicting the performance indicators of the candidate hyperparameters in the hyperparameter space according to the performance indicators of the current hyperparameters, and obtaining the confidence of the predicted performance indicators; The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes: A plurality of candidate hyperparameters are sampled from each of the candidate hyperparameters as new current hyperparameters, wherein the probability of a candidate hyperparameter being sampled during sampling is positively correlated with a performance indicator of the candidate hyperparameter and negatively correlated with a confidence level of the performance indicator of the candidate hyperparameter.
3. The method according to claim 1, It is characterized in that The obtaining of network traffic data in the target IoT architecture as sample data, and using the label of the network traffic data as the true value of the sample data, includes: Obtain network traffic data in the target IoT architecture and labels of the network traffic data; Perform sample enhancement on the network traffic data to obtain the network traffic data after sample enhancement as sample data, and use the label of the network traffic data after sample enhancement as the true value of the sample data; wherein the sample enhancement includes one or more of the following methods: image transformation, text replacement, hybrid sampling, and generative adversarial network.
4. The method according to claim 1, It is characterized in that The performance indicators include: loss value; The respectively determining the matching degree between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters includes: Respectively determine the difference between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the loss value of each of the current hyperparameters; The predicting of the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes: According to the loss values of the current hyperparameters, predict the loss values of the candidate hyperparameters in the hyperparameter space; The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes: Sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, wherein during sampling, the probability of a candidate hyperparameter being sampled is negatively correlated with the loss value of the candidate hyperparameter; The step of searching for a hyperparameter whose performance index satisfies the preset performance condition in the hyperparameter space until the preset iteration end condition is met as the target hyperparameter includes: Until the preset iteration end condition is met, a hyperparameter whose loss value meets the preset loss value condition is searched in the hyperparameter space as the target hyperparameter.
5. The method according to claim 1, It is characterized in that The performance indicators include: accuracy; The respectively determining the matching degree between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters includes: According to the true value of the sample data, respectively determine the accuracy of the malicious traffic detection result corresponding to each of the current hyperparameters as the accuracy rate of each of the current hyperparameters; The predicting of the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes: Predicting the accuracy of each candidate hyperparameter in the hyperparameter space according to the accuracy of each current hyperparameter; The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes: Sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, wherein the probability of a candidate hyperparameter being sampled during sampling is positively correlated with the accuracy of the candidate hyperparameter; The step of searching for a hyperparameter whose performance index satisfies the preset performance condition in the hyperparameter space until the preset iteration end condition is met as the target hyperparameter includes: Until the preset iteration end condition is met, a hyperparameter whose accuracy meets the preset accuracy condition is searched in the hyperparameter space as the target hyperparameter.
6. The method according to claim 1, It is characterized in that The performance indicators include: regression rate; The respectively determining the matching degree between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters includes: Respectively determine the degree of overlap between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the regression rate of each of the current hyperparameters; The predicting of the performance indicators of each candidate hyperparameter in the hyperparameter space according to the performance indicators of each current hyperparameter includes: Predicting the regression rate of each candidate hyperparameter in the hyperparameter space according to the regression rate of each current hyperparameter; The step of sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters includes: Sampling a plurality of candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, wherein the probability of a candidate hyperparameter being sampled during sampling is positively correlated with a regression rate of the candidate hyperparameter; The step of searching for a hyperparameter whose performance index satisfies the preset performance condition in the hyperparameter space until the preset iteration end condition is met as the target hyperparameter includes: Until the preset iteration end condition is met, a hyperparameter whose regression rate meets the preset regression rate condition is searched in the hyperparameter space as the target hyperparameter.
7. A method for generating a malicious traffic detection model, It is characterized in that The method comprises: Acquire network traffic data in the target IoT architecture as sample data, and use a label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic; For each of the multiple current hyperparameters, extract feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter, fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter; Determine respectively the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as a performance indicator of each of the current hyperparameters; According to the performance indicators of the current hyperparameters, predict the performance indicators of the candidate hyperparameters in the hyperparameter space, wherein the candidate hyperparameters are hyperparameters that have not been used as the current hyperparameters; Sampling multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, returning to execute the step of extracting feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter; Until a preset iteration end condition is met, a hyperparameter whose performance index meets the preset performance condition is searched in the hyperparameter space as a target hyperparameter; Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results; Inputting the sample data into the original malicious traffic detection model to obtain a prediction result output by the original malicious traffic detection model; According to the difference between the prediction result and the true value of the sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model. The step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end condition is met to obtain the target malicious traffic detection model.
8. An intelligent IoT malicious traffic detection device based on multi-scale convolutional neural network, It is characterized in that The device comprises: A module for acquiring traffic data to be detected, used to acquire traffic data to be detected in a target IoT architecture; A malicious traffic detection result obtaining module is used to input the traffic data to be detected into a target malicious traffic detection model to obtain a malicious traffic detection result output by the target malicious traffic detection model; The target malicious traffic detection model is trained by the following methods, including: Acquire network traffic data in the target IoT architecture as sample data, and use a label of the network traffic data as the true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic; For each of the multiple current hyperparameters, extract feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter, fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter; Determine respectively the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as a performance indicator of each of the current hyperparameters; According to the performance indicators of the current hyperparameters, predict the performance indicators of the candidate hyperparameters in the hyperparameter space, wherein the candidate hyperparameters are hyperparameters that have not been used as the current hyperparameters; Sampling multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, returning to execute the step of extracting feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter; Until a preset iteration end condition is met, a hyperparameter whose performance index meets the preset performance condition is searched in the hyperparameter space as a target hyperparameter; Generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results; Inputting the sample data into the original malicious traffic detection model to obtain a prediction result output by the original malicious traffic detection model; According to the difference between the prediction result and the true value of the sample data, the model parameters in the original malicious traffic detection model are adjusted, and the original malicious traffic detection model after the model parameters are adjusted is used as the new original malicious traffic detection model. The step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model is repeated until the preset training end condition is met to obtain the target malicious traffic detection model.
9. A malicious traffic detection model generation device, It is characterized in that The device comprises: A sample data acquisition module is used to acquire network traffic data in a target IoT architecture as sample data, and use a label of the network traffic data as a true value of the sample data; wherein the label is used to characterize whether the network traffic data is malicious traffic; The detection result obtaining module is used to extract the feature data of the sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, and to fuse the feature data at different scales according to the feature fusion method indicated by the current hyperparameter to obtain a fused feature; and to perform malicious traffic detection on the fused feature according to the malicious traffic detection method indicated by the current hyperparameter to obtain a malicious traffic detection result corresponding to the current hyperparameter; A performance indicator determination module, used to respectively determine the degree of match between the malicious traffic detection result corresponding to each of the current hyperparameters and the true value of the sample data as the performance indicator of each of the current hyperparameters; A performance indicator prediction module, used to predict the performance indicator of each candidate hyperparameter in the hyperparameter space according to the performance indicator of each current hyperparameter, wherein the candidate hyperparameter is a hyperparameter that has not been used as the current hyperparameter; A hyperparameter sampling module is used to sample multiple candidate hyperparameters from each of the candidate hyperparameters as new current hyperparameters, and return to execute the step of extracting feature data of sample data at different scales according to the multi-scale feature extraction method indicated by the current hyperparameter for each of the multiple current hyperparameters, wherein the probability of the candidate hyperparameter being sampled during sampling is positively correlated with the performance index of the candidate hyperparameter; A target hyperparameter search module is used to search for a hyperparameter whose performance index meets a preset performance condition in the hyperparameter space until a preset iteration end condition is met, and use the hyperparameter as the target hyperparameter; An original malicious traffic detection model generation module is used to generate an original malicious traffic detection model according to the target hyperparameter, wherein the original malicious traffic detection model is used to extract feature data at different scales of the sample data according to the multi-scale feature extraction method indicated by the target hyperparameter, and to fuse the feature data at different scales according to the feature fusion method indicated by the target hyperparameter to obtain fused features; and to perform malicious traffic detection on the fused features according to the malicious traffic detection method indicated by the target hyperparameter to obtain malicious traffic detection results; A prediction result obtaining module, used for inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model; A model parameter adjustment module is used to adjust the model parameters in the original malicious traffic detection model according to the difference between the prediction result and the true value of the sample data, and use the original malicious traffic detection model after the model parameter adjustment as a new original malicious traffic detection model, and repeatedly execute the step of inputting the sample data into the original malicious traffic detection model to obtain the prediction result output by the original malicious traffic detection model until the preset training end condition is met to obtain the target malicious traffic detection model.
10. An electronic device, It is characterized in that include: Memory, used to store computer programs; A processor, for implementing the method described in any one of claims 1 to 6 or 7 when executing a program stored in a memory.
11. A computer program product, It is characterized in that When the method is executed on a computer, the computer is enabled to execute the method described in any one of claims 1 to 6 or 7.
Citation Information
Patent Citations
Lightweight malicious traffic detection method and device based on width learning
CN114567511A
Malicious traffic detection method, system and device and storage medium
CN116599683A
Network malicious traffic detection method
CN118041689A
Malicious traffic detection with anomaly detection modeling
WO2022040698A1
Encrypted malicious traffic detection method and apparatus, storage medium and electronic apparatus
WO2023056808A1
