WO2022222020A1 - Neural network architecture automatic search method and device for traffic classification - Google Patents

Neural network architecture automatic search method and device for traffic classification Download PDF

Info

Publication number
WO2022222020A1
WO2022222020A1 PCT/CN2021/088293 CN2021088293W WO2022222020A1 WO 2022222020 A1 WO2022222020 A1 WO 2022222020A1 CN 2021088293 W CN2021088293 W CN 2021088293W WO 2022222020 A1 WO2022222020 A1 WO 2022222020A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
network architecture
traffic
search
searching
Prior art date
Application number
PCT/CN2021/088293
Other languages
French (fr)
Chinese (zh)
Inventor
林鹏
叶可江
须成忠
Original Assignee
中国科学院深圳先进技术研究院
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国科学院深圳先进技术研究院 filed Critical 中国科学院深圳先进技术研究院
Priority to PCT/CN2021/088293 priority Critical patent/WO2022222020A1/en
Publication of WO2022222020A1 publication Critical patent/WO2022222020A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology

Definitions

  • the present application relates to the field of information technology, and in particular, to an automatic search method and device for a neural network architecture for traffic classification.
  • Network traffic classification technology is an important research problem in the network field. It plays a very key role in intrusion detection, network anomaly detection and QoS assurance. As a very promising technology in recent years, deep neural network has achieved good results in the field of traffic classification. However, the current deep neural networks all require manual design and are difficult to adapt to different traffic classification tasks. These different traffic classification tasks may have different focuses, and the traffic patterns in different enterprises are also different. Designing a suitable neural network architecture is very expensive.
  • the linear layer and the Softmax layer are generally combined at the end for classification.
  • the present application provides an automatic search method and device for a neural network architecture for traffic classification, aiming at realizing automatic neural network architecture search.
  • an automatic search method for a neural network architecture for traffic classification comprising the following steps:
  • search for the optimal neural network structure including searching for the optimal Cell structure, repeating the search and stacking the same Cell structure, and forming the searched Cell structure into the entire neural network structure.
  • the method further includes:
  • the technical solutions adopted in the embodiments of the present application further include: in acquiring network traffic data samples, preprocessing the data samples and converting the data samples into a traffic data set in the form of a two-dimensional matrix, including:
  • Step 1 perform data extraction at network flow granularity
  • Step 2 carry out data extraction at packet granularity
  • Step 3 splicing the data extracted at the network flow granularity and the data extracted at the data packet granularity along the channel dimension to form a tensor
  • Step 4 Perform the operations from Step 1 to Step 3 above for all network flows to construct a formatted traffic data set.
  • the technical solution adopted in the embodiment of the present application further includes: dividing the traffic data set into training set, verification set and test set respectively includes:
  • the training set, validation set and test set contain the same proportion of traffic of each category; among them,
  • the training set is used to update the network weight parameters in this structure
  • the validation set is used to search for the best network structure parameters
  • test set is used to retrain using the training set plus the validation set after the search is complete, and to evaluate the final results on the test set.
  • the technical solutions adopted in the embodiments of the present application further include: the optional operation of constructing the search space includes: limiting the scope of the search neural network architecture space.
  • the technical solutions adopted in the embodiments of the present application further include: the optional operation of the search space of the neural network architecture is set as: 3x3 depthwise separable convolution, 5x5 depthwise separable convolution, 3x3 hole convolution, 5x5 hole convolution, 3x3 Maximum pooling and 3x3 average pooling.
  • searching for the optimal neural network architecture includes:
  • Step 1 Build a supernet; in which, the operation of extending eight edges in the supernet, and each edge has a different weight;
  • Step 2 Use gradient descent on the validation set loss to update the neural network architecture parameters
  • Step 3 Use the gradient descent method to update the operation weight parameters on the training set loss
  • Step 4 Repeat steps 2 and 3 until the neural network architecture training is completed
  • Step 5 After the training is completed, keep the edge with the largest node weight.
  • the technical solution adopted in the embodiment of the present application also includes: adding spatial attention and channel attention to the output position of each Cell, including:
  • Step 1 The channel attention weight is obtained by adding channel attention to the output of the searched Cell structure
  • Step 2 The spatial attention weight is obtained by adding spatial attention to the output of the searched Cell structure
  • Step 3 Perform matrix multiplication of the obtained channel attention weight and spatial attention weight to obtain a new output of attention weighting.
  • a neural network architecture automatic search device for traffic classification comprising:
  • Data conversion module used to obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
  • Data division module used to divide the traffic data set into training set, validation set and test set respectively;
  • Optional operation building block optional operation used to build the search space of the neural network architecture after the traffic dataset is divided;
  • Search for the optimal network architecture module It is used to search for the optimal neural network architecture based on the optional operation of the search space; including, searching for the optimal Cell structure, repeating the search for stacking the same Cell structure, and forming the searched Cell structure into a whole Neural network architecture.
  • the device further includes:
  • Attention adding module used to add spatial attention and channel attention to the output position of each Cell
  • Retraining module used to save the searched Cell architecture parameters, and retrain the Cell architecture using a new training set that combines the training set and the validation set.
  • the neural network architecture automatic search method and device for traffic classification in the embodiments of the present application obtain network traffic data samples, preprocess the data samples, and transfer the data samples.
  • the traffic data set in the form of a two-dimensional matrix; the traffic data set is divided into training set, validation set and test set respectively; after the traffic data set is divided, the optional operation of constructing the search space of the neural network architecture; the search space-based optional operation
  • the selection operation is performed to search for the optimal neural network architecture; which includes, searching for the optimal Cell structure, repeatedly searching and stacking the same Cell structure, and forming the searched Cell structure into the entire neural network structure.
  • the present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
  • FIG. 1 is a flowchart of an automatic search method for a neural network architecture for traffic classification according to an embodiment of the present application
  • Fig. 2 is the preferred flow chart of the neural network architecture automatic search method for traffic classification according to the embodiment of the present application
  • FIG. 3 is a block diagram of a neural network architecture automatic search device for traffic classification according to an embodiment of the present application
  • FIG. 4 is a preferred module diagram of a neural network architecture automatic search device for traffic classification according to an embodiment of the present application
  • FIG. 5 is a preferred module diagram of a neural network architecture automatic search device for traffic classification according to an embodiment of the present application
  • FIG. 6 is a schematic diagram of adding attention after the searched Cell structure described in an embodiment of the present application.
  • FIG. 7 is a diagram illustrating a calculation process of channel attention in an embodiment of the present application.
  • FIG. 8 is a diagram illustrating a calculation process of spatial attention according to an embodiment of the present application.
  • an automatic search method for a neural network architecture for traffic classification including the following steps:
  • S101 Obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
  • S103 an optional operation of constructing a search space of the neural network architecture after the traffic data set is divided;
  • S104 Searching for an optimal neural network architecture based on an optional operation in the search space, which includes searching for an optimal Cell structure, repeatedly searching and stacking the same Cell structure, and forming the searched Cell structure into an entire neural network architecture.
  • the neural network architecture automatic search method and device for traffic classification in the embodiment of the present application obtains network traffic data samples, preprocesses the data samples and converts them into a traffic data set in the form of a two-dimensional matrix; and divides the traffic data sets into separate into a training set, a validation set and a test set; after the traffic data set is divided, an optional operation to construct the search space of the neural network architecture; an optional operation based on the search space to search for the optimal neural network architecture; including, searching for the most optimal neural network architecture. For an optimal Cell structure, repeat the search and stack the same Cell structure, and form the searched Cell structure into the entire neural network architecture.
  • the present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
  • the method further includes:
  • S106 Save the searched Cell architecture parameters, and retrain the Cell architecture using a new training set formed by combining the training set and the validation set.
  • the spatial attention and channel attention mechanisms are combined into each cell structure searched, which enhances the feature extraction capability of the model.
  • spatial attention and channel attention are added to the output position of each cell structure searched to enhance the feature extraction ability of the model; the Cell structure obtained by adding spatial attention and channel attention training will be added. After the parameters are saved, continue to retrain until the training is complete.
  • the data samples are preprocessed and converted into a traffic data set in the form of a two-dimensional matrix, including:
  • Step 1 perform data extraction at network flow granularity
  • Step 2 carry out data extraction at packet granularity
  • Step 3 splicing the data extracted at the network flow granularity and the data extracted at the data packet granularity along the channel dimension to form a tensor
  • Step 4 Perform the operations from Step 1 to Step 3 above for all network flows to construct a formatted traffic data set.
  • Step 1 Perform data extraction at the network flow granularity, extract the previous byte of the network flow, and form The two-dimensional matrix m 1 of .
  • Step 2 perform data extraction at the data packet granularity, extract bytes from the first n data packets of a flow, extract the first ⁇ /n bytes of each data packet, total ⁇ bytes, and form The two-dimensional matrix m 2 of .
  • Step 3 splicing m 1 and m 2 along the channel dimension to form a 32*32*3 tensor.
  • Step 4 Perform the operations from Steps 1 to 3 above on all network flows to construct a formatted traffic data set.
  • dividing the traffic data set into training set, validation set and test set respectively includes:
  • the training set, validation set and test set contain the same proportion of traffic of each category; among them,
  • the training set is used to update the network weight parameters in this structure
  • the validation set is used to search for the best network structure parameters
  • test set is used to retrain using the training set plus the validation set after the search is complete, and to evaluate the final results on the test set.
  • the traffic dataset constructed above is divided, one part is used for training, one part is used for validation, and the remaining part is used for testing.
  • Each set contains the same proportion of each category of traffic.
  • the training set is used to update the network weight parameters in the structure, and the validation set is used to search for the best network structure parameters. After the search is completed, the training set and the validation set are used for retraining, and the final result is evaluated on the test set.
  • the optional operation of constructing the search space includes: limiting the scope of searching the neural network architecture space.
  • the optional operations for automatic neural architecture search are infinite, and to reduce complexity we need to limit the scope of the search space.
  • optional operations of the search space of the neural network architecture are set to: 3x3 depthwise separable convolution, 5x5 depthwise separable convolution, 3x3 atrous convolution, 5x5 atrous convolution, 3x3 max pooling and 3x3 averaging pooling.
  • Optional operations on the search space in this application include: 3x3 depthwise separable convolution, 5x5 depthwise separable convolution, 3x3 atrous convolution, 5x5 atrous convolution, 3x3 max pooling, 3x3 average pooling, identity and direct A total of eight operations.
  • searching for the optimal neural network architecture includes:
  • Step 1 Build a supernet; in which, the operation of extending eight edges in the supernet, and each edge has a different weight;
  • Step 2 Use gradient descent on the validation set loss to update the neural network architecture parameters
  • Step 3 Use the gradient descent method to update the operation weight parameters on the training set loss
  • Step 4 Repeat steps 2 and 3 until the neural network architecture training is completed
  • Step 5 After the training is completed, keep the edge with the largest node weight.
  • This search method belongs to microscopic search, that is, to search for an optimal Cell structure, and then repeatedly stack the same Cell to form the entire network.
  • Each Cell contains four nodes, and the nodes represent the feature map at a certain moment.
  • the edges between nodes represent some kind of optional operation, and the total number of optional operations is eight kinds.
  • a directed acyclic graph that is, the structure of a Cell, as shown in Figure 5.
  • Step 1 Build a supernet through the supernet construction formula, expand the operation of eight edges in the supernet, and each edge has a different weight;
  • the supernet construction formula is as follows:
  • o(x) is one of the operations in the optional operation set, that is, it represents one of the eight sides; Refers to the weight of the edge o(x), (i, j) defines that the edge belongs between the i and j nodes; Represents the weighted operation of eight edges between nodes i and i, and a feature map can be obtained through the calculation of the weighted operation; in addition, the formula uses the Softmax function to processed;
  • Step 2 Use the gradient descent method to update the neural network architecture parameter ⁇ on the validation set loss, the formula is as follows:
  • Step 3 Use the gradient descent method to update the operation weight parameter w on the training set loss, the formula is as follows:
  • Step 4 Repeat steps 2 and 3 until the neural network architecture training is completed
  • Step 5 After the training is completed, the maximum weight between the reserved nodes (i, j) is achieved through the node reservation formula The edge of ; the node retention formula is:
  • each node only retains connections to the previous two nodes with the largest weighted edges.
  • adding spatial attention and channel attention to the output position of each Cell includes:
  • Step 1 The channel attention weight is obtained by adding channel attention to the output of the searched Cell structure
  • Step 2 The spatial attention weight is obtained by adding spatial attention to the output of the searched Cell structure
  • Step 3 Perform matrix multiplication of the obtained channel attention weight and spatial attention weight to obtain a new output of attention weighting.
  • Step 1 Add channel attention to the output of the searched Cell structure, as shown in Figure 7; which includes, first, global average pooling and global maximum pooling are used for x with dimension h*w*C to obtain two A 1*1*C tensor, and then use a shared MLP layer to further extract features from the two tensors, and add them to obtain the channel attention weight M c through the Sigmoid function.
  • Step 2 Add spatial attention to the output of the searched Cell structure, as shown in Figure 8; which includes, first, global average pooling and global maximum pooling are adopted for x with dimension h*w*C to obtain two h*w*1 tensors, and then use a convolution kernel to convert the two tensors into a h*w*1 feature map, and then process the Sigmoid function to obtain the spatial attention weight M s .
  • Step 3 Perform matrix multiplication on the original output dimension x through the matrix multiplication formula with the obtained channel attention weight M c and spatial attention weight M s to obtain a new output x' of attention weighting.
  • the matrix multiplication formula is as follows:
  • a neural network architecture automatic search device for traffic classification is provided, referring to FIG. 3 to FIG. 8 , including:
  • Data conversion module used to obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
  • Data division module used to divide the traffic data set into training set, validation set and test set respectively;
  • Optional operation building block optional operation used to build the search space of the neural network architecture after the traffic dataset is divided;
  • Search for the optimal network architecture module It is used to search for the optimal neural network architecture based on the optional operation of the search space; including, searching for the optimal Cell structure, repeating the search for stacking the same Cell structure, and forming the searched Cell structure into a whole Neural network architecture.
  • the neural network architecture automatic search method and device for traffic classification in the embodiment of the present application and the data conversion module: used to obtain network traffic data samples, preprocess the data samples, and convert them into a traffic data set in the form of a two-dimensional matrix;
  • Data division module used to divide the traffic data set into training set, validation set and test set respectively;
  • optional operation building module optional operation used to construct the search space of the neural network architecture after the traffic data set is divided;
  • search Optimal network architecture module It is used to search for the optimal neural network architecture based on the optional operation of the search space; including, searching for the optimal Cell structure, repeatedly searching and stacking the same Cell structure, and forming the searched Cell structure into the entire neural network.
  • Network Architecture The present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
  • the device further includes:
  • Attention adding module used to add spatial attention and channel attention to the output position of each Cell
  • Retraining module used to save the searched Cell architecture parameters, and retrain the Cell architecture using a new training set that combines the training set and the validation set.
  • the spatial attention and channel attention mechanisms are combined into each cell structure searched, which enhances the feature extraction capability of the model.
  • spatial attention and channel attention are added to the output position of each cell structure searched to enhance the feature extraction ability of the model; the Cell structure obtained by adding spatial attention and channel attention training will be added. After the parameters are saved, continue to retrain until the training is complete.
  • the neural network architecture automatic search method and device for traffic classification in the embodiment of the present application obtains network traffic data samples, preprocesses the data samples and converts them into a traffic data set in the form of a two-dimensional matrix; It is divided into training set, validation set and test set respectively; after the division of the traffic data set, the optional operation of constructing the search space of the neural network architecture; the optional operation based on the search space, searching for the optimal neural network architecture; including, Search for the optimal Cell structure, repeat the search and stack the same Cell structure, and form the searched Cell structure into the entire neural network architecture.
  • the present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
  • the application uses two-dimensional data matrix extraction with two granularities, thereby forming a dual-channel input.
  • This application adds spatial attention and channel attention to each Cell structure to enhance feature extraction capabilities.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

