CN109754080A - The pruning method of Embedded network model - Google Patents
The pruning method of Embedded network model Download PDFInfo
- Publication number
- CN109754080A CN109754080A CN201811570293.1A CN201811570293A CN109754080A CN 109754080 A CN109754080 A CN 109754080A CN 201811570293 A CN201811570293 A CN 201811570293A CN 109754080 A CN109754080 A CN 109754080A
- Authority
- CN
- China
- Prior art keywords
- channel
- convolutional layer
- convolution kernel
- model
- convolutional
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Landscapes
- Image Analysis (AREA)
Abstract
The invention discloses a kind of pruning method of Embedded network model, the technical issues of the practicability is poor for solving existing pruning method.Technical solution is to initially set up mobilenetSSD network model, carries out a forward direction operation, obtains data needed for beta pruning calculates;Those are picked out to the unessential channel of convolutional layer calculated result by lasso recurrence, and picking out in these channels by lasso algorithm influences lower channel to summed result;Original one layer of convolution is decomposed into a channel separation convolutional layer and convolutional layer by Mobilenet, and the input channel of channel separation convolutional layer is equal to its output channel.The present invention is chosen to go out unessential channel in all convolutional layers and do the trimming on channel to all convolutional layers then according to the special construction of mobilenet using lasso, completes the compression acceleration of mobilenetSSD, practicability is good to reduce reconstructed error as core.
Description
Technical field
The present invention relates to a kind of pruning method, in particular to a kind of pruning method of Embedded network model.
Background technique
With the development of depth convolutional network model in artificial intelligence field, the performance of catenet model is higher and higher,
However when being deployed on some embedded devices, it is limited to limited computing resource, the speed of service is excessively slow.
For the acceleration compression method of neural network model, it is critical that with algorithm and chooses those in network not
Then important node deletes these redundant nodes to complete the compression acceleration of network model.Yang et al. is in document
“Designing energyefficient convolutional neural networks using energy-aware
Pruning.arXiv preprint arXiv:1611.05128, the method based on parameter value carries out beta pruning in 2016. ", net
The relatively low node of those parameter values is cut off in network, and the influence to model is lower, and can accelerate network operation speed.But
This method beta pruning effect based on threshold value excessively relies on specific network model, can not accomplish when model complexity effective excellent
Change.
Mobilenet is Howard etc. in " MobileNets:Efficient Convolutional Neural
Networks forMobile Vision Applications.arXiv preprint arXiv:1704.04861,2017”
The lightweight network that a kind of Embedded equipment of middle proposition proposes, however when doing object detection task,
MobilenetSSD speed on most of embedded device is also very low, cannot reach practical application request, this is to depth network
The practicability of model has very big influence.
Summary of the invention
In order to overcome the shortcomings of existing pruning method, the practicability is poor, and the present invention provides a kind of Embedded network model
Pruning method.This method initially sets up mobilenetSSD network model, carries out a forward direction operation, obtains needed for beta pruning calculating
Data;Those are picked out to the unessential channel of convolutional layer calculated result by lasso recurrence, and convolutional calculation is all channels pair
It should be multiplied and sum again, being picked out in these channels by lasso algorithm influences lower channel to summed result;Mobilenet
Original one layer of convolution is decomposed into a channel separation convolutional layer and convolutional layer, the input channel of channel separation convolutional layer
Equal to its output channel.The present invention chooses to go out those in all convolutional layers and do not weigh using lasso to reduce reconstructed error as core
The trimming on channel is done to all convolutional layers then according to the special construction of mobilenet in the channel wanted, and completes
The compression acceleration of mobilenetSSD, practicability are good.
A kind of the technical solution adopted by the present invention to solve the technical problems: beta pruning side of Embedded network model
Method, its main feature is that the following steps are included:
Step 1: the state of driver is divided into, a left side is seen, the right side is seen, bow, close one's eyes, make a phone call, yawn and normal driving
Seven states.First data are labeled, then modify mobilenetSSD, it is made to export seven states, are existed based on model
Trained model, is finely adjusted training in new task on imagenet data set, obtains being able to detect the new of driving condition
Model.
Step 2: establishing network model, a forward direction operation is carried out, obtains the data and ginseng of all convolutional layers in network
Number;It is as follows that cut operator is done to all the points convolutional layer: to a convolutional layer, first taking out the convolution kernel parameter matrix W of this layer, shape is
N × c × h × w respectively refers to the number of convolution kernel, the port number of convolution kernel, the width of convolution kernel and the height of convolution kernel.Then it takes
Input data in this convolutional layer is sampled to obtain X, and shape is N × c × h × w, and N refers to the number of samples of data.
Step 3: directly sampling or being calculated the output Y of the convolutional layer, calculating output is that input X and parameter W is corresponding
Channel is multiplied, and all channels sum to obtain Y, and shape is N × n.Ignore the bias term in parameter, wherein i refers to feature channel.
Step 4: note β is that channel selecting vector cuts off the channel when value is 0, it is otherwise left with the channel, remembers beta pruning
Model reconstruction error afterwards is
The solving optimization function is a np problem, so being loosely following formula by it, λ is penalty coefficient, is used
The lasso algorithm optimization objective function obtains selection coefficient vector β.
Step 5: repeating step 2 to all convolutional layers to four, obtaining the channel selecting vector selection system of all convolutional layers
Number vector β, last time carry out parameter trimming.
Step 6: to each convolutional layer, according to selection coefficient vector β, remove corresponding position convolution kernel or all convolution
The corresponding channel of core;Corresponding convolution kernel is cut off to channel separation convolutional layer, the correspondence in all convolution kernels is cut off to convolutional layer
Channel, i.e. the convolution kernel number of channel separation convolutional layer are reduced, and point convolutional layer center port number is reduced.And channel separation convolution
The convolution kernel number and input channel of layer are equal, so the output channel of i.e. upper some convolutional layers of the input of channel separation convolutional layer
Also the number of convolution kernel is reduced corresponding to trimming.
Step 7: doing fine tuning training to new model, model accuracy rate is further increased, embedded device is finally deployed to
On.
The beneficial effects of the present invention are: this method initially sets up mobilenetSSD network model, a forward direction fortune is carried out
It calculates, obtains data needed for beta pruning calculates;Those are picked out to the unessential channel of convolutional layer calculated result by lasso recurrence,
Convolutional calculation is that corresponding be multiplied in all channels is summed again, and being picked out in these channels by lasso algorithm influences summed result
Lower channel;Original one layer of convolution is decomposed into a channel separation convolutional layer and convolutional layer, channel by Mobilenet
The input channel for separating convolutional layer is equal to its output channel.The present invention chooses institute using lasso to reduce reconstructed error as core
Have and goes out those unessential channels in convolutional layer and then according to the special construction of mobilenet channel is done to all convolutional layers
On trimming, complete the compression acceleration of mobilenetSSD, practicability is good.
Specifically, new model accuracy loss is lower after optimization, when twice of acceleration, new model accuracy is declined by less than 1%.
More accurate more effective than the method for original threshold value because calculating the weight coefficient in channel using lasso, the model after beta pruning accelerates
Rate is higher, and precision is not lost substantially.
New pruning method application range is wider, can be used in beta pruning network model all at present, and robustness is higher.
Optimizing mobilenetSSD network model, faster, model is smaller, and precision is basically unchanged for new network model speed,
It can achieve the faster speed of service under limited computing resource.
It elaborates with reference to the accompanying drawings and detailed description to the present invention.
Detailed description of the invention
Fig. 1 is respectively channel separation convolutional layer (DepthwiseConv) and point convolutional layer (PointConv).
Fig. 2 is common convolutional layer example.
Specific embodiment
Referring to Fig.1-2.
The core of this method is that sampling obtains several input and output of convolutional layer, based on lasso algorithm according to above data
The evaluation coefficient for calculating each channel selects unessential channel, cuts off the corresponding part convolution kernel in channel.With driver status
For detection model, specific step is as follows for the pruning method of Embedded network model of the present invention:
Step 1: firstly, acquisition data, modify and train new model.By the state of driver be divided into a left side is seen, the right side is seen,
It bows, close one's eyes, making a phone call, yawning and 7 states of normal driving.First data are labeled, are then modified
MobilenetSSD makes it export 7 states, model trained model on imagenet data set is based on, in new task
On be finely adjusted training, obtain the new model for being able to detect driving condition.
Step 2: establishing network model, a forward direction operation is carried out, obtains the data and ginseng of all convolutional layers in network
Number;It is as follows that cut operator is done to all the points convolutional layer: to a convolutional layer, first taking out the convolution kernel parameter matrix W of this layer, shape is
N × c × h × w respectively refers to the number of convolution kernel, the port number of convolution kernel, the width of convolution kernel and the height of convolution kernel.Then it takes
Input data in this convolutional layer is sampled to obtain X, and shape is N × c × h × w, and N refers to the number of samples of data.
Step 3: directly sampling or being calculated the output Y of the convolutional layer, calculating output is that input X and parameter W is corresponding
Channel is multiplied, and finally all channels sum to obtain Y, and shape is N × n.Here the bias term in parameter is had ignored, wherein i refers to
Feature channel.
Step 4: note β is that channel selecting vector can then cut off the channel, otherwise be left with the channel when value is 0, remember
Model reconstruction error after beta pruning is
And the solving optimization function is a np problem, so being loosely following formula by it, λ is penalty coefficient, is used
The lasso algorithm optimization objective function obtains selection coefficient vector β.
Step 5: repeating step 2 to all convolutional layers to four, obtaining the channel selecting vector selection system of all convolutional layers
Number vector β, last time carry out parameter trimming.
Step 6: parameter is trimmed: to each convolutional layer, according to selection coefficient vector β, remove corresponding position convolution kernel or
The corresponding channel of all convolution kernels;Corresponding convolution kernel is cut off to channel separation convolutional layer, all convolution kernels are cut off to a convolutional layer
In corresponding channel, i.e., channel separation convolutional layer convolution kernel number reduce, point convolutional layer center port number reduce.And channel
Convolution kernel number and the input channel for separating convolutional layer are equal, so i.e. upper some convolutional layers of the input of channel separation convolutional layer
Output channel also will reduce the number of convolution kernel corresponding to trimming.
Step 7: doing fine tuning training to new model, model accuracy rate is further increased, is finally deployed on embedded device.
Claims (1)
1. a kind of pruning method of Embedded network model, it is characterised in that the following steps are included:
Step 1: the state of driver is divided into, a left side is seen, the right side is seen, bow, close one's eyes, make a phone call, yawn and normal driving seven
State.First data are labeled, then modify mobilenetSSD, it is made to export seven states, are existed based on model
Trained model, is finely adjusted training in new task on imagenet data set, obtains being able to detect the new of driving condition
Model.
Step 2: establishing network model, a forward direction operation is carried out, obtains the data and parameter of all convolutional layers in network;It is right
It is as follows that all the points convolutional layer does cut operator: to a convolutional layer, first taking out the convolution kernel parameter matrix W of this layer, shape is n × c
× h × w respectively refers to the number of convolution kernel, the port number of convolution kernel, the width of convolution kernel and the height of convolution kernel.Then this is taken
Input data in convolutional layer is sampled to obtain X, and shape is N × c × h × w, and N refers to the number of samples of data.
Step 3: directly sampling or being calculated the output Y of the convolutional layer, calculating output is input X and parameter W corresponding channel
It is multiplied, all channels sum to obtain Y, and shape is N × n.Ignore the bias term in parameter, wherein i refers to feature channel.
Step 4: note β is that channel selecting vector cuts off the channel when value is 0, it is otherwise left with the channel, after remembering beta pruning
Model reconstruction error is
The solving optimization function is a np problem, so being loosely following formula by it, λ is penalty coefficient, is calculated using lasso
Method optimizes the objective function, obtains selection coefficient vector β.
Step 5: to all convolutional layers, repeat step 2 to four, obtain all convolutional layers channel selecting vector select coefficient to
β is measured, last time carries out parameter trimming.
Step 6: to each convolutional layer, according to selection coefficient vector β, the convolution kernel or all convolution kernels of corresponding position are removed
Corresponding channel;Corresponding convolution kernel is cut off to channel separation convolutional layer, the corresponding channel in all convolution kernels is cut off to convolutional layer,
I.e. the convolution kernel number of channel separation convolutional layer is reduced, and point convolutional layer center port number is reduced.And channel separation convolutional layer
Convolution kernel number and input channel are equal, so the output channel of i.e. upper some convolutional layers of the input of channel separation convolutional layer is also wanted
Corresponding trimming, that is, reduce the number of convolution kernel.
Step 7: doing fine tuning training to new model, model accuracy rate is further increased, is finally deployed on embedded device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811570293.1A CN109754080A (en) | 2018-12-21 | 2018-12-21 | The pruning method of Embedded network model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811570293.1A CN109754080A (en) | 2018-12-21 | 2018-12-21 | The pruning method of Embedded network model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109754080A true CN109754080A (en) | 2019-05-14 |
Family
ID=66403024
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811570293.1A Pending CN109754080A (en) | 2018-12-21 | 2018-12-21 | The pruning method of Embedded network model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109754080A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110619391A (en) * | 2019-09-19 | 2019-12-27 | 华南理工大学 | Detection model compression method and device and computer readable storage medium |
CN111898591A (en) * | 2020-08-28 | 2020-11-06 | 电子科技大学 | Modulation signal identification method based on pruning residual error network |
CN113276869A (en) * | 2021-05-17 | 2021-08-20 | 海南师范大学 | Device and method for automatically detecting that driver plays mobile phone |
WO2022022625A1 (en) * | 2020-07-29 | 2022-02-03 | 北京智行者科技有限公司 | Acceleration method and device for deep learning model |
WO2023123930A1 (en) * | 2021-12-30 | 2023-07-06 | 浪潮电子信息产业股份有限公司 | Image processing method, system, device and readable storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108764471A (en) * | 2018-05-17 | 2018-11-06 | 西安电子科技大学 | The neural network cross-layer pruning method of feature based redundancy analysis |
-
2018
- 2018-12-21 CN CN201811570293.1A patent/CN109754080A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108764471A (en) * | 2018-05-17 | 2018-11-06 | 西安电子科技大学 | The neural network cross-layer pruning method of feature based redundancy analysis |
Non-Patent Citations (3)
Title |
---|
ANDREW G. HOWARD ET AL.: "MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications", 《ARXIV》 * |
H.T.KUNG ET AL.: "Adaptive Tiling: Applying Fixed-size Systolic Arrays To Sparse Convolutional Neural Networks", 《ICPR 2018》 * |
YIHUI HE ET AL.: "Channel Pruning for Accelerating Very Deep Neural Networks", 《2017 IEEE INTERNATIONAL CONFERENCE ON COMPUTER VISION》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110619391A (en) * | 2019-09-19 | 2019-12-27 | 华南理工大学 | Detection model compression method and device and computer readable storage medium |
CN110619391B (en) * | 2019-09-19 | 2023-04-18 | 华南理工大学 | Detection model compression method and device and computer readable storage medium |
WO2022022625A1 (en) * | 2020-07-29 | 2022-02-03 | 北京智行者科技有限公司 | Acceleration method and device for deep learning model |
CN111898591A (en) * | 2020-08-28 | 2020-11-06 | 电子科技大学 | Modulation signal identification method based on pruning residual error network |
CN111898591B (en) * | 2020-08-28 | 2022-06-24 | 电子科技大学 | Modulation signal identification method based on pruning residual error network |
CN113276869A (en) * | 2021-05-17 | 2021-08-20 | 海南师范大学 | Device and method for automatically detecting that driver plays mobile phone |
WO2023123930A1 (en) * | 2021-12-30 | 2023-07-06 | 浪潮电子信息产业股份有限公司 | Image processing method, system, device and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109754080A (en) | The pruning method of Embedded network model | |
CN113313947B (en) | Road condition evaluation method of short-term traffic prediction graph convolution network | |
CN110781776B (en) | Road extraction method based on prediction and residual refinement network | |
CN108764317A (en) | A kind of residual error convolutional neural networks image classification method based on multichannel characteristic weighing | |
CN111612147A (en) | Quantization method of deep convolutional network | |
CN110276451A (en) | One kind being based on the normalized deep neural network compression method of weight | |
CN106294371B (en) | Character string codomain cutting method and device | |
CN108615049A (en) | A kind of vehicle part detection model compression method and system | |
CN106971241B (en) | Method for predicting sewage quality data based on fuzzy neural network | |
CN112217674A (en) | Alarm root cause identification method based on causal network mining and graph attention network | |
CN110442143A (en) | A kind of unmanned plane situation data clustering method based on combination multiple target dove group's optimization | |
CN116599857A (en) | Digital twin application system suitable for multiple scenes of Internet of things | |
CN113971457B (en) | Computing performance optimization method and system for neural network | |
CN114841412A (en) | Method for predicting pH value of sea cucumber growing water | |
CN113436101B (en) | Method for removing rain by Dragon lattice tower module based on efficient channel attention mechanism | |
CN114386686A (en) | Improved LSTM-based watershed water quality short-term prediction method | |
CN117521763A (en) | Artificial intelligent model compression method integrating regularized pruning and importance pruning | |
CN111639751A (en) | Non-zero padding training method for binary convolutional neural network | |
CN112232477A (en) | Image data processing method, apparatus, device and medium | |
CN103714385B (en) | Analogue circuit fault diagnosis method based on improved type clone selection algorithm | |
CN110751201A (en) | SAR equipment task failure cause reasoning method based on textural feature transformation | |
CN116524173A (en) | Deep learning network model optimization method based on parameter quantization | |
CN107273970B (en) | Reconfigurable platform of convolutional neural network supporting online learning and construction method thereof | |
CN116227563A (en) | Convolutional neural network compression and acceleration method based on data quantization | |
CN113487012A (en) | Deep convolution neural network accelerator facing FPGA and design method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190514 |
|
WD01 | Invention patent application deemed withdrawn after publication |