Research on the Application of Pruning Algorithm Based on Local Linear Embedding Method in Traffic Sign Recognition
Abstract
:1. Introduction
Method | Specific | Advantage | Shortcoming |
VGG [10] | Based on the VGG network, the channel pruning method based on Lasso regression is used to reduce the convolutional channel and compress the width of the network horizontally. | This method compresses the scale of the traffic sign recognition network, which is conducive to the real-time application of traffic sign systems in urban road conditions. | If there is a set of highly correlated features, Lasso regression tends to choose one of the features and ignore all the others, which leads to instability in the results. |
Knowledge-based distillation framework [11] | Two lightweight convolutional neural network structures are designed; the first deep network model is used as the teacher model, and the second shallow model is used as the student model. Through knowledge distillation, the student model can learn the function mapping similar to the teacher model and then trim the redundant feature channels according to the scale factor that tends to zero in the Batch Normalization layer. | According to the experimental data in this paper, the compressed network model has a more compact structure and better performance than the mainstream traffic sign recognition methods. | The experimental data in this paper indicate that compared with the mainstream traffic sign recognition methods, the compressed network model has a more compact structure and better performance. |
A lightweight YOLOv3 traffic sign detection algorithm [12] | Use both shallow and deep feature extraction in convolutional neural networks. | This method prunes the model while maintaining the accuracy of the model, thus establishing a lightweight traffic sign detection model with stronger robustness. |
2. Method
2.1. ViT Model
- Patch embedding: For example, if the input image size is 224 × 224, the image is divided into fixed-size patches, and the patch size is 16 × 16. Then, each image will generate 224 × 224/16 × 16 = 196 patches, that is, the length of the input sequence is 196, the dimension of each patch is 16 × 16 × 3 = 768, and the dimension of the linear projection layer is 768 × N (N = 768). Therefore, the dimension after the input passes through the linear projection layer is still 196 × 768, i.e., there are 196 tokens in total, and the dimension of each token is 768. A special character cls is also added here, so the final dimension is 197 × 768. In this way, a vision problem is transformed into a seq2seq problem with patch embedding.
- Position coding: ViT also needs to add position coding, and the ViT position code has a total of N lines. Each line represents a vector, and the dimension of the vector and the embedded dimension of the input sequence is the same. So, after adding position code information, the dimension is still 197 × 768.
- Linear layer/multi-head attention mechanism/linear layer: The output dimension of the linear layer is still 197 × 768. In the multi-head-attention mechanism, the input is mapped to QKV first. If there is only one head, the dimension of QKV is 197 × 768; if there are 12 heads (768/12 = 64), the dimension of QKV is 197 × 64, and there are 12 groups of QKV in total; finally, the output of 12 groups of QKV is spliced, the output dimension is 197 × 768, and then through a linear layer, the dimension is still 197 × 768.
- MLP: Enlarge and scale down the dimension (197 × 768 to 197 × 3072, and then shrink to 197 × 768).
2.2. ADMM Principle
Algorithm 1: ADMM-based pruning algorithm |
Input: dataset D, ADMM iteration number K, N filters to be pruned layer by layer, pruning threshold βi, augmented hyperparameter ρ, the weight set Si of different pruning methods. Output: Weight parameter W. 1: for k = 1, 2,..., K do 2: Sample from D(x, y), solve for Z in Equation (7). 4: Applying the Adam optimizer to the outer minimum of Equation (9) yields {Zik} 5: Solve Equation (11) using Formula (10) to obtain {Wik} 6: 7: end for |
2.3. Local Linear Embedding Method
- The weight parameter of the filter in each layer of the network before the model is pruned is taken as the sample point, and the k nearest neighbor points of each sample point are calculated by the KNN strategy; meanwhile, the k sample points with the closest Euclidean distance relative to the sample point are specified as the k nearest neighbors of the sample point, and k is a pre-given value.
- Calculate the local reconstruction weight matrix α of the sample points and use the mean squared error as the loss function of the regression problem. The calculation formula of mean squared error is shown in Equation (12).
- 3.
- Assuming that the weight coefficient γi can still maintain the corresponding linear relationship after model pruning, i.e., the corresponding mean squared error loss function is the smallest. The calculation formula of the minimized loss function is shown in Formula (18).
2.4. JS_ Divergence Values
Algorithm 2: Similar filter pruning algorithm based on JS_ divergence |
Input: N: filters to be pruned layer by layer. βi: pruning threshold. 1: Obtain the absolute value of the weight parameter of N filters in layer i in the pre-trained model. 2: Calculate the JS_ divergence value between N filters in step 1 and between each filter and other filters, and sort these filters according to the JS_ divergence value. 3: Select the pre-Nβi pair filter sorted in step 2 as the filter pair to be pruned. 4: Calculate the information entropy value of each filter, remove the filter with a small information entropy value from the filters to be pruned in step 3, and retain the filter with a larger information entropy value. |
2.5. Similarity Filter Algorithm Based on Locally Linear Embedding
Algorithm 3: Similar filter pruning algorithm based on local linear embedding |
Input: dataset D, the number of pre-training iterations K′, the number of model weight optimization iterations K″, the number of pruning iterations K, N filters to be pruned layer by layer, pruning threshold βi, augmented hyperparameter ρ, the weight set Si of different pruning methods. //Output: Weight parameter W 1: for k = 1, 2, ..., K′ do 2: Sample from D (x, y) 3: Data normalization and data enhancement preprocessing of (x, y) yields (x′, y′) 4: Take (x′, y′) as input to initial training for iterative training 5: end for //Get pre-trained model 6: for k = 1, 2, ..., K″ do 7: Take samples from D (x, y) 8: Data normalization and data enhancement preprocessing of (x, y) yields (x′, y′) 9: Take (x′, y′) as input for model weight optimization training. 10: Apply Algorithm 2 to obtain the pruned weight parameter Z by using the weight parameter W of the pre-trained model 11: Take the weight parameters W and Z as inputs to Algorithm 1 and solve for Z in Equation (7). 12: Applying the Adam optimizer to the outer minimum of Equation (11) yields {Zik } 13: 14: end for 15: //Get the weight optimization model 16: for k = 1, 2, ..., K do 17: Take samples from D (x, y) 18: Data normalization and data enhancement preprocessing of (x, y) yields (x′, y′) 19: Take (x′, y′) as input for model weight optimization training. 20: Optimize the weight parameter of the model W′ using Algorithm 2 to obtain the pruned weight parameter Z’ 21: end for 22: //Get weight model after pruning |
3. Dataset and Preprocessing
3.1. Dataset
3.2. Image Preprocessing Methods
4. Experiments
4.1. Experimental Details
4.2. Experimental Evaluation Index
- (1)
- Top-1 accuracy
- (2)
- Top-5 accuracy
- (3)
- Params
- (4)
- FLOPs
4.3. Experimental Results and Analysis
4.3.1. Experimental Results and Analysis of Hypothesis Proofs
4.3.2. Experimental Results and Analysis of SJ_LLE Method Pruning
5. Conclusions and Future Works
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Cireşan, D.; Meier, U.; Masci, J.; Schmidhuber, J. A committee of neural networks for traffic sign classification. Proceedings of The 2011 International Joint Conference on Neural Networks, San Jose, CA, USA, 31 July–05 August 2011; IEEE: Piscataway, NJ, USA, 2011; pp. 1918–1921. [Google Scholar]
- Xu, Y.; Wang, Y.; Zhou, A.; Lin, W.; Xiong, H. Deep neural network compression with single and multiple level quantization. In Proceedings of the AAAI Conference on Artificial Intelligence, New Orleans, LA, USA, 2–7 February 2018; Volume 32. [Google Scholar]
- Qiu, Q.; Cheng, X.; Sapiro, G. DCFNet: Deep neural network with decomposed convolutional filters. In Proceedings of the International Conference on Machine Learning, Stockholm, Sweden, 10–15 July 2018; pp. 4198–4207. [Google Scholar]
- Shen, Y.; Xu, L.; Yang, Y.; Li, Y.; Guo, Y. Self-distillation from the last mini-batch for consistency regularization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 11943–11952. [Google Scholar]
- Rahimian, E.; Javadi, G.; Tung, F.; Oliveira, G. DynaShare: Task and instance conditioned parameter sharing for multi-task learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 4535–4543. [Google Scholar]
- Sehwag, V.; Wang, S.; Mittal, P.; Jana, S. Hydra: Pruning adversarially robust neural networks. Adv. Neural Inf. Process. Syst. 2020, 33, 19655–19666. [Google Scholar]
- Tan, H.; Wu, S.; Du, F.; Chen, Y.; Wang, Z.; Wang, F.; Qi, X. Data pruning via moving-one-sample-out. Adv. Neural Inf. Process. Syst. 2024, 36, 18251–18262. [Google Scholar]
- Khan, M.A.; Park, H.; Chae, J. A lightweight convolutional neural network (CNN) architecture for traffic sign recognition in urban road networks. Electronics 2023, 12, 1802. [Google Scholar] [CrossRef]
- Xu, K.; Wang, Z.; Geng, X.; Wu, M.; Li, X.; Lin, W. Efficient Joint Optimization of Layer-Adaptive Weight Pruning in Deep Neural Networks. In Proceedings of the 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 1–6 October 2023; pp. 17401–17411. [Google Scholar]
- Lin, X.; Zhang, Z.; Liu, L.; Yang, X.; Wang, S. VGG network pruning and quantization for urban road traffic sign recognition. Small Microcomput. Syst. 2021, 6, 1293–1296. [Google Scholar]
- Wang, W. Traffic Sign Recognition Algorithm Based on Convolutional Neural Network Compression. Master’s Thesis, Changsha University of Technology, Changsha, China, 2019. [Google Scholar]
- Bai, S.L.; Yin, K.X.; Zhu, J.Q. Lightweight Yolov3 traffic sign detection algorithm. Comput. Mod. 2020, 9, 83–88+94. [Google Scholar]
- DosoViTskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Houlsby, N. An image is worth 16 × 16 words: Transformers for image recognition at scale. arXiv 2020, arXiv:2010.11929. [Google Scholar]
- Leng, C.; Dou, Z.; Li, H.; Zhu, S.; Jin, R. Extremely low bit neural network: Squeeze the last bit out with ad-mm. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, New Orleans, LA, USA, 2–7 February 2018. [Google Scholar]
- He, B.; Xu, S.; Yuan, X. Extensions of ADMM for separable convex optimization problems with linear equality or inequality constraints. In Handbook of Numerical Analysis; Elsevier: Amsterdam, The Netherlands, 2023; Volume 24, pp. 511–557. [Google Scholar]
- Ye, S.; Xu, K.; Liu, S.; Cheng, H.; Lambrechts, J.H.; Zhang, H.; Zhou, A.; Ma, K.; Wang, Y.; Lin, X. Adversarial robustness vs. model compression, or both? In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 111–120. [Google Scholar]
- Ghojogh, B.; Crowley, M.; Karray, F.; Ghodsi, A. Elements of Dimensionality Reduction and Manifold Learning; Springer: Berlin/Heidelberg, Germany, 2023. [Google Scholar]
- Lei, M. The Mathematics of Machine Learning: Information Theory; Version 1; The People’s Posts and Telecommunications Press: Beijing, China, 2021; pp. 298–316. [Google Scholar]
- Takapoui, R.; Moehle, N.; Boyd, S.; Bemporad, A. A simple effective heuristic for embedded mixed-integer quadratic programming. Int. J. Control. 2020, 93, 2–12. [Google Scholar] [CrossRef]
- Roweis, S.T.; Saul, L.K. Nonlinear dimensionality reduction by locally linear embedding. Science 2020, 290, 2323–2326. [Google Scholar] [CrossRef] [PubMed]
- He, Y.; Dong, X.; Kang, G.; Fu, Y.; Yan, C.; Yang, Y. Asymptotic Soft Filter Pruning for Deep Convolutional Neural Networks. IEEE Trans. Cybern. 2019, 50, 3594–3604. [Google Scholar] [CrossRef] [PubMed]
- Li, H.; Kadav, A.; Durdanovic, I.; Samet, H.; Graf Peter, H. Pruning filters for efficient convnets. arXiv 2016, arXiv:1608.08710. [Google Scholar]
- Han, S.; Pool, J.; Tran, J.; Dally, W. Learning both weights and connections for efficient neural network. Adv. Neural Inf. Process. Syst. 2015, 28, 1135–1143. [Google Scholar]
- He, Y.; Liu, P.; Wang, Z.; Hu, Z.; Yang, Y. Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration. In Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Long Beach, CA, USA, 15–20 June 2019; IEEE: Piscataway, NJ, USA, 2019. [Google Scholar]
Pruning Method\Pruning Rate | Baseline | 60% | 70% | 80% | 90% | 95% |
---|---|---|---|---|---|---|
ASFP_LLE | 67.27 | 64.82 | 63.54 | 60.98 | 45.64 | 37.93 |
ASFP | 67.27 | 64.06 | 62.32 | 59.67 | 43.15 | 35.45 |
PFEC_LLE | 67.27 | 66.26 | 65.43 | 61.56 | 48.46 | 36.98 |
PFEC | 67.27 | 65.37 | 63.83 | 60.43 | 46.27 | 34.27 |
LWCE_LLE | 67.27 | 64.38 | 63.16 | 60.44 | 48.73 | 33.10 |
LWCE | 67.27 | 63.84 | 61.78 | 59.32 | 46.35 | 30.46 |
FPGM_LLE | 67.27 | 65.32 | 63.41 | 60.85 | 43.96 | 33.52 |
FPGM | 67.27 | 64.63 | 62.25 | 59.41 | 42.25 | 31.24 |
Pruning Method\Pruning Rate | Baseline | 60% | 70% | 80% | 90% | 95% |
---|---|---|---|---|---|---|
ASFP_LLE | 94.47 | 90.77 | 90.24 | 83.98 | 63.54 | 50.93 |
ASFP | 94.47 | 90.23 | 89.82 | 82.19 | 61.57 | 48.66 |
PFEC_LLE | 94.47 | 91.74 | 91.03 | 85.91 | 65.34 | 49.76 |
PFEC | 94.47 | 91.74 | 91.05 | 90.14 | 84.85 | 48.12 |
LWCE_LLE | 94.47 | 90.72 | 89.97 | 83.06 | 66.45 | 49.75 |
LWCE | 94.47 | 90.16 | 89.05 | 81.85 | 64.66 | 47.14 |
FPGM_LLE | 94.47 | 91.37 | 89.64 | 86.13 | 86.13 | 47.32 |
FPGM | 94.47 | 90.7 | 88.73 | 85.07 | 59.74 | 45.44 |
Pruning Method\Pruning Rate | Baseline | 10% | 20% | 40% | 50% | 70% |
---|---|---|---|---|---|---|
SJ-LLE | 98.78 | 98.72 | 98.13 | 97.95 | 96.88 | 96.09 |
ASFP | 98.78 | 98.06 | 96.67 | 95.85 | 94.75 | 93.19 |
HYDRA | 98.78 | 98.13 | 97.10 | 95.42 | 94.84 | 94.15 |
Filter | 98.78 | 97.96 | 95.64 | 93.82 | 92.96 | 92.12 |
FPGM | 98.78 | 98.03 | 97.15 | 95.39 | 95.04 | 94.51 |
Pruning Method\Pruning Rate | Baseline | 10% | 20% | 40% | 50% | 70% |
---|---|---|---|---|---|---|
SJ-LLE | 99.03 | 99.09 | 98.72 | 98.05 | 97.58 | 96.04 |
ASFP | 99.03 | 98.26 | 96.82 | 95.94 | 94.48 | 93.84 |
HYDRA | 99.03 | 98.28 | 97.72 | 96.12 | 95.51 | 94.66 |
Filter | 99.03 | 97.22 | 95.81 | 95.95 | 93.47 | 92.95 |
FPGM | 99.03 | 98.53 | 98.01 | 96.95 | 96.03 | 95.18 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Wang, W.; Liu, X. Research on the Application of Pruning Algorithm Based on Local Linear Embedding Method in Traffic Sign Recognition. Appl. Sci. 2024, 14, 7184. https://doi.org/10.3390/app14167184
Wang W, Liu X. Research on the Application of Pruning Algorithm Based on Local Linear Embedding Method in Traffic Sign Recognition. Applied Sciences. 2024; 14(16):7184. https://doi.org/10.3390/app14167184
Chicago/Turabian StyleWang, Wei, and Xiaorui Liu. 2024. "Research on the Application of Pruning Algorithm Based on Local Linear Embedding Method in Traffic Sign Recognition" Applied Sciences 14, no. 16: 7184. https://doi.org/10.3390/app14167184
APA StyleWang, W., & Liu, X. (2024). Research on the Application of Pruning Algorithm Based on Local Linear Embedding Method in Traffic Sign Recognition. Applied Sciences, 14(16), 7184. https://doi.org/10.3390/app14167184