A neural network architecture automatic search method and device for traffic classification. The method and apparatus comprise: obtaining a network traffic data sample, preprocessing the data sample, and converting same into a traffic data set in the form of a two-dimensional matrix (S101); respectively dividing the traffic data set into a training set, a verification set, and a test set (S102); after dividing the traffic data set, constructing an optional operation of a search space of a neural network architecture (S103); and searching an optimal neural network architecture on the basis of the optional operation of the search space, comprising searching an optimal Cell structure, repeatedly searching and stacking identical Cell structures, and forming the searched Cell structures into the entire neural network architecture (S104). The method can automatically search an optimal neural network structure by means of a given candidate operation, without manual participation.

Description

一种用于流量分类的神经网络架构自动搜索方法及装置A neural network architecture automatic search method and device for traffic classification 技术领域technical field
本申请涉及信息技术领域,具体而言,涉及一种用于流量分类的神经网络架构自动搜索方法及装置。The present application relates to the field of information technology, and in particular, to an automatic search method and device for a neural network architecture for traffic classification.
背景技术Background technique
网络流量分类技术是网络领域中一个重要的研究问题,它在入侵检测、网络异常检测和QoS保证中都起到非常关键的作用。深度神经网络作为近年来一种非常有前途的技术,已经在流量分类领域中取得了很好的效果。然而,目前的深度神经网络均需要人工设计,难以适应不同的流量分类任务,这些不同的流量分类任务可能存在不同的侧重点,且不同企业中的流量模式也各不相同,为每个任务单独设计一套适用的神经网络架构是非常高成本的。Network traffic classification technology is an important research problem in the network field. It plays a very key role in intrusion detection, network anomaly detection and QoS assurance. As a very promising technology in recent years, deep neural network has achieved good results in the field of traffic classification. However, the current deep neural networks all require manual design and are difficult to adapt to different traffic classification tasks. These different traffic classification tasks may have different focuses, and the traffic patterns in different enterprises are also different. Designing a suitable neural network architecture is very expensive.
传统的流量分类技术是基于端口号和深度包检测的,这种方法基于预先设定的规则来对待分类流量进行匹配,从而将其划分到已知的流量模式中。基于机器学习的方法使得流量分类技术能更加智能地去识别其内在的模式,这类方法一般先需要对网络流量进行特征化处理,将其转变为一组流量特征向量,然后结合常用的机器学习方法,如SVM、随机森林、KNN等进行分类。深度神经网络的出现使得端到端的流量分类成为可能,这类方法不强制要求事先将网络流量特征化,也可以将原始的网络数据进行简单编码后输送到神经网络中。神经网络先将这些编码映射到一组高维向量,然后对其进行卷积、池化、递归计算等操作,从而提取出隐藏特征。一般而言为了加强学习到的特征表达,会 加深网络的层数,这就是“深度神经网络”的由来。在多层的特征提取操作后,一般会在最后结合线性层和Softmax层来进行分类。Traditional traffic classification techniques are based on port numbers and deep packet inspection. This method matches traffic to be classified based on pre-set rules, thereby classifying it into known traffic patterns. The method based on machine learning enables traffic classification technology to more intelligently identify its inherent patterns. Such methods generally need to characterize network traffic first, convert it into a set of traffic feature vectors, and then combine common machine learning methods. methods such as SVM, random forest, KNN, etc. for classification. The emergence of deep neural networks makes end-to-end traffic classification possible. Such methods do not require prioritizing network traffic characterization, and can also simply encode the original network data and send it to the neural network. The neural network first maps these codes to a set of high-dimensional vectors, and then performs convolution, pooling, recursive calculations, etc. on them to extract hidden features. Generally speaking, in order to strengthen the learned feature expression, the number of layers of the network will be deepened, which is the origin of "deep neural network". After the multi-layer feature extraction operation, the linear layer and the Softmax layer are generally combined at the end for classification.
传统的流量分类技术基于端口号和深度包检测,这类方法很容易被端口欺骗、流量加密等技术所绕过。基于机器学习的方法需要先对网络流量进行特征化,然而这需要非常大量的专家先验知识,且人工设计出来的特征不一定能保证有代表性和全面性。深度学习方法虽然可以降低专家知识的门槛,然而设计有效的神经网络架构本身就是一件有挑战性的事情。另外,要找出哪一种神经网络架构最适合当前的任务,需要大量的实验和重设计,这需要耗费巨大的人力物力。Traditional traffic classification techniques are based on port numbers and deep packet inspection, which are easily bypassed by techniques such as port spoofing and traffic encryption. Machine learning-based methods need to characterize network traffic first, but this requires a large amount of expert prior knowledge, and artificially designed features may not be guaranteed to be representative and comprehensive. Although deep learning methods can lower the threshold of expert knowledge, designing an effective neural network architecture is itself a challenging task. In addition, to find out which neural network architecture is best for the current task requires a lot of experimentation and redesign, which requires huge human and material resources.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种用于流量分类的神经网络架构自动搜索方法及装置,目的在于实现自动的神经网络架构的搜索。The present application provides an automatic search method and device for a neural network architecture for traffic classification, aiming at realizing automatic neural network architecture search.
为了解决上述问题,本申请提供了如下技术方案:In order to solve the above problems, the application provides the following technical solutions:
一方面,提供一种用于流量分类的神经网络架构自动搜索方法,包括以下步骤:In one aspect, an automatic search method for a neural network architecture for traffic classification is provided, comprising the following steps:
获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;Obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
将流量数据集分别划分成训练集、验证集和测试集;Divide the traffic data set into training set, validation set and test set respectively;
在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;An optional operation to build the search space of the neural network architecture after the traffic dataset is partitioned;
基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神 经网络架构。Based on the optional operation of the search space, search for the optimal neural network structure; including searching for the optimal Cell structure, repeating the search and stacking the same Cell structure, and forming the searched Cell structure into the entire neural network structure.
本申请实施例采取的技术方案还包括:方法还包括:The technical solutions adopted in the embodiments of the present application also include: the method further includes:
在每个Cell的输出位置加上空间注意力和通道注意力;Add spatial attention and channel attention to the output position of each Cell;
保存搜索出来的Cell架构参数,并使用训练集和验证集合并成的新训练集进行重新训练Cell架构。Save the searched Cell architecture parameters, and retrain the Cell architecture with a new training set that combines the training set and the validation set.
本申请实施例采取的技术方案还包括:在获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集中包括:The technical solutions adopted in the embodiments of the present application further include: in acquiring network traffic data samples, preprocessing the data samples and converting the data samples into a traffic data set in the form of a two-dimensional matrix, including:
步骤一:在网络流粒度进行数据提取;Step 1: perform data extraction at network flow granularity;
步骤二:在数据包粒度进行数据提取;Step 2: carry out data extraction at packet granularity;
步骤三:将在网络流粒度提取数据和在数据包粒度提取的数据沿通道维度进行拼接组成张量;Step 3: splicing the data extracted at the network flow granularity and the data extracted at the data packet granularity along the channel dimension to form a tensor;
步骤四:对所有网络流进行上述第一步至第三步的操作,构建格式化的流量数据集。Step 4: Perform the operations from Step 1 to Step 3 above for all network flows to construct a formatted traffic data set.
本申请实施例采取的技术方案还包括:在将流量数据集分别划分成训练集、验证集和测试集中包括:The technical solution adopted in the embodiment of the present application further includes: dividing the traffic data set into training set, verification set and test set respectively includes:
训练集、验证集及测试集中含有相同比例的各类别流量;其中,The training set, validation set and test set contain the same proportion of traffic of each category; among them,
训练集用于更新该结构中的网络权重参数;The training set is used to update the network weight parameters in this structure;
验证集用于搜索最佳的网络结构参数;The validation set is used to search for the best network structure parameters;
测试集用于在搜索完成后使用训练集加验证集进行重新训练、并在测试集上评测最终结果。The test set is used to retrain using the training set plus the validation set after the search is complete, and to evaluate the final results on the test set.
本申请实施例采取的技术方案还包括:构建搜索空间的可选操作中包括:限定搜索神经网络架构空间的范围。The technical solutions adopted in the embodiments of the present application further include: the optional operation of constructing the search space includes: limiting the scope of the search neural network architecture space.
本申请实施例采取的技术方案还包括:神经网络架构的搜索空间的可选操 作为设置为:3x3深度可分离卷积、5x5深度可分离卷积、3x3空洞卷积、5x5空洞卷积、3x3最大化池化及3x3平均池化。The technical solutions adopted in the embodiments of the present application further include: the optional operation of the search space of the neural network architecture is set as: 3x3 depthwise separable convolution, 5x5 depthwise separable convolution, 3x3 hole convolution, 5x5 hole convolution, 3x3 Maximum pooling and 3x3 average pooling.
本申请实施例采取的技术方案还包括:在基于搜索空间的可选操作,搜索最优的神经网络架构中包括:The technical solutions adopted in the embodiments of the present application further include: in the optional operation based on the search space, searching for the optimal neural network architecture includes:
步骤一:构建超网;其中,在超网中扩展八条边的操作,且每条边有不同的权重;Step 1: Build a supernet; in which, the operation of extending eight edges in the supernet, and each edge has a different weight;
步骤二:在验证集损失上使用梯度下降法更新神经网络架构参数;Step 2: Use gradient descent on the validation set loss to update the neural network architecture parameters;
步骤三:在训练集损失上使用梯度下降法更新操作权重参数;Step 3: Use the gradient descent method to update the operation weight parameters on the training set loss;
步骤四:重复步骤二、步骤三直至神经网络架构训练完成;Step 4: Repeat steps 2 and 3 until the neural network architecture training is completed;
步骤五:训练完成后,保留节点权重最大的那条边。Step 5: After the training is completed, keep the edge with the largest node weight.
本申请实施例采取的技术方案还包括:在每个Cell的输出位置加上空间注意力和通道注意力中包括:The technical solution adopted in the embodiment of the present application also includes: adding spatial attention and channel attention to the output position of each Cell, including:
步骤一:通过对搜索出的Cell结构的输出后面加入通道注意力进行处理,得到通道注意力权重;Step 1: The channel attention weight is obtained by adding channel attention to the output of the searched Cell structure;
步骤二:通过对搜索出的Cell结构的输出后面加入空间注意力进行处理,得到空间注意力权重;Step 2: The spatial attention weight is obtained by adding spatial attention to the output of the searched Cell structure;
步骤三:将得到的通道注意力权重和空间注意力权重进行矩阵乘法,得到注意力加权的新输出。Step 3: Perform matrix multiplication of the obtained channel attention weight and spatial attention weight to obtain a new output of attention weighting.
另一方面,提供一种用于流量分类的神经网络架构自动搜索装置,装置包括:In another aspect, a neural network architecture automatic search device for traffic classification is provided, the device comprising:
数据转换模块:用于获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;Data conversion module: used to obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
数据分成模块:用于将流量数据集分别划分成训练集、验证集和测试集;Data division module: used to divide the traffic data set into training set, validation set and test set respectively;
可选操作构建模块:用于在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;Optional operation building block: optional operation used to build the search space of the neural network architecture after the traffic dataset is divided;
搜索最优网络架构模块:用于基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。Search for the optimal network architecture module: It is used to search for the optimal neural network architecture based on the optional operation of the search space; including, searching for the optimal Cell structure, repeating the search for stacking the same Cell structure, and forming the searched Cell structure into a whole Neural network architecture.
本申请实施例采取的技术方案还包括:装置还包括:The technical solutions adopted in the embodiments of the present application further include: the device further includes:
注意力加入模块:用于在每个Cell的输出位置加上空间注意力和通道注意力;Attention adding module: used to add spatial attention and channel attention to the output position of each Cell;
重新训练模块:用于保存搜索出来的Cell架构参数,并使用训练集和验证集合并成的新训练集进行重新训练Cell架构。Retraining module: used to save the searched Cell architecture parameters, and retrain the Cell architecture using a new training set that combines the training set and the validation set.
相对于现有技术,本申请实施例产生的有益效果在于:本申请实施例中的用于流量分类的神经网络架构自动搜索方法及装置,获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;将流量数据集分别划分成训练集、验证集和测试集;在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。本申请能够通过给定的候选操作自动地搜索出最优的神经网络结构,而无需人工的参与。Compared with the prior art, the beneficial effects of the embodiments of the present application are as follows: the neural network architecture automatic search method and device for traffic classification in the embodiments of the present application obtain network traffic data samples, preprocess the data samples, and transfer the data samples. The traffic data set in the form of a two-dimensional matrix; the traffic data set is divided into training set, validation set and test set respectively; after the traffic data set is divided, the optional operation of constructing the search space of the neural network architecture; the search space-based optional operation The selection operation is performed to search for the optimal neural network architecture; which includes, searching for the optimal Cell structure, repeatedly searching and stacking the same Cell structure, and forming the searched Cell structure into the entire neural network structure. The present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
附图说明Description of drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The schematic embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the attached image:
图1是本申请实施例用于流量分类的神经网络架构自动搜索方法的流程图;1 is a flowchart of an automatic search method for a neural network architecture for traffic classification according to an embodiment of the present application;
图2是本申请实施例用于流量分类的神经网络架构自动搜索方法的优选流程图;Fig. 2 is the preferred flow chart of the neural network architecture automatic search method for traffic classification according to the embodiment of the present application;
图3是本申请实施例用于流量分类的神经网络架构自动搜索装置的模块图;3 is a block diagram of a neural network architecture automatic search device for traffic classification according to an embodiment of the present application;
图4是本申请实施例用于流量分类的神经网络架构自动搜索装置的优选模块图;4 is a preferred module diagram of a neural network architecture automatic search device for traffic classification according to an embodiment of the present application;
图5是本申请实施例用于流量分类的神经网络架构自动搜索装置的优选模块图;5 is a preferred module diagram of a neural network architecture automatic search device for traffic classification according to an embodiment of the present application;
图6是本申请实施例描述在搜索到的Cell结构后面加入注意力的原理图;FIG. 6 is a schematic diagram of adding attention after the searched Cell structure described in an embodiment of the present application;
图7是本申请实施例描述通道注意力的计算过程图;7 is a diagram illustrating a calculation process of channel attention in an embodiment of the present application;
图8是本申请实施例描述空间注意力的计算过程图。FIG. 8 is a diagram illustrating a calculation process of spatial attention according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包 括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second", etc. in the description and claims of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
实施例1Example 1
参见图1至图8,根据本申请一实施例,提供了一种用于流量分类的神经网络架构自动搜索方法,包括以下步骤:Referring to FIG. 1 to FIG. 8 , according to an embodiment of the present application, an automatic search method for a neural network architecture for traffic classification is provided, including the following steps:
S101:获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;S101: Obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
S102:将流量数据集分别划分成训练集、验证集和测试集;S102: Divide the traffic data set into training set, validation set and test set respectively;
S103:在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;S103: an optional operation of constructing a search space of the neural network architecture after the traffic data set is divided;
S104:基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。S104: Searching for an optimal neural network architecture based on an optional operation in the search space, which includes searching for an optimal Cell structure, repeatedly searching and stacking the same Cell structure, and forming the searched Cell structure into an entire neural network architecture.
本申请实施例中的用于流量分类的神经网络架构自动搜索方法及装置,获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;将流量数据集分别划分成训练集、验证集和测试集;在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。本申请能够通过给定的候选操作自动地搜索出最优的神经网络结构,而无需人工的参与。The neural network architecture automatic search method and device for traffic classification in the embodiment of the present application obtains network traffic data samples, preprocesses the data samples and converts them into a traffic data set in the form of a two-dimensional matrix; and divides the traffic data sets into separate into a training set, a validation set and a test set; after the traffic data set is divided, an optional operation to construct the search space of the neural network architecture; an optional operation based on the search space to search for the optimal neural network architecture; including, searching for the most optimal neural network architecture. For an optimal Cell structure, repeat the search and stack the same Cell structure, and form the searched Cell structure into the entire neural network architecture. The present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
实施例中,方法还包括:In an embodiment, the method further includes:
S105:在每个Cell的输出位置加上空间注意力和通道注意力;S105: Add spatial attention and channel attention to the output position of each Cell;
S106:保存搜索出来的Cell架构参数,并使用训练集和验证集合并成的新训练集进行重新训练Cell架构。S106: Save the searched Cell architecture parameters, and retrain the Cell architecture using a new training set formed by combining the training set and the validation set.
本申请技术中将空间注意力、通道注意力机制结合在搜索到的每个Cell结构中,增强了模型的特征提取能力。In the technology of this application, the spatial attention and channel attention mechanisms are combined into each cell structure searched, which enhances the feature extraction capability of the model.
本申请技术中在搜索到的每个Cell结构的输出位置中,加上空间注意力和通道注意力,以增强模型的特征提取能力;将加上空间注意力和通道注意力训练得到的Cell架构参数保存下来之后,继续重新训练直至训练完。In the technology of this application, spatial attention and channel attention are added to the output position of each cell structure searched to enhance the feature extraction ability of the model; the Cell structure obtained by adding spatial attention and channel attention training will be added. After the parameters are saved, continue to retrain until the training is complete.
实施例中,在获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集中包括:In the embodiment, in the acquisition of network traffic data samples, the data samples are preprocessed and converted into a traffic data set in the form of a two-dimensional matrix, including:
步骤一:在网络流粒度进行数据提取;Step 1: perform data extraction at network flow granularity;
步骤二:在数据包粒度进行数据提取;Step 2: carry out data extraction at packet granularity;
步骤三:将在网络流粒度提取数据和在数据包粒度提取的数据沿通道维度进行拼接组成张量;Step 3: splicing the data extracted at the network flow granularity and the data extracted at the data packet granularity along the channel dimension to form a tensor;
步骤四:对所有网络流进行上述第一步至第三步的操作,构建格式化的流量数据集。Step 4: Perform the operations from Step 1 to Step 3 above for all network flows to construct a formatted traffic data set.
下面以具体实施例,对本申请的将数据样本进行预处理并转成二维矩阵形式的流量数据集进行详细说明:The following describes in detail the flow data set that the data samples of the present application are preprocessed and converted into a two-dimensional matrix form with specific examples:
步骤一,在网络流粒度进行数据提取,将网络流的前个字节提取出来,组成
Figure PCTCN2021088293-appb-000001
的二维矩阵m 1
Step 1: Perform data extraction at the network flow granularity, extract the previous byte of the network flow, and form
Figure PCTCN2021088293-appb-000001
The two-dimensional matrix m 1 of .
步骤二,在数据包粒度进行数据提取,对一个流的前η个数据包进行字节提取,每个数据包提取前α/η个字节,总计α字节,组成
Figure PCTCN2021088293-appb-000002
的二维矩阵m 2
Step 2, perform data extraction at the data packet granularity, extract bytes from the first n data packets of a flow, extract the first α/n bytes of each data packet, total α bytes, and form
Figure PCTCN2021088293-appb-000002
The two-dimensional matrix m 2 of .
步骤三,将m 1和m 2沿通道维度进行拼接,组成32*32*3的张量。 Step 3, splicing m 1 and m 2 along the channel dimension to form a 32*32*3 tensor.
步骤四,对所有网络流进行上述第一步至第三步的操作,构建格式化的流 量数据集。Step 4: Perform the operations from Steps 1 to 3 above on all network flows to construct a formatted traffic data set.
实施例中,在将流量数据集分别划分成训练集、验证集和测试集中包括:In the embodiment, dividing the traffic data set into training set, validation set and test set respectively includes:
训练集、验证集及测试集中含有相同比例的各类别流量;其中,The training set, validation set and test set contain the same proportion of traffic of each category; among them,
训练集用于更新该结构中的网络权重参数;The training set is used to update the network weight parameters in this structure;
验证集用于搜索最佳的网络结构参数;The validation set is used to search for the best network structure parameters;
测试集用于在搜索完成后使用训练集加验证集进行重新训练、并在测试集上评测最终结果。The test set is used to retrain using the training set plus the validation set after the search is complete, and to evaluate the final results on the test set.
将上述构建的流量数据集进行划分,一部分用于训练,一部分用于验证,剩余的部分用于测试。每个集中含有相同比例的各类别流量。训练集用于更新该结构中的网络权重参数,验证集用于搜索最佳的网络结构参数,在搜索完成后使用训练集结合验证集进行重新训练,并在测试集上评测最终结果。The traffic dataset constructed above is divided, one part is used for training, one part is used for validation, and the remaining part is used for testing. Each set contains the same proportion of each category of traffic. The training set is used to update the network weight parameters in the structure, and the validation set is used to search for the best network structure parameters. After the search is completed, the training set and the validation set are used for retraining, and the final result is evaluated on the test set.
实施例中,构建搜索空间的可选操作中包括:限定搜索神经网络架构空间的范围。自动神经架构搜索的可选操作是无限的,为了降低复杂度我们需要限定搜索空间的范围。In the embodiment, the optional operation of constructing the search space includes: limiting the scope of searching the neural network architecture space. The optional operations for automatic neural architecture search are infinite, and to reduce complexity we need to limit the scope of the search space.
实施例中,神经网络架构的搜索空间的可选操作为设置为:3x3深度可分离卷积、5x5深度可分离卷积、3x3空洞卷积、5x5空洞卷积、3x3最大化池化及3x3平均池化。本申请中搜索空间的可选操作包括:3x3深度可分离卷积、5x5深度可分离卷积、3x3空洞卷积、5x5空洞卷积、3x3最大化池化、3x3平均池化、恒等及直连共八个操作。In the embodiment, optional operations of the search space of the neural network architecture are set to: 3x3 depthwise separable convolution, 5x5 depthwise separable convolution, 3x3 atrous convolution, 5x5 atrous convolution, 3x3 max pooling and 3x3 averaging pooling. Optional operations on the search space in this application include: 3x3 depthwise separable convolution, 5x5 depthwise separable convolution, 3x3 atrous convolution, 5x5 atrous convolution, 3x3 max pooling, 3x3 average pooling, identity and direct A total of eight operations.
实施例中,在基于搜索空间的可选操作,搜索最优的神经网络架构中包括:In the embodiment, in the optional operation based on the search space, searching for the optimal neural network architecture includes:
步骤一:构建超网;其中,在超网中扩展八条边的操作,且每条边有不同的权重;Step 1: Build a supernet; in which, the operation of extending eight edges in the supernet, and each edge has a different weight;
步骤二:在验证集损失上使用梯度下降法更新神经网络架构参数;Step 2: Use gradient descent on the validation set loss to update the neural network architecture parameters;
步骤三:在训练集损失上使用梯度下降法更新操作权重参数;Step 3: Use the gradient descent method to update the operation weight parameters on the training set loss;
步骤四:重复步骤二、步骤三直至神经网络架构训练完成;Step 4: Repeat steps 2 and 3 until the neural network architecture training is completed;
步骤五:训练完成后,保留节点权重最大的那条边。Step 5: After the training is completed, keep the edge with the largest node weight.
本搜索方法属于微观搜索,即搜索一个最优的Cell结构,然后重复堆叠相同的Cell形成整个网络。每一个Cell中包含四个节点,节点代表某一个时刻的特征图。节点与节点之间的边代表某种可选操作,总的可选操作数有种,本例中为八种。最终需要搜索出一个有向无环图,即一个Cell的结构,如图5所示。This search method belongs to microscopic search, that is, to search for an optimal Cell structure, and then repeatedly stack the same Cell to form the entire network. Each Cell contains four nodes, and the nodes represent the feature map at a certain moment. The edges between nodes represent some kind of optional operation, and the total number of optional operations is eight kinds. Finally, it is necessary to search for a directed acyclic graph, that is, the structure of a Cell, as shown in Figure 5.
下面以具体实施例,对本申请搜索最优的神经网络架构的过程进行详细说明:The process of searching for the optimal neural network architecture in the present application will be described in detail below with specific embodiments:
步骤一:通过超网构建公式构建超网,在超网中扩展八条边的操作,且每条边有不同的权重;超网构建公式如下:Step 1: Build a supernet through the supernet construction formula, expand the operation of eight edges in the supernet, and each edge has a different weight; the supernet construction formula is as follows:
Figure PCTCN2021088293-appb-000003
Figure PCTCN2021088293-appb-000003
其中,o(x)是可选操作集合中的其中一个操作,即代表八条边中的某一条边;
Figure PCTCN2021088293-appb-000004
指的是该边o(x)的权重,(i,j)限定了该边是属于i和j节点之间的;
Figure PCTCN2021088293-appb-000005
表示节点i和i之间的八条边加权操作,通过该加权操作的计算能够得到一个特征图;另外,该公式使用了Softmax函数对
Figure PCTCN2021088293-appb-000006
进行了处理;
Among them, o(x) is one of the operations in the optional operation set, that is, it represents one of the eight sides;
Figure PCTCN2021088293-appb-000004
Refers to the weight of the edge o(x), (i, j) defines that the edge belongs between the i and j nodes;
Figure PCTCN2021088293-appb-000005
Represents the weighted operation of eight edges between nodes i and i, and a feature map can be obtained through the calculation of the weighted operation; in addition, the formula uses the Softmax function to
Figure PCTCN2021088293-appb-000006
processed;
步骤二:在验证集损失上使用梯度下降法更新神经网络架构参数α,公式如下:Step 2: Use the gradient descent method to update the neural network architecture parameter α on the validation set loss, the formula is as follows:
Figure PCTCN2021088293-appb-000007
Figure PCTCN2021088293-appb-000007
步骤三:在训练集损失上使用梯度下降法更新操作权重参数w,公式如下:Step 3: Use the gradient descent method to update the operation weight parameter w on the training set loss, the formula is as follows:
Figure PCTCN2021088293-appb-000008
Figure PCTCN2021088293-appb-000008
步骤四:重复步骤二、步骤三直至神经网络架构训练完成;Step 4: Repeat steps 2 and 3 until the neural network architecture training is completed;
步骤五:训练完成后,通过节点保留公式实现保留节点(i,j)之间权重最大
Figure PCTCN2021088293-appb-000009
的那条边;节点保留公式为:
Step 5: After the training is completed, the maximum weight between the reserved nodes (i, j) is achieved through the node reservation formula
Figure PCTCN2021088293-appb-000009
The edge of ; the node retention formula is:
Figure PCTCN2021088293-appb-000010
Figure PCTCN2021088293-appb-000010
其中,每个节点只保留与前面两个具有最大权重边的节点的连接。where each node only retains connections to the previous two nodes with the largest weighted edges.
实施例中,在每个Cell的输出位置加上空间注意力和通道注意力中包括:In the embodiment, adding spatial attention and channel attention to the output position of each Cell includes:
步骤一:通过对搜索出的Cell结构的输出后面加入通道注意力进行处理,得到通道注意力权重;Step 1: The channel attention weight is obtained by adding channel attention to the output of the searched Cell structure;
步骤二:通过对搜索出的Cell结构的输出后面加入空间注意力进行处理,得到空间注意力权重;Step 2: The spatial attention weight is obtained by adding spatial attention to the output of the searched Cell structure;
步骤三:将得到的通道注意力权重和空间注意力权重进行矩阵乘法,得到注意力加权的新输出。Step 3: Perform matrix multiplication of the obtained channel attention weight and spatial attention weight to obtain a new output of attention weighting.
下面以具体实施例,如图6和图8所示,对本申请每个Cell的输出位置加上空间注意力和通道注意力的过程进行详细说明:The process of adding spatial attention and channel attention to the output position of each Cell of the present application will be described in detail below with specific embodiments, as shown in Figures 6 and 8:
步骤一:对搜索出的Cell结构的输出后面加入通道注意力,如图7所示;其中包括,首先对维度为h*w*C的x分别采取全局平均池化以及全局最大池化得到两个1*1*C的张量,然后使用一个共享的MLP层对该两个张量进一步提取特征,并将它们相加后经过Sigmoid函数得到通道注意力权重M cStep 1: Add channel attention to the output of the searched Cell structure, as shown in Figure 7; which includes, first, global average pooling and global maximum pooling are used for x with dimension h*w*C to obtain two A 1*1*C tensor, and then use a shared MLP layer to further extract features from the two tensors, and add them to obtain the channel attention weight M c through the Sigmoid function.
步骤二:对搜索出的Cell结构的输出后面加入空间注意力,如图8所示;其中包括,首先对维度为h*w*C的x分别采取全局平均池化以及全局最大池化得到两个h*w*1的张量,然后使用一个卷积核将该两个张量转换为一个h*w*1的特征图,再经过Sigmoid函数处理后得到空间注意力权重M sStep 2: Add spatial attention to the output of the searched Cell structure, as shown in Figure 8; which includes, first, global average pooling and global maximum pooling are adopted for x with dimension h*w*C to obtain two h*w*1 tensors, and then use a convolution kernel to convert the two tensors into a h*w*1 feature map, and then process the Sigmoid function to obtain the spatial attention weight M s .
步骤三:将得到的通道注意力权重M c和空间注意力权重M s通过矩阵乘法公式在原输出维度x上进行矩阵乘法,得到注意力加权的新输出x',矩阵乘法公式如下所示: Step 3: Perform matrix multiplication on the original output dimension x through the matrix multiplication formula with the obtained channel attention weight M c and spatial attention weight M s to obtain a new output x' of attention weighting. The matrix multiplication formula is as follows:
x'=M s×(M c×x) x'=M s ×(M c ×x)
实施例2Example 2
根据本申请的另一实施例,提供了一种用于流量分类的神经网络架构自动搜索装置,参见图3至图8,包括:According to another embodiment of the present application, a neural network architecture automatic search device for traffic classification is provided, referring to FIG. 3 to FIG. 8 , including:
数据转换模块:用于获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;Data conversion module: used to obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
数据分成模块:用于将流量数据集分别划分成训练集、验证集和测试集;Data division module: used to divide the traffic data set into training set, validation set and test set respectively;
可选操作构建模块:用于在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;Optional operation building block: optional operation used to build the search space of the neural network architecture after the traffic dataset is divided;
搜索最优网络架构模块:用于基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。Search for the optimal network architecture module: It is used to search for the optimal neural network architecture based on the optional operation of the search space; including, searching for the optimal Cell structure, repeating the search for stacking the same Cell structure, and forming the searched Cell structure into a whole Neural network architecture.
本申请实施例中的用于流量分类的神经网络架构自动搜索方法及装置,数据转换模块:用于获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;数据分成模块:用于将流量数据集分别划分成训练集、验证集和测试集;可选操作构建模块:用于在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;搜索最优网络架构模块:用于基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。本申请能够通过给定的候选操作自动地搜索出最优的神经网络结构,而无需人工的参 与。The neural network architecture automatic search method and device for traffic classification in the embodiment of the present application, and the data conversion module: used to obtain network traffic data samples, preprocess the data samples, and convert them into a traffic data set in the form of a two-dimensional matrix; Data division module: used to divide the traffic data set into training set, validation set and test set respectively; optional operation building module: optional operation used to construct the search space of the neural network architecture after the traffic data set is divided; search Optimal network architecture module: It is used to search for the optimal neural network architecture based on the optional operation of the search space; including, searching for the optimal Cell structure, repeatedly searching and stacking the same Cell structure, and forming the searched Cell structure into the entire neural network. Network Architecture. The present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
实施例中,装置还包括:In an embodiment, the device further includes:
注意力加入模块:用于在每个Cell的输出位置加上空间注意力和通道注意力;Attention adding module: used to add spatial attention and channel attention to the output position of each Cell;
重新训练模块:用于保存搜索出来的Cell架构参数,并使用训练集和验证集合并成的新训练集进行重新训练Cell架构。Retraining module: used to save the searched Cell architecture parameters, and retrain the Cell architecture using a new training set that combines the training set and the validation set.
本申请技术中将空间注意力、通道注意力机制结合在搜索到的每个Cell结构中,增强了模型的特征提取能力。In the technology of this application, the spatial attention and channel attention mechanisms are combined into each cell structure searched, which enhances the feature extraction capability of the model.
本申请技术中在搜索到的每个Cell结构的输出位置中,加上空间注意力和通道注意力,以增强模型的特征提取能力;将加上空间注意力和通道注意力训练得到的Cell架构参数保存下来之后,继续重新训练直至训练完。In the technology of this application, spatial attention and channel attention are added to the output position of each cell structure searched to enhance the feature extraction ability of the model; the Cell structure obtained by adding spatial attention and channel attention training will be added. After the parameters are saved, continue to retrain until the training is complete.
本申请的有益效果在于:The beneficial effects of this application are:
1.本申请实施例中的用于流量分类的神经网络架构自动搜索方法及装置,获取网络流量数据样本,将数据样本进行预处理并转成二维矩阵形式的流量数据集;将流量数据集分别划分成训练集、验证集和测试集;在流量数据集划分后,构建神经网络架构的搜索空间的可选操作;基于搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。本申请能够通过给定的候选操作自动地搜索出最优的神经网络结构,而无需人工的参与。1. The neural network architecture automatic search method and device for traffic classification in the embodiment of the present application obtains network traffic data samples, preprocesses the data samples and converts them into a traffic data set in the form of a two-dimensional matrix; It is divided into training set, validation set and test set respectively; after the division of the traffic data set, the optional operation of constructing the search space of the neural network architecture; the optional operation based on the search space, searching for the optimal neural network architecture; including, Search for the optimal Cell structure, repeat the search and stack the same Cell structure, and form the searched Cell structure into the entire neural network architecture. The present application can automatically search for the optimal neural network structure through a given candidate operation without manual participation.
2.本申请使用的是两个粒度的数据二维矩阵提取,从而形成双通道的输入。2. The application uses two-dimensional data matrix extraction with two granularities, thereby forming a dual-channel input.
3.本申请在每个Cell结构中加入了空间注意力和通道注意力以增强特征提取能力。3. This application adds spatial attention and channel attention to each Cell structure to enhance feature extraction capabilities.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本申请。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, this application is not intended to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

  1. 一种用于流量分类的神经网络架构自动搜索方法,其特征在于,包括以下步骤:A neural network architecture automatic search method for traffic classification, characterized in that it comprises the following steps:
    获取网络流量数据样本,将所述数据样本进行预处理并转成二维矩阵形式的流量数据集;Obtaining network traffic data samples, preprocessing the data samples and converting them into a traffic data set in the form of a two-dimensional matrix;
    将所述流量数据集分别划分成训练集、验证集和测试集;dividing the traffic data set into training set, validation set and test set respectively;
    在所述流量数据集划分后,构建神经网络架构的搜索空间的可选操作;An optional operation of constructing a search space of a neural network architecture after the traffic data set is divided;
    基于所述搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。Based on the optional operation of the search space, searching for an optimal neural network architecture includes, searching for an optimal Cell structure, repeatedly searching and stacking the same Cell structure, and forming the searched Cell structure into an entire neural network architecture.
  2. 根据权利要求1所述的用于流量分类的神经网络架构自动搜索方法,其特征在于,所述方法还包括:The neural network architecture automatic search method for traffic classification according to claim 1, wherein the method further comprises:
    在每个Cell的输出位置加上空间注意力和通道注意力;Add spatial attention and channel attention to the output position of each Cell;
    保存搜索出来的Cell架构参数,并使用所述训练集和所述验证集合并成的新训练集进行重新训练Cell架构。Save the cell architecture parameters searched out, and retrain the Cell architecture using a new training set formed by combining the training set and the verification set.
  3. 根据权利要求2所述的用于流量分类的神经网络架构自动搜索方法,其特征在于,在获取网络流量数据样本,将所述数据样本进行预处理并转成二维矩阵形式的流量数据集中包括:The automatic search method for neural network architecture for traffic classification according to claim 2, characterized in that, when acquiring network traffic data samples, preprocessing the data samples and converting them into a traffic data set in the form of a two-dimensional matrix including: :
    步骤一:在网络流粒度进行数据提取;Step 1: perform data extraction at network flow granularity;
    步骤二:在数据包粒度进行数据提取;Step 2: carry out data extraction at packet granularity;
    步骤三:将在网络流粒度提取数据和在数据包粒度提取的数据沿通道维度进行拼接组成张量;Step 3: splicing the data extracted at the network flow granularity and the data extracted at the data packet granularity along the channel dimension to form a tensor;
    步骤四:对所有网络流进行上述第一步至第三步的操作,构建格式化的流量数据集。Step 4: Perform the operations from Step 1 to Step 3 above for all network flows to construct a formatted traffic data set.
  4. 根据权利要求2所述的用于流量分类的神经网络架构自动搜索方法,其特征在于,在将所述流量数据集分别划分成训练集、验证集和测试集中包括:The neural network architecture automatic search method for traffic classification according to claim 2, wherein dividing the traffic data set into a training set, a verification set and a test set respectively comprises:
    所述训练集、验证集及测试集中含有相同比例的各类别流量;其中,The training set, verification set and test set contain the same proportion of traffic of each category; wherein,
    所述训练集用于更新该结构中的网络权重参数;The training set is used to update the network weight parameters in the structure;
    所述验证集用于搜索最佳的网络结构参数;The validation set is used to search for optimal network structure parameters;
    所述测试集用于在搜索完成后使用训练集加验证集进行重新训练、并在测试集上评测最终结果。The test set is used for retraining using the training set plus the validation set after the search is completed, and the final result is evaluated on the test set.
  5. 根据权利要求2所述的用于流量分类的神经网络架构自动搜索方法,其特征在于,所述构建搜索空间的可选操作中包括:限定搜索神经网络架构空间的范围。The method for automatically searching neural network architectures for traffic classification according to claim 2, wherein the optional operation of constructing a search space includes: limiting the scope of searching the neural network architecture space.
  6. 根据权利要求5所述的用于流量分类的神经网络架构自动搜索方法,其特征在于,所述神经网络架构的搜索空间的可选操作为设置为:3x3深度可分离卷积、5x5深度可分离卷积、3x3空洞卷积、5x5空洞卷积、3x3最大化池化及3x3平均池化。The automatic search method for a neural network architecture for traffic classification according to claim 5, wherein the optional operation of the search space of the neural network architecture is set as: 3×3 depthwise separable convolution, 5×5 depthwise separable convolution Convolution, 3x3 atrous convolution, 5x5 atrous convolution, 3x3 max pooling and 3x3 average pooling.
  7. 根据权利要求2所述的用于流量分类的神经网络架构自动搜索方法,其特征在于,所述在基于所述搜索空间的可选操作,搜索最优的神经网络架构中包括:The method for automatically searching a neural network architecture for traffic classification according to claim 2, wherein the searching for an optimal neural network architecture based on the optional operation of the search space comprises:
    步骤一:构建超网;其中,在所述超网中扩展八条边的操作,且每条边有不同的权重;Step 1: constructing a supernet; wherein, the operation of extending eight edges in the supernet, and each edge has a different weight;
    步骤二:在所述验证集损失上使用梯度下降法更新神经网络架构参数;Step 2: Use gradient descent method to update neural network architecture parameters on the validation set loss;
    步骤三:在所述训练集损失上使用梯度下降法更新操作权重参数;Step 3: Use gradient descent method to update the operation weight parameters on the loss of the training set;
    步骤四:重复步骤二、步骤三直至所述神经网络架构训练完成;Step 4: Repeat Step 2 and Step 3 until the neural network architecture training is completed;
    步骤五:训练完成后,保留节点权重最大的那条边。Step 5: After the training is completed, keep the edge with the largest node weight.
  8. 根据权利要求6所述的用于流量分类的神经网络架构自动搜索方法,其特征在于,所述在每个Cell的输出位置加上空间注意力和通道注意力中包括:The neural network architecture automatic search method for traffic classification according to claim 6, wherein the adding spatial attention and channel attention to the output position of each Cell includes:
    步骤一:通过对搜索出的所述Cell结构的输出后面加入通道注意力进行处理,得到通道注意力权重;Step 1: The channel attention weight is obtained by adding channel attention to the output of the cell structure searched out for processing;
    步骤二:通过对搜索出的所述Cell结构的输出后面加入空间注意力进行处理,得到空间注意力权重;Step 2: The spatial attention weight is obtained by adding spatial attention to the output of the searched Cell structure;
    步骤三:将得到的通道注意力权重和空间注意力权重进行矩阵乘法,得到注意力加权的新输出。Step 3: Perform matrix multiplication of the obtained channel attention weight and spatial attention weight to obtain a new output of attention weighting.
  9. 一种用于流量分类的神经网络架构自动搜索装置,其特征在于,所述装置包括:A neural network architecture automatic search device for traffic classification, characterized in that the device comprises:
    数据转换模块:用于获取网络流量数据样本,将所述数据样本进行预处理并转成二维矩阵形式的流量数据集;Data conversion module: used to obtain network traffic data samples, preprocess the data samples and convert them into a traffic data set in the form of a two-dimensional matrix;
    数据分成模块:用于将所述流量数据集分别划分成训练集、验证集和测试集;Data division module: used to divide the traffic data set into training set, validation set and test set respectively;
    可选操作构建模块:用于在所述流量数据集划分后,构建神经网络架构的搜索空间的可选操作;Optional operation building module: an optional operation for constructing the search space of the neural network architecture after the traffic data set is divided;
    搜索最优网络架构模块:用于基于所述搜索空间的可选操作,搜索最优的神经网络架构;其中包括,搜索最优的Cell结构,重复搜索堆叠相同的Cell结构,将搜索的Cell结构形成整个神经网络架构。Searching the optimal network architecture module: used to search for the optimal neural network architecture based on the optional operation of the search space; including, searching for the optimal Cell structure, repeatedly searching for stacking the same Cell structure, and combining the searched Cell structure Form the entire neural network architecture.
  10. 根据权利要求9所述的用于流量分类的神经网络架构自动搜索装置,其特征在于,所述装置还包括:The neural network architecture automatic search device for traffic classification according to claim 9, wherein the device further comprises:
    注意力加入模块:用于在每个Cell的输出位置加上空间注意力和通道注意力;Attention adding module: used to add spatial attention and channel attention to the output position of each Cell;
    重新训练模块:用于保存搜索出来的Cell架构参数,并使用所述训练集和所述验证集合并成的新训练集进行重新训练Cell架构。Retraining module: used to save the cell architecture parameters searched out, and retrain the Cell architecture using a new training set formed by combining the training set and the verification set.
