A method for building a lightweight multi-exit point model based on neural architecture search

Optimizing the design of multi-exit point models through neural architecture search solves the problems of low accuracy and poor model size trade-off in the power field, achieves efficient image recognition tasks in edge scenarios with limited resources, and provides flexible Model selection to adapt to dynamic resource environments.

CN114861906BActive Publication Date: 2024-09-06TIANJIN UNIV +2
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202210423171.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-21
Publication Date
2024-09-06
Estimated Expiration
2042-04-21

AI Technical Summary

Technical Problem

Existing multi-exit point models suffer from the problems of low accuracy and poor model size trade-off in computer vision tasks in the electric power field. Especially in edge scenarios with limited resources, it is difficult to dynamically adapt to resource consumption during the inference process.

Method used

Adopt a method based on neural architecture search, design a multi-exit point model through a tree structure, use the tailoring and recombination of convolutional neural networks to build a search space, combine the reinforcement learning algorithm of policy gradients to optimize the model architecture, and automatically search for a suitable neural network structure to trade off accuracy and model size.

Benefits of technology

In the image recognition task on the power edge side, the model accuracy and resource utilization rate are improved, the model volume is reduced, the accuracy and model size requirements of different devices are met, and the cost of manual design is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114861906B
    Figure CN114861906B
Patent Text Reader

Abstract

The present invention discloses a method for establishing a lightweight multi-exit point model based on neural architecture search, comprising the following steps: collecting power grid image data to construct a sample data set, dividing the sample data set into a training set and a test set; designing a multi-exit point model architecture including a backbone network and a branch classifier based on a tree structure; constructing a search space by trimming and recombining several convolutional neural networks, establishing an objective function based on an image classification task with a trade-off between model classification accuracy and model size as the goal; inputting the training set into the search space, optimizing the objective function using a policy gradient reinforcement learning algorithm, and training based on the multi-exit point model architecture to obtain a multi-exit point model. The present invention can well balance the accuracy and parameter size of the searched neural network, and realize the compression of the image classification model on the edge side of the power.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of neural network, and specifically relates to a method for establishing a lightweight multi-exit point model based on neural architecture search. Background Art

[0002] In recent years, deep convolutional neural networks have achieved good accuracy in computer vision tasks, but the improvement in accuracy is often accompanied by higher requirements for computing and memory costs. For example, in the power sector, due to the different computing power of its equipment, if you want to deploy deep convolutional neural networks in its scenarios to perform image recognition tasks in the power sector, you need to perform certain lightweight operations on the original complex network. Early technologies such as pruning and knowledge distillation cannot dynamically adapt to resource consumption during the reasoning process, which poses severe challenges to complex and changeable edge scenarios with limited computing power, especially in some memory-constrained application scenarios.

[0003] To address the above issues, a lightweight multi-exit point model obtained by Neural Architecture Search (NAS) can balance accuracy and model size, providing an effective solution for computer vision tasks in the power field. However, the design of a multi-exit point model is difficult, and the cost of manually designing a deep convolutional neural network is very high. Traditional multi-exit point models are all manually designed, and factors such as the number of exits, exit locations, and exit structures need to be considered, and they have poor time efficiency. In addition, the accuracy of different exits in the multi-exit point model varies greatly, and the early exits have low accuracy, which does not achieve a good trade-off between accuracy and model size. Summary of the invention

[0004] In view of the technical problems of low precision and failure to achieve a trade-off between precision and model size in the prior art multi-exit point model, the present invention proposes a method for establishing a lightweight multi-exit point model based on neural architecture search. To solve the above technical problems, the technical solutions adopted by the present invention are as follows:

[0005] A method for establishing a lightweight multi-exit point model based on neural architecture search, comprising the following steps:

[0006] S1, collect power grid image data to build a sample data set, and divide the sample data set into a training set and a test set;

[0007] S2, based on the tree structure, designs a multi-exit point model architecture including a backbone network and branch classifiers;

[0008] S3, constructs a search space by trimming and recombining several convolutional neural networks, and establishes an objective function based on the image classification task to balance the model classification accuracy and model size;

