Algorithm acceleration method for scene recognition and switching

By sorting and deleting convolutional layer importance, pruning and quantizing the EfficientNet model, the high computational cost of EfficientNet on resource-constrained devices is solved, significantly improving the inference speed and maintaining high accuracy. Embedded devices.

CN119227768APending Publication Date: 2024-12-31TIANJIN TIANDY DIGITAL TECH
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411370778.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The EfficientNet model is costly to be deployed on resource-constrained devices, resulting in inference speeds not enough to meet real-time application requirements.

Method used

By calculating and sorting the convolutional layers of the trained EfficientNet model importance, deleting the unimportant convolutional layers, and performing model pruning and quantization, converting 32 floating point data to 16 floating point data to accelerate inference speed.

Benefits of technology

It significantly improves the inference speed of the model while only slightly reducing the model accuracy, making it more suitable for application in embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227768A_ABST
    Figure CN119227768A_ABST
Patent Text Reader

Abstract

The invention relates to an algorithm acceleration method for scene recognition and switching, and the method comprises the steps: training an OfficientNet model through an indoor and outdoor data set, and obtaining the precision of the model; calculating the importance of each convolution kernel of each layer of network of the OfficientNet; sorting is carried out, and convolution kernels with low importance are deleted; finely adjusting the pruned model by using the original data, and carrying out precision comparison to obtain a clipped model; and performing quantization operation on the cut model, converting 32 floating point data in the model into 16 floating point data, performing fine adjustment, and further accelerating the reasoning speed of the model. According to the invention, the method of model pruning and model quantification is applied to the accelerated optimization of the EfficentNet model, and the complexity of the model is reduced by effectively cutting the convolutional layer of the EfficentNet model; and meanwhile, model parameters are converted into 16 floating points, so that the reasoning speed of the model is greatly improved, the model precision is slightly reduced, and the model can be more favorably applied to embedded equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer technology, and in particular to an algorithm acceleration method for scene recognition and switching. Background Art

[0002] In recent years, deep learning technology has made significant progress in computer vision, natural language processing and other fields. Among them, convolutional neural network (CNN), as a deep learning model, has performed well in tasks such as image classification, object detection and image segmentation. EfficientNet is a new CNN architecture proposed by Google. Through the composite scaling method, it effectively balances the number of parameters and the amount of computation, achieving high accuracy and efficiency.

[0003] However, despite the excellent performance and efficiency of EfficientNet, its computational cost is still high, especially when deployed on resource-constrained devices such as mobile devices and embedded systems. In order to meet the needs of real-time applications, EfficientNet needs to be further optimized and accelerated to reduce computational overhead and increase inference speed. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and propose an algorithm acceleration method for scene recognition and switching. By calculating the importance of the convolutional layers of the trained EfficientNet model and deleting relatively unimportant convolutional layers, the inference speed of the model can be significantly improved without losing accuracy.

[0005] The present invention solves the technical problem by adopting the following technical solutions:

[0006] An algorithm acceleration method for scene recognition and switching includes the following steps:

[0007] Step 1: Use indoor and outdoor data sets to train the EfficientNet model and obtain acceptable model accuracy, with a prediction accuracy of more than 97%;

[0008] Step 2: Calculate the importance of each convolution kernel of each layer of EfficientNet.

[0009] Step 3: Sort the importance of all convolution kernels in each layer of the network and delete them;

[0010] Step 4: Use the original data to fine-tune the pruned model and compare the accuracy;

[0011] Step 5, repeat steps 3 and 4 until the model accuracy drops by more than 2% compared with the original model accuracy, and then stop the operation to obtain the cropped model;

[0012] Step 6: Quantize the pruned model, convert the 32 floating-point data in the model into 16 floating-point data and perform fine-tuning to further accelerate the inference speed of the model.

[0013] Moreover, the indoor and outdoor dataset in step 1 is a dataset improved and adjusted by our company based on the public dataset place365, which contains about 1.3 million indoor and outdoor picture sets.

[0014] Moreover, the specific implementation method of step 2 is:

[0015] I(W i )=||W i || 1

[0016] Among them, I(W i ) is the weight of the convolution kernel, ||W i || 1 In order to seek L 1 Norm, that is:

[0017]

[0018] where x j ∈(x 1 ,x 2 ,x 3 ,…,x m ) is the data size inside the convolution kernel.

[0019] Moreover, the specific implementation method of step 3 is: sort the importance of all convolution kernels of each layer in the network, and delete the convolution kernel with the lowest importance. If the convolution kernel of the layer is 1, then the layer with the convolution kernel of 1 does not perform any operation;

[0020] Moreover, the specific implementation method of step 4 using the original data to fine-tune the pruned model is: using the indoor and outdoor classification data set used in the initial training, importing the pruned model and the corresponding weights, and stopping the training when the accuracy reaches more than 95%.

[0021] Moreover, the specific implementation method of step 6 of converting the 32 floating point data in the model into 16 floating point data and fine-tuning is: using the indoor and outdoor classification data set used in the initial training, importing the quantized model and corresponding weights, and stopping the training when the accuracy reaches more than 95%.

[0022] The advantages and positive effects of the present invention are:

[0023] The present invention uses indoor and outdoor data sets to train the EfficientNet model to obtain the accuracy of the model; calculates the importance of each convolution kernel of each layer of the EfficientNet network; and sorts and deletes the convolution kernels with less importance; uses the original data to fine-tune the pruned model, and compares the accuracy to obtain the pruned model; quantizes the pruned model, converts the 32 floating point data in the model into 16 floating point data and fine-tunes it, further accelerating the reasoning speed of the model. The present invention uses the method of model pruning and model quantization to accelerate the optimization of the EfficientNet model, effectively prunes the convolution layer of the EfficientNet model, and reduces the complexity of the model; at the same time, the model parameters are converted into 16 floating points, which greatly improves the reasoning speed of the model, and the model accuracy is only slightly reduced. The model is more conducive to application in embedded devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0025] The present invention is further described in detail below with reference to the accompanying drawings.

[0026] An algorithm acceleration method for scene recognition and switching, such as Figure 1 As shown, the following steps are included:

[0027] Step 1: Use indoor and outdoor data sets to train the EfficientNet model and obtain acceptable model accuracy, with a prediction accuracy of more than 97%;

[0028] Step 2: Calculate the importance of each convolution kernel in each layer of the EfficientNet network.

[0029] Step 3: Sort the importance of all convolution kernels in each layer of the network and delete them.

[0030] The specific implementation method of step 2 is:

[0031] I(W i )=||W i || 1

[0032] Among them, I(W i ) is the weight of the convolution kernel, ||W i || 1 In order to seek L 1 Norm, that is:

[0033]

[0034] where xj ∈(x 1 ,x 2 ,x 3 ,…,x m ) is the data size inside the convolution kernel.

[0035] The specific implementation method of step 3 is: sort the importance of all convolution kernels in each layer of the network, and delete the convolution kernel with the lowest importance. If the convolution kernel of the layer is 1, then the layer with the convolution kernel of 1 will not perform any operation;

[0036] Step 4: Use the original data to fine-tune the pruned model and compare the accuracy.

[0037] The specific implementation method of step 4 using the original data to fine-tune the pruned model is: use the indoor and outdoor classification data set used in the initial training, import the pruned model and the corresponding weights, and stop the training when the accuracy reaches more than 95%.

[0038] Step 5: Repeat steps 3 and 4 until the accuracy of the model drops by more than 2% compared with the accuracy of the original model, and then obtain the cropped model.

[0039] Step 6: Quantize the pruned model, convert the 32 floating-point data in the model into 16 floating-point data and perform fine-tuning to further accelerate the inference speed of the model.

[0040] Step 6: The specific implementation method of converting the 32 floating-point data in the model into 16 floating-point data and fine-tuning is: using the indoor and outdoor classification data set used in the initial training, importing the quantized model and corresponding weights, and stopping the training when the accuracy reaches more than 95%.

[0041] It should be emphasized that the embodiments described in the present invention are illustrative rather than restrictive. Therefore, the present invention includes but is not limited to the embodiments described in the specific implementation manner. Any other implementation manners derived by those skilled in the art based on the technical solution of the present invention also fall within the scope of protection of the present invention.

Claims

1. An algorithm acceleration method for scene recognition and switching, characterized in that: The following steps are involved: Step 1: Use indoor and outdoor datasets to train the EfficientNet model and obtain acceptable model accuracy. Step 2: Calculate the importance of each convolution kernel of each layer of EfficientNet. Step 3: Sort the importance of all convolution kernels in each layer of the network and delete them; Step 4: Use the original data to fine-tune the pruned model and compare the accuracy; Step 5, repeat steps 3 and 4 until the model accuracy drops by more than 2% compared with the original model accuracy, and then stop the operation to obtain the cropped model; Step 6: Quantize the pruned model, convert the 32 floating-point data in the model into 16 floating-point data and perform fine-tuning to further accelerate the inference speed of the model.

2. The algorithm acceleration method for scene recognition and switching according to claim 1, characterized in that: The indoor and outdoor dataset in step 1 is an improved and adjusted dataset based on the public dataset place365, which includes two sets of indoor and outdoor pictures.

3. The algorithm acceleration method for scene recognition and switching according to claim 1, characterized in that: The specific implementation method of step 2 is: I(W i )=||W i ||1 Among them, I(W i ) is the weight of the convolution kernel, ||W i ||1 is for L1 norm: where x j ∈(x1,x2,x3,…,x m ) is the data size inside the convolution kernel.

4. The algorithm acceleration method for scene recognition and switching according to claim 1, characterized in that: The specific implementation method of step 3 is: sort the importance of all convolution kernels of each layer in the network, and delete the convolution kernel with the lowest importance. If the convolution kernel of the layer is 1, then the layer with the convolution kernel of 1 does not perform any operation.

5. The algorithm acceleration method for scene recognition and switching according to claim 1, characterized in that: The specific implementation method of step 4 using the original data to fine-tune the pruned model is: using the indoor and outdoor classification data set used in the initial training, importing the pruned model and the corresponding weights, and stopping the training when the accuracy reaches more than 95%.

6. The algorithm acceleration method for scene recognition and switching according to claim 1, characterized in that: The specific implementation method of step 6 of converting the 32 floating point data in the model into 16 floating point data and fine-tuning is: using the indoor and outdoor classification data set used in the initial training, importing the quantized model and corresponding weights, and stopping the training when the accuracy reaches more than 95%.

Citation Information

Patent Citations

  • Signal recognition convolutional neural network convolution kernel partition pruning method

    CN111222640A

  • Network model compression method based on deep learning

    CN113344182A

  • Convolutional neural network pruning method based on distribution difference

    CN115660066A

  • Neural network pruning method based on compression incentive attention for pattern recognition

    CN115936100A

  • Employee working state identification method and identification system

    CN116092199A