PCT/CN2021/088293 2021-04-20 2021-04-20 Neural network architecture automatic search method and device for traffic classification WO2022222020A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/088293 WO2022222020A1 (en) 2021-04-20 2021-04-20 Neural network architecture automatic search method and device for traffic classification

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/088293 WO2022222020A1 (en) 2021-04-20 2021-04-20 Neural network architecture automatic search method and device for traffic classification

Publications (1)

Publication Number Publication Date
WO2022222020A1 true WO2022222020A1 (en) 2022-10-27

Family

ID=83723631

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/088293 WO2022222020A1 (en) 2021-04-20 2021-04-20 Neural network architecture automatic search method and device for traffic classification

Country Status (1)

Country Link
WO (1) WO2022222020A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115760777A (en) * 2022-11-21 2023-03-07 脉得智能科技(无锡)有限公司 Hashimoto's thyroiditis diagnostic system based on neural network structure search

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111818052A (en) * 2020-07-09 2020-10-23 国网山西省电力公司信息通信分公司 CNN-LSTM-based industrial control protocol homologous attack detection method
CN112053351A (en) * 2020-09-08 2020-12-08 哈尔滨工业大学(威海) Method for judging benign and malignant pulmonary nodules based on neural network architecture search and attention mechanism
US20200401899A1 (en) * 2019-06-20 2020-12-24 Google Llc Computationally efficient neural network architecture search
CN112215269A (en) * 2020-09-27 2021-01-12 苏州浪潮智能科技有限公司 Model construction method and device for target detection and neural network architecture
CN112651406A (en) * 2020-12-18 2021-04-13 浙江大学 Depth perception and multi-mode automatic fusion RGB-D significance target detection method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200401899A1 (en) * 2019-06-20 2020-12-24 Google Llc Computationally efficient neural network architecture search
CN111818052A (en) * 2020-07-09 2020-10-23 国网山西省电力公司信息通信分公司 CNN-LSTM-based industrial control protocol homologous attack detection method
CN112053351A (en) * 2020-09-08 2020-12-08 哈尔滨工业大学(威海) Method for judging benign and malignant pulmonary nodules based on neural network architecture search and attention mechanism
CN112215269A (en) * 2020-09-27 2021-01-12 苏州浪潮智能科技有限公司 Model construction method and device for target detection and neural network architecture
CN112651406A (en) * 2020-12-18 2021-04-13 浙江大学 Depth perception and multi-mode automatic fusion RGB-D significance target detection method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115760777A (en) * 2022-11-21 2023-03-07 脉得智能科技(无锡)有限公司 Hashimoto's thyroiditis diagnostic system based on neural network structure search
CN115760777B (en) * 2022-11-21 2024-04-30 脉得智能科技(无锡)有限公司 Hashimoto thyroiditis diagnosis system based on neural network structure search