[0009] S4, input the training set into the search space established in step S3, optimize the objective function using the policy gradient reinforcement learning algorithm, and train based on the multi-exit point model architecture established in step S2 to obtain a multi-exit point model.

[0010] The step S3 comprises the following steps:

[0011] S3.1, select several convolutional neural networks, and cut the convolutional neural networks into several convolutional blocks according to the network structure;

[0012] S3.2, constructing all convolution blocks obtained in step S3.1 into a search space of layer l, wherein the search space is a directed acyclic graph;

[0013] S3.3, based on the image classification task, establish an objective function with the goal of balancing the model classification accuracy and model size.

[0014] In step S3.3, the formula of the objective function is:

[0015]

[0016] The constraints of the objective function are:

[0017]

[0018] Where ACC(D, m(i, ω)) represents the classification accuracy of the multi-exit point sub-model m(i, ω) on the sample data set D. represents the number of parameters of the multi-exit point sub-model m(i, ω), β is a constant, n represents the total number of training rounds, and L train (m i ,ω) represents the training loss of the multi-exit point sub-model m(i,ω), ω * represents the model weights of all multi-exit sub-models, and ω represents the model weight of a single multi-exit sub-model.

[0019] The step S4 comprises the following steps:

[0020] S4.1, establishing a controller based on the long short-term memory network, searching for the optimal subgraph as the multi-exit point sub-model in the search space established in step S3;

[0021] S4.2, using the controller to sample the multi-exit point sub-model, and using the stochastic gradient descent method to update the model weights of the multi-exit point sub-model to minimize the expected loss function;

[0022] S4.3, fix the model weights updated in step S4.2, set the verification accuracy and model size of the multi-exit point model as the reward function, and use the test set to update the controller parameters with the goal of maximizing the expected reward;

[0023] S4.4, determine if i<n, where i represents the current training round number and n represents the total training round number. If so, return to step S4.2; otherwise, output the trained multi-exit point model.

[0024] In step S4.3, the formula of the reward function is:

[0025]

[0026] In the formula, Acc(m i ,ω) represents the verification accuracy of the multi-exit point sub-model m(i,ω) on the test set, represents the parameter quantity of the sampled multi-exit point sub-model m(i, ω), R(m i ,ω) represents the reward function of the multi-exit point sub-model m(i,ω), and P represents the number of parameters of the baseline convolutional neural network.

[0027] Beneficial effects of the present invention:

[0028] The search space is constructed by using convolution blocks of different high-performance residual neural networks to improve the accuracy of the multi-exit point model; a search space is constructed using an automatic search method, and then a suitable neural network is found in the search space to automate the design process and avoid the cost of manually designing the model. A search strategy based on reinforcement learning is adopted, and the network accuracy and network model size in the network training process are used as rewards. What kind of convolution block is selected as the action in the next step, and the parameters of the controller and shared network are trained alternately, which well balances the accuracy and parameter size of the searched neural network and realizes the compression of the image model on the edge side of the power industry. The network structure is designed using neural architecture search technology, and the lightweight multi-exit point model obtained can flexibly select network branches according to the needs of edge scenarios such as the power field, meeting the needs of different devices for model size and task accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present invention 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0030] Figure 1 Schematic diagram of the multiple exit point model.

[0031] Figure 2 Schematic diagram of the relationship between model parameters and accuracy. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] A method for building a lightweight multi-exit point model based on neural architecture search, such as Figure 1 As shown, the following steps are included:

[0034] S1, collect power grid image data to build a sample data set, and randomly divide the sample data set into a training set and a test set;

[0035] The sample data set is represented by D, D = {l j}, l j ∈R x×y×c represents the jth grid image, x represents the length of the image, y represents the width of the image, c represents the number of channels of the image, R x×y×c Indicates the specifications of the image, namely the length, width and number of channels.

[0036] S2, based on the tree structure, designs a multi-exit point model architecture including a backbone network and branch classifiers;

[0037] The multi-exit point model architecture is a tree structure, with the backbone network f m It is the trunk, which has the most network layers and the most parameters. The branch classifier f a It is the branch of the tree, with fewer network layers and fewer parameters.

