CN113947203A - YOLOV3 model pruning method for intelligent vehicle-mounted platform - Google Patents
YOLOV3 model pruning method for intelligent vehicle-mounted platform Download PDFInfo
- Publication number
- CN113947203A CN113947203A CN202111141559.2A CN202111141559A CN113947203A CN 113947203 A CN113947203 A CN 113947203A CN 202111141559 A CN202111141559 A CN 202111141559A CN 113947203 A CN113947203 A CN 113947203A
- Authority
- CN
- China
- Prior art keywords
- pruning
- model
- gamma
- value
- proportion
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/082—Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Health & Medical Sciences (AREA)
- Feedback Control In General (AREA)
Abstract
The invention discloses an intelligent automobile vehicle-mounted platform-oriented YOLOV3 model pruning method, which comprises the following steps of S1, selecting a batch normalization layer gamma parameter as a pruning factor, and performing sparse training on an original model by using an L1 regular term; s2, arranging pruning factors gamma in the convolutional layers which do not participate in cross-layer connection in the model after sparse training according to sizes; s3, setting different pruning proportions a, and determining a gamma value t corresponding to the optimal pruning proportion; and S4, selecting a convolution layer which does not participate in cross-layer connection in the model, and subtracting all channels with the gamma values smaller than t except the channel with the maximum gamma value in the batch normalization layer of the convolution layer. The method solves the problems that the existing target detection neural network model has large parameter quantity and high requirement on hardware, and is difficult to meet the real-time requirement of an intelligent driving vehicle-mounted platform; sparse training is introduced, so that parameters which have small influence on a model detection result approach to zero, pruning is facilitated, and the precision after pruning is ensured; the batch normalization layer gamma parameter is used as a pruning factor, so that extra calculation overhead is not brought, and the instantaneity is ensured.
Description
Technical Field
The invention belongs to the technical field of intelligent automobile driving software, and particularly relates to a YOLOV3 model pruning method for a vehicle-mounted platform.
Background
With the development of deep learning, the performance of the deep learning in the fields of target detection, classification and the like is far better than that of other methods, and the deep learning becomes the most mainstream algorithm in the aspect of intelligent driving obstacle detection. However, the neural network model trained by deep learning needs to use a relatively complex network structure in order to achieve relatively high accuracy, and the complex network structure causes large model parameters and high requirements on hardware, which contradicts with the limited resources of the intelligent driving vehicle-mounted platform. How to reduce the model volume and improve the reasoning speed while ensuring the precision becomes crucial. Aiming at a more mainstream YOLOV3 algorithm in the field of intelligent driving at present, the invention provides a model pruning method based on batch normalization layer parameters, which can greatly reduce the number of model parameters, improve the reasoning speed and meet the requirements of an intelligent driving vehicle-mounted platform while ensuring the model precision.
Disclosure of Invention
The invention aims to solve the problems that the existing neural network model has large parameter quantity and high requirement on hardware and is difficult to apply to an intelligent driving vehicle-mounted platform, and provides a model pruning method based on batch normalization layer parameters aiming at a more mainstream YOLOV3 algorithm in the field of intelligent driving at present, so that the model precision can be ensured, the model parameter quantity can be greatly reduced, and the reasoning speed can be improved.
The technical scheme adopted by the model pruning method for the intelligent automobile vehicle-mounted platform comprises the following steps:
s1, selecting a batch normalization layer gamma parameter in a model as a pruning factor, and performing sparse training on an original model by using an L1 regular term;
s2, arranging pruning factors gamma in the convolutional layers which do not participate in cross-layer connection in the model after sparse training according to sizes;
s3, setting different pruning proportions a, and determining the value t of a pruning factor gamma corresponding to the optimal pruning proportion;
and S4, selecting a convolution layer which does not participate in cross-layer connection in the model, and subtracting all channels with the gamma values smaller than t except the channel with the maximum gamma value in the batch normalization layer of the convolution layer.
Further, the implementation of S1 includes redesigning the loss function:
adding an L1 regularization term λ | γ | of a pruning factor γ to a YOLOV3 loss function, the new loss function being:
LL1=L+λ|γ|
where L is the primary loss function of YOLOV3 and λ is the balance factor.
Further, the lambda needs to observe the sparse effect of the model after training at different lambda values through an experimental method to determine the value of the lambda.
Further, during the sparsification training in S1, the distribution of the pruning factors gradually changes from a normal distribution near 1 to a distribution in which most of the pruning factors are compressed to 0, which is more beneficial to deleting a part of channels according to γ in the following.
Further, in S2, the γ values of the channels corresponding to different neurons after sparse training are arranged as 3, 1.6, and 0.02 from large to small.
Further, the implementation of S3 includes: setting different pruning proportions a, and selecting a relatively optimal result from the pruning results corresponding to the different pruning proportions as a final pruning result; for each pruning proportion a, taking the pruning proportion a as a quantile, and finding out the value t of the pruning factor at the position corresponding to the pruning proportion in the gamma values arranged from large to small in the step S2; when the gamma value is 100 to 1 and the tolerance is 1, the equal difference series {100, 99, 98 … … 2, 1}, if the pruning proportion is set to 0.3, 30% of the gamma values need to be deleted, then the minimum 30% of the gamma values is {30, 29, 28 … … 2, 1}, the corresponding value of t is the maximum value 30 of the minimum 30% of the gamma values, if the pruning proportion is set to 0.75, the value of the pruning factor t is 75, and so on.
Further, in S4, for all batch normalization layers in the convolutional layers that do not participate in cross-layer connection, the channel with the largest γ value is retained, and for other channels, if the γ value is smaller than the value t obtained in step S3, the channel is deleted, otherwise, the channel is retained; for convolution across layer connections in the model, no pruning is done.
Further, in S4, for different models, the pruning proportion corresponding to the best pruning effect is different, the best pruning proportion is selected according to the corresponding pruning result, the pruning results corresponding to the pruning proportion are shown in tables 1 and 2, and 0.75 is taken as the best pruning proportion:
TABLE 1 pruning results for different pruning ratios 1
TABLE 2 pruning results for different pruning ratios 2
Further, in S4, the number of each convolutional layer channel before and after pruning is shown in table 3:
TABLE 3 number of channels in layers of the model before and after pruning
The invention has the beneficial effects that:
(1) the problems that the existing target detection neural network model is large in parameter quantity, high in requirement on hardware and difficult to meet the real-time requirement of an intelligent driving vehicle-mounted platform are solved;
(2) sparse training is introduced, and parameters which have small influence on a model detection result approach to zero in the training process, so that pruning is facilitated and the precision of the pruned model is ensured;
(3) the batch normalization layer gamma parameter is used as a pruning factor, so that extra calculation overhead is not brought, and the real-time performance of the model is ensured.
Drawings
FIG. 1 is a flow chart of a model pruning method for a vehicle-mounted platform according to the present invention
FIG. 2 is a sparse training result
FIG. 3 is a generic training pruning factor distribution
FIG. 4 is a sparse training pruning factor distribution
FIG. 5 is a gamma value schematic of neurons and their batch normalization layer
Detailed Description
The invention will be further explained with reference to the drawings.
As shown in fig. 1, the implementation of the present invention comprises the following steps:
(1) adding the L1 regularization term λ | γ | of the pruning factor γ to the YOLOV3 loss function, the new loss function becomes:
LL1=L+λ|γ|
in the formula, L is a loss function of YOLOV3, lambda is a balance factor, and lambda needs to observe the sparse effect of the model after training at different lambda values through an experimental method so as to determine the value of the lambda.
And continuously training the model added with the new loss function on the basis of the model obtained by basic training. The number of times of model training is not fixed, but training is continued for a certain number of times under the condition that the precision of a new model is recovered to be not different from that of the original model, so that the target parameter distribution is sparser, and the sparse training result is shown in fig. 2. In the model before and after training, the distribution of the gamma factor is shown in fig. 3 and 4, the abscissa in the figure is the pruning factor, and the ordinate is the iteration number epoch. As can be seen from fig. 3, under normal training, the pruning factor always exhibits a positive distribution close to around 1. In the sparse training process, as shown in fig. 4, as the sparse training proceeds, the distribution of the pruning factors gradually changes from the normal distribution near 1 to the distribution in which most of the pruning factors are compressed to 0, which is more beneficial to delete part of channels according to γ.
(2) For the model after sparse training, the gamma values of the batch normalization layer in all the convolution layers not participating in cross-layer connection are arranged in the descending order. Taking fig. 5 as an example, the numbers on different neurons represent the γ values of the channels corresponding to the neurons, and the values are 3, 1.6, and 0.02 from large to small.
(3) And setting different pruning proportions a, and determining an optimal result in the pruning results corresponding to the different pruning proportions to serve as a final pruning result. And (3) regarding each pruning proportion a as a quantile, and finding out the value t of the pruning factor at the position corresponding to the pruning proportion in the gamma values arranged from large to small in the step (2). Taking the arithmetic progression of 100, 99, 98 … … 2, 1 with a γ value of 100 to 1 and a tolerance of 1 as an example, if the pruning ratio is set to 0.3, that is, 30% of the γ values need to be deleted, then the minimum 30% of the γ values is {30, 29, 28 … … 2, 1}, the corresponding value of t is the maximum value 30 of the minimum 30% of the γ values, and if the pruning ratio is set to 0.75, the value of the pruning factor t is 75.
(4) And (3) for all batch normalization layers in the convolution layers which do not participate in cross-layer connection, reserving the channel with the maximum gamma value, deleting the channel if the gamma value of other channels is smaller than the value t obtained in the step (3), otherwise reserving the channel, and not performing pruning processing on the convolution connected in the cross-layer connection in the model. And for different models, the pruning proportion corresponding to the optimal pruning effect is different, and the optimal pruning proportion is selected according to the corresponding pruning result. Tables 1 and 2 show the results of pruning according to various pruning ratios. Finally, 0.75 is taken as the optimal pruning proportion, and as can be seen from the table, 0.75 is selected as the pruning proportion of the model, and compared with the original model, the volume of the model after pruning becomes 19.25% of the original volume, the reasoning speed becomes 26.70% of the original volume, and a better pruning effect is achieved. The number of channels of each convolutional layer after pruning is shown in table 3.
TABLE 1 pruning results for different pruning ratios 1
TABLE 2 pruning results for different pruning ratios 2
TABLE 3 number of channels in layers of the model before and after pruning
The above-listed series of detailed descriptions are merely specific illustrations of possible embodiments of the present invention, and they are not intended to limit the scope of the present invention, and all equivalent means or modifications that do not depart from the technical spirit of the present invention are intended to be included within the scope of the present invention.
Claims (9)
1. A YOLOV3 model pruning method for an intelligent vehicle-mounted platform is characterized by comprising the following steps:
s1, selecting a batch normalization layer gamma parameter in a model as a pruning factor, and performing sparse training on an original model by using an L1 regular term;
s2, arranging pruning factors gamma in the convolutional layers which do not participate in cross-layer connection in the model after sparse training according to the size;
s3, setting a pruning proportion a, and finding a value t of a pruning factor corresponding to the optimal pruning proportion;
and S4, selecting a convolution layer which does not participate in cross-layer connection in the model, and subtracting all channels with the gamma values smaller than t except the channel with the maximum gamma value in the batch normalization layer of the convolution layer.
2. The YOLOV3 model pruning method oriented to the intelligent vehicle platform as claimed in claim 1, wherein the implementation of S1 includes redesigning loss function:
adding an L1 regularization term λ | γ | of a pruning factor γ to a YOLOV3 loss function, the new loss function being:
LL1=L+λ|γ|
where L is the primary loss function of YOLOV3 and λ is the balance factor.
3. The YOLOV3 model pruning method oriented to the intelligent vehicle-mounted platform as claimed in claim 2, wherein λ is obtained by observing sparse effect of the model after training at different λ values through an experimental method to determine its value.
4. The YOLOV3 model pruning method oriented to the intelligent vehicle-mounted platform as claimed in claim 2, wherein during the sparse training in S1, the distribution of the pruning factors gradually changes from a normal distribution around 1 to a distribution in which most of the pruning factors are compressed to 0, so as to facilitate subsequent deletion of partial channels according to γ.
5. The YOLOV3 model pruning method oriented to the intelligent vehicle-mounted platform as claimed in claim 1, wherein in S2, the γ values of the channels corresponding to different neurons after sparse training are 3, 1.6, and 0.02 from large to small.
6. The YOLOV3 model pruning method oriented to the intelligent vehicle-mounted platform according to claim 1, wherein the implementation of S3 comprises:
setting different pruning proportions a, and selecting a relatively optimal result from the pruning results corresponding to the different pruning proportions as a final pruning result; for each pruning proportion a, taking the pruning proportion a as a quantile, and finding out the value t of the pruning factor at the position corresponding to the pruning proportion in the gamma values arranged from large to small in the step S2; when the gamma value is 100 to 1 and the tolerance is 1, the equal difference series {100, 99, 98 … … 2, 1}, if the pruning proportion is set to 0.3, 30% of the gamma values need to be deleted, then the minimum 30% of the gamma values is {30, 29, 28 … … 2, 1}, the corresponding value of t is the maximum value 30 of the minimum 30% of the gamma values, if the pruning proportion is set to 0.75, the value of the pruning factor t is 75, and so on.
7. The YOLOV3 model pruning method oriented to the vehicle-mounted platform of the intelligent vehicle as claimed in claim 6, wherein in S4, for all batch normalization layers in the convolutional layers not participating in cross-layer connection, the channel with the largest gamma value is retained, for other channels, if the gamma value is smaller than the value t obtained in S3, the channel is deleted, otherwise, the channel is retained; for convolution across layer connections in the model, no pruning is done.
8. The YOLOV3 model pruning method for the intelligent vehicle-mounted platform according to claim 7, wherein in S4, for different models, pruning proportions corresponding to the best pruning effect are different, the best pruning proportion is selected according to the corresponding pruning results, the pruning results corresponding to the pruning proportions are shown in tables 1 and 2, and 0.75 is taken as the best pruning proportion:
TABLE 1 pruning results for different pruning ratios 1
TABLE 2 pruning results for different pruning ratios 2
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111141559.2A CN113947203A (en) | 2021-09-28 | 2021-09-28 | YOLOV3 model pruning method for intelligent vehicle-mounted platform |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111141559.2A CN113947203A (en) | 2021-09-28 | 2021-09-28 | YOLOV3 model pruning method for intelligent vehicle-mounted platform |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113947203A true CN113947203A (en) | 2022-01-18 |
Family
ID=79329324
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111141559.2A Pending CN113947203A (en) | 2021-09-28 | 2021-09-28 | YOLOV3 model pruning method for intelligent vehicle-mounted platform |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113947203A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP7546630B2 (en) | 2022-04-27 | 2024-09-06 | 緯創資通股▲ふん▼有限公司 | Neural network optimization method, computer system, and computer-readable storage medium |
-
2021
- 2021-09-28 CN CN202111141559.2A patent/CN113947203A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP7546630B2 (en) | 2022-04-27 | 2024-09-06 | 緯創資通股▲ふん▼有限公司 | Neural network optimization method, computer system, and computer-readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108764471B (en) | Neural network cross-layer pruning method based on feature redundancy analysis | |
CN111652366A (en) | Combined neural network model compression method based on channel pruning and quantitative training | |
CN110874631B (en) | Convolutional neural network pruning method based on feature map sparsification | |
CN113128355A (en) | Unmanned aerial vehicle image real-time target detection method based on channel pruning | |
CN112052951B (en) | Pruning neural network method, system, equipment and readable storage medium | |
CN112699958A (en) | Target detection model compression and acceleration method based on pruning and knowledge distillation | |
CN108304920B (en) | Method for optimizing multi-scale learning network based on MobileNet | |
CN113222138A (en) | Convolutional neural network compression method combining layer pruning and channel pruning | |
CN112308825B (en) | SqueezeNet-based crop leaf disease identification method | |
CN112288087A (en) | Neural network pruning method and device, electronic equipment and storage medium | |
Li et al. | A deep learning method for material performance recognition in laser additive manufacturing | |
CN113947203A (en) | YOLOV3 model pruning method for intelligent vehicle-mounted platform | |
CN109034372A (en) | A kind of neural networks pruning method based on probability | |
CN114492631B (en) | Space attention calculating method based on channel attention | |
CN112132062B (en) | Remote sensing image classification method based on pruning compression neural network | |
CN106250686B (en) | A kind of collective communication function modelling method of concurrent program | |
CN116757255A (en) | Method for improving weight reduction of mobile NetV2 distracted driving behavior detection model | |
CN110276476A (en) | A kind of automobile engine smoke intensity prediction technique based on PSO-RBF neural network | |
Li et al. | Toward Efficient Traffic Signal Control: Smaller Network Can Do More | |
CN113592085A (en) | Nuclear pruning method, device, equipment and medium based on high-rank convolution graph | |
Sarkar et al. | An incremental pruning strategy for fast training of CNN models | |
CN116051961A (en) | Target detection model training method, target detection method, device and medium | |
CN114332101A (en) | Genetic algorithm-based U-Net network model pruning method | |
CN108932550B (en) | Method for classifying images based on fuzzy dense sparse dense algorithm | |
CN112364904A (en) | Model pruning method based on random sampling |
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 |