Similar Documents

Publication Publication Date Title
CN112308158B (en) Multi-source field self-adaptive model and method based on partial feature alignment
CN109685819B (en) Three-dimensional medical image segmentation method based on feature enhancement
Fu et al. Fast crowd density estimation with convolutional neural networks
CN111783831B (en) Complex image accurate classification method based on multi-source multi-label shared subspace learning
WO2019001070A1 (en) Adjacency matrix-based connection information organization system, image feature extraction system, and image classification system and method
Wang et al. App-net: A hybrid neural network for encrypted mobile traffic classification
CN107766850A (en) Based on the face identification method for combining face character information
CN112733656A (en) Skeleton action identification method based on multi-stream space attention diagram convolution SRU network
JP2015052832A (en) Weight setting device and method
CN113052254B (en) Multi-attention ghost residual fusion classification model and classification method thereof
CN104463194A (en) Driver-vehicle classification method and device
CN110993037A (en) Protein activity prediction device based on multi-view classification model
CN110069959A (en) A kind of method for detecting human face, device and user equipment
Chen et al. Convolutional neural network for classification of solar radio spectrum
CN112766378A (en) Cross-domain small sample image classification model method focusing on fine-grained identification
CN113128308B (en) Pedestrian detection method, device, equipment and medium in port scene
WO2022222020A1 (en) Neural network architecture automatic search method and device for traffic classification
CN114359578A (en) Application method and system of pest and disease damage identification intelligent terminal
CN114463340A (en) Edge information guided agile remote sensing image semantic segmentation method
CN115546654A (en) Grouping mixed attention-based remote sensing scene image classification method
CN110414338B (en) Pedestrian re-identification method based on sparse attention network
Zhang et al. Network traffic classification method based on improved capsule neural network
Hollósi et al. Improve the accuracy of neural networks using capsule layers
CN116821905A (en) Knowledge search-based malicious software detection method and system
Ji et al. Traffic classification based on graph convolutional network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21937271

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21937271

Country of ref document: EP

Kind code of ref document: A1