[0038] In this embodiment, the backbone network and the branch classifiers are obtained through Neural Architecture Search (NAS). The image is input into the trained model and the classification result can be generated through the classifier. In the existing design, some network models with better performance often have more complex modules. This application replaces these complex modules with simple modules, and these simple modules also come from these network models. How to replace and what modules to replace are determined by the neural architecture search, which can make the backbone network achieve the purpose of lightweight model without reducing the classification accuracy. The branch classifier network has a small number of network parameters and a small number of network layers. Multiple searches based on NAS to form more branch networks constitute multiple exit points, thereby providing greater flexibility and better adaptability to dynamic reasoning environments such as sample difficulty and fluctuating system resources.

[0039] S3, by cutting and recombining several convolutional neural networks to construct a search space, based on the image classification task to balance the model classification accuracy and model size as the goal to establish an objective function, including the following steps:

[0040] S3.1, select several convolutional neural networks, and cut the convolutional neural networks into several convolutional blocks according to the network structure;

[0041] The convolutional neural network can select the current mainstream high-performance networks such as ResNet (Residual Neural Network), ResNeXt and Res2Net, and cut them according to the different layers of the network, divide the network into residual blocks, and form several convolution blocks.

[0042] S3.2, constructing all convolution blocks obtained in step S3.1 into a search space of layer l, wherein the search space is a directed acyclic graph;

[0043] The nodes in the directed acyclic graph represent convolution blocks, and the edges represent the information flow between the corresponding nodes. Therefore, the total number of nodes in the search space of layer l is H. Each layer of the search space is equivalent to a convolution layer of the neural network, and each layer has different convolution blocks, which is determined by the position of the convolution blocks in the original neural network. There are k nodes in the search space of each layer, and each node corresponds to a candidate residual block (Residual block), which comes from ResNet, ResNeXt or Res2Net, and H = k*l.

[0044] The number of layers in the entire network is set to l+2. The first and last layers are fixed, which are the input layer and the output layer respectively. The search of each layer is independent. Therefore, there are a total of When establishing a search space, it is necessary to consider which node to select and which node is connected to which previous node.

[0045] In order to facilitate the connection between convolution blocks during the search process, this embodiment sets the number of channels of all convolutions to 256, where N represents the number of convolution blocks in each layer, and C represents the number of groups of convolution blocks in each layer of ResNeXt from the search space. Table 1 shows all convolution blocks after adjusting the number of channels.

[0046] Table 1 Convolutional blocks in the search space

[0047]

[0048]

[0049] S3.3, based on the image classification task, establish an objective function to balance the model classification accuracy and model size;

[0050] The image classification task refers to the classification of power images. For example, in the power field, the tasks of identifying helmets and the direction of cranes are very complex and need to be classified. The formula of the objective function of the image classification task is:

[0051]

[0052] The constraints of the objective function are:

[0053]

[0054] Where ACC(D, m(i, ω)) represents the classification accuracy of the multi-exit point sub-model m(i, ω) on the sample data set D. represents the multi-exit point sub-model m(i, ω), that is, the multi-exit point sub-model m i The parameter size, β is a constant, which indicates the intensity of resource constraints on the device, n is the total number of training rounds, and L train (m i ,ω) represents the training loss of the multi-exit point sub-model m(i,ω), ω * represents the model weights of all multi-exit point sub-models, and ω represents the model weight of a sub-model, which is obtained by standard cross entropy and is used to decide how to perform the classification task. In the example, if the edge device resources are sufficient and there is no need to limit the model size, β is set to This becomes a traditional classification problem. When the edge device is subject to greater resource constraints, β is set to a larger value.

[0055] S4, inputting the training set into the search space established in step S3, optimizing the objective function using the policy gradient reinforcement learning algorithm, and training based on the multi-exit point model architecture established in step S2 to obtain a multi-exit point model, including the following steps:

[0056] S4.1, establishing a controller based on a long short-term memory network (LSTM), searching for the optimal subgraph in the search space established in step S3 as a multi-exit point sub-model;

[0057] The controller is an LSTM with 100 hidden units.

[0058] S4.2, using the controller to sample the multi-exit point sub-model, and using the stochastic gradient descent (SGD) method to update the model weights of the multi-exit point sub-model to minimize the expected loss function, thereby obtaining a sub-model with better performance;

[0059] First, the controller strategy π(m, θ) is fixed. For each searched multi-exit point sub-model m(i, ω), the model weight ω of each multi-exit point sub-model is updated using the stochastic gradient descent method to minimize the expected loss function. At the same time, the gradient is calculated using the Monte Carlo estimation. The gradient update formula is:

[0060]

[0061] Where L(m, ω) represents the standard cross entropy loss of the multi-exit point sub-model m(i, ω) sampled from the strategy π(m, θ). The smaller the cross entropy loss, the better the model effect. M represents the number of samples of the multi-exit point sub-model, θ represents the controller parameter, and E m~π(m;θ) [L(m, ω)] represents the expected loss function. In this embodiment, represents the gradient of the multi-exit point sub-model m(i, ω) sampled from the policy π(m, θ), Provides an unbiased estimate.

[0062] S4.3, fix the model weights updated in step S4.2, set the verification accuracy and model size of the multi-exit point sub-model as the reward function, take maximizing the expected reward as the goal, and use the test set to update the controller parameters;

[0063] The reward function is calculated on the test set, which can prevent the overfitting of the model on the training set. The reward function is set by combining the control of the size of the multi-exit point sub-model and the verification accuracy of the sub-model. The calculation formula of the reward function R(m, ω) is:

[0064]

[0065] In the formula, Acc(m i ,ω) represents the verification accuracy of the multi-exit point sub-model m(i,ω) on the test set, represents the parameter quantity of the sampled multi-exit point sub-model m(i, ω), R(m i , ω) represents the reward function of the multi-exit point sub-model m(i, ω), P represents the parameters of the baseline convolutional neural network, and the baseline convolutional neural network is ResNet34. It can ensure that the size of the searched multi-exit point sub-model is about half the size of the convolutional neural network, thus obtaining a lightweight sub-model. m~π(m;θ) [R(m,ω)] represents.

[0066] The controller is used to execute each action, that is, to select the nodes and connection methods of each layer to generate a sub-model. In the reinforcement learning method based on policy gradient descent, two sets of parameters need to be updated, namely the controller parameters θ and the shared parameters ω of the sub-model, that is, the model weights. In the first stage, the shared parameters of the sub-model are trained, and in the second stage, the controller parameters are trained. These two stages are performed alternately. At the same time, the strategy π(m, θ) calculates the policy gradient after each action. Following the gradient method, the controller gradually adjusts the action, searching for a better performing network module and connection method each time until the optimal strategy is obtained, achieving a higher verification accuracy, that is, verification precision, and a smaller model through parameter updates.

[0067] S4.4, determine if i<n, if so, return to step S4.2, otherwise output the trained multi-exit point model.

[0068] Taking the model compression problem on the power edge as an example, the lightweight multi-exit point technology based on neural architecture search is used to search the tree structure, and compared with the traditional multi-exit point model and visual model, the technical advantages of this solution are obtained.

[0069] Since the equipment on the edge of the power grid is usually resource-constrained, only lightweight models with small memory usage and simple calculations can be provided. Model lightweighting can alleviate the resource constraints of equipment on the edge of the power grid, and exchange a smaller model size for an acceptable performance compensation price, so that the model can be successfully trained and operated on the edge of the power grid to complete the required information collection, data analysis and other tasks. Therefore, in the resource-constrained power sector, in order to achieve tasks such as accurate data processing, it is necessary to use the lightweight multi-exit point model of this application to achieve model compression in the power sector, compressing the model while providing accuracy assurance to effectively reduce the model size.

[0070] like Figure 2 As shown, a comparison chart of the accuracy and model size of the lightweight multi-exit point model based on neural architecture search and the traditional deep neural network in image classification tasks is given. This application (NAS with different exits) uses ResNet and its variants (ResNet and its variants), some lightweight models (Lightweightmodels) such as MobileNet_v2, ShuffleNet_v2, GoogLeNet, and DenseNet for comparison. It can be seen that ResNet and its variants have better accuracy, but their parameters are too large and are not convenient for deployment in edge environments; while the lightweight models in other existing works have smaller parameters, their accuracy is significantly reduced; and the network parameters searched by this application have a wider distribution range. When the parameters are the same, the network accuracy of this application is higher, and the accuracy is close to the best ResNet. Therefore, it can be explained that this application can effectively reduce the model size and improve resource utilization while ensuring accuracy.

[0071] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for establishing a lightweight multi-exit point model based on neural architecture search, characterized in that, it includes the following steps: S1. Collect power grid image data to construct a sample data set, and divide the sample data set into a training set and a test set; S2. Based on a tree structure, design a multi-exit point model architecture including a backbone network and branch classifiers; S3. Construct a search space by pruning and recombining several convolutional neural networks, and establish an objective function based on an image classification task with the goal of balancing model classification accuracy and model size; S4. Input the training set into the search space established in step S3, use the reinforcement learning algorithm of policy gradient to optimize the objective function, and train based on the multi-exit point model architecture established in step S2 to obtain a multi-exit point model; The step S3 includes the following steps: S3.

1. Select several convolutional neural networks, and cut each convolutional neural network into several convolutional blocks according to the network structure; S3.

2. Construct all the convolutional blocks obtained in step S3.1 into an l-layer search space, and the search space is a directed acyclic graph; S3.

3. Based on the image classification task, establish an objective function with the goal of balancing model classification accuracy and model size.

2. The method for establishing a lightweight multi-exit point model based on neural architecture search according to claim 1, characterized in that, in step S3.3, the formula of the objective function is: The constraint condition of the objective function is: Where ACC(D,m(i,ω)) represents the classification accuracy of the multi-exit point sub-model m(i,ω) on the sample data set D. represents the multi-exit point sub-model m(i,ω) or the multi-exit point sub-model m i The number of parameters, β is a constant, n represents the total number of training rounds, L train (m i, ω) represents the training loss of the multi-exit point sub-model m(i,ω), ω * represents the model weights of all multi-exit sub-models, and ω represents the model weight of a single multi-exit sub-model.

3. The method for establishing a lightweight multi-exit point model based on neural architecture search according to claim 1, characterized in that, the step S4 includes the following steps: S4.

1. Establish a controller based on a long short-term memory network, and search for an optimal subgraph in the search space established in step S3 as a multi-exit point sub-model; S4.

2. Sample the multi-exit point sub-model using the controller, and update the model weights of the multi-exit point sub-model using the stochastic gradient descent method to minimize the expected loss function; S4.

3. Fix the updated model weights in step S4.2, set the validation accuracy and model size of the multi-exit point sub-model as the reward function, and update the controller parameters using the test set with the goal of maximizing the expected reward; S4.

4. Judge whether i < n, where i represents the current training round and n represents the total number of training rounds. If so, return to step S4.2, otherwise output the trained multi-exit point model.

4. The method for establishing a lightweight multi-exit point model based on neural architecture search according to claim 3, characterized in that, in step S4.3, the formula of the reward function is: In the formula, Acc(m i ,ω) represents the multi-exit point sub-model m(i,ω) or the multi-exit point sub-model m i The validation accuracy on the test set is represents the number of parameters of the sampled multi-exit point sub-model m(i,ω), R(m i ,ω) represents the reward function of the multi-exit point sub-model m(i,ω), P represents the number of parameters of the baseline convolutional neural network, and ω represents the model weight.

Citation Information

Patent Citations

  • Pedestrian re-identification model construction method and device based on neural architecture search

    CN110852168A

  • Neural network architecture search method, neural network application method, equipment and storage medium

    CN111814966A

  • Convolutional neural network compression method based on channel number search

    CN111882040A

  • System and method for supervised learning of permeability of earth formations

    EP3935470A1

  • Text field detection using neural networks

    US20190385054A1