Research on Lightweight Model for Rapid Identification of Chunky Food Based on Machine Vision
Abstract
:1. Introduction
2. Building the Dataset
2.1. Image Acquisition
2.2. Dataset Augmentation
- (1)
- Geometric Transformation
- (2)
- Adding Noise
- (3)
- Color Transformation
- (4)
- Cutout
3. Improved YOLOv5 Algorithm
3.1. YOLOv5 Algorithm
3.2. Construction of YOLOv5-GCS Detection Model
3.2.1. CBAM Attention Module
3.2.2. SIoU Loss Function
3.2.3. Ghost Convolution
3.3. Experiment Validation
3.3.1. Experimental Environment and Hyperparameter Settings
3.3.2. Comparison Experiment
Convergence Performance Analysis
Classification Accuracy Analysis
Ablation Experiments
Performance Analysis of Different Attention Mechanisms
Comparison of Different Algorithms
4. Lightweight Model YOLOv5-MGCS
4.1. YOLOv5-MGCS Model
4.2. Experimental Training and Analysis of Results
5. Conclusions
- (1)
- The CBAM attention mechanism is added to the feature fusion network of YOLOv5s, and the normal convolution is replaced with the ghost convolution module. Additionally, the position loss function in YOLOv5s is replaced with SIoU loss. The improved YOLOv5-GCS model detects block food significantly better than YOLOv5s, with a mAP value improved from 95.8% to 97.5%, and a reduction in the number of model parameters from 7 M to 6.3 M.
- (2)
- A lightweight model, YOLOv5-MGCS, is proposed, where the first 17 layers of the MobileNetv3-large network are selected to replace the CSPDarkNet53 network in YOLOv5-GCS. The FPS value of the improved model YOLOv5-MGCS is up to 83, which can meet the demand of real-time detection. The number of parameters has been changed from 7.0 M to 3.3 M to reduce the CPU computing burden.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Yan, Z.; Wang, L.; Sun, Z. Study of High-speed Auto-sorting System for Food Production. Packag. Eng. 2009, 30, 16–18. [Google Scholar]
- Gong, C.; Lan, L.; Xiong, J. Design Analysis and Implementation of Delta Parallel Robot. J. Mech. Transm. 2014, 38, 61–63. [Google Scholar]
- Zhang, W. Control Technique and Kinematic Calibration of Delta Robot Based on Computer Vision. Ph.D. Thesis, Tianjin University, Tianjin, China, 2012; pp. 25–35. [Google Scholar]
- Kuno, Y.; Numagami, H.; Ishikawa, M.; Hoshino, H.; Nakamura, Y.; Kidode, M. Robot vision implementation by high-speed image processor TOSPIX: Battery inspection. Robotica 1983, 1, 223–230. [Google Scholar] [CrossRef]
- Hosseininia, S.J.; Khalili, K.; Emam, S.M. Flexible Automation in Porcelain Edge Polishing Using Machine Vision. Procedia Technol. 2016, 22, 562–569. [Google Scholar] [CrossRef] [Green Version]
- Xu, Z.; Jia, R.; Sun, H.; Liu, Q.; Cui, Z. Light-YOLOv3: Fast method for detecting green mangoes in complex scenes using picking robots. Appl. Intell. 2020, 50, 4670–4687. [Google Scholar] [CrossRef]
- Wang, Z.; Li, H.; Zhang, X. Construction waste recycling robot for nails and screws: Computer vision technology and neural network approach. Autom. Constr. 2019, 97, 220–228. [Google Scholar] [CrossRef]
- Zhang, L.; Li, Y.; Qin, B.; Shang, D. Design of the Medicine Bag Sorting System Based on Machine Vision and Parallel Robot. Mach. Tool Hydraul. 2019, 47, 68–71. [Google Scholar]
- Fang, H.; Xu, K.; Wan, X.; Kai, W. Design of Recyclable Garbage Sorting System Based on Parallel Robot. Modul. Mach. Tool Autom. Manuf. Tech. 2020, 24–27+32. [Google Scholar] [CrossRef]
- Shorten, C.; Khoshgoftaar, T.M. A survey on image data augmentation for deep learning. J. Big Data 2019, 6, 60. [Google Scholar] [CrossRef] [Green Version]
- Luisier, F.; Blu, T.; Unser, M. Image denoising in mixed Poisson-Gaussian noise. IEEE Trans. Image Process. 2010, 20, 696–708. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Devries, T.; Taylor, G.W. Improved Regularization of Convolutional Neural Networks with Cutout. arXiv 2017, arXiv:1708.04552. [Google Scholar]
- Bochkovskiy, A.; Wang, C.Y.; Liaom, H.Y.M. YOLOv4: Optimal speed and accuracy of object detection. arXiv 2020, arXiv:2004.10934. [Google Scholar]
- Zhang, S.; Wang, H.; Ran, X. Light traffic sign detection algorithm based on YOLOv5. Electron. Meas. Technol. 2022, 45, 129–135. [Google Scholar]
- Woo, S.; Park, J.; Lee, J.Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 3–19. [Google Scholar]
- Gevorgyan, Z. SIoU Loss: More Powerful Learning for Bounding Box Regression. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), New Orleans, LA, USA, 18–24 June 2022. [Google Scholar]
- Han, K.; Wang, Y.; Tian, Q.; Guo, J.; Xu, C.; Xu, C. GhostNet: More features from cheap operations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 13–19 June 2020; pp. 1577–1586. [Google Scholar]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-excitation networks. In Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; IEEE Press: New York, NY, USA, 2018; pp. 7132–7141. [Google Scholar]
- Hou, Q.; Zhou, D.; Feng, J. Coordinate Attention for Efficient Mobile Network Design. arXiv 2021, arXiv:2103.02907. [Google Scholar]
- Howard, A.G. MobileNets: Efficient convolutional neural networks for mobile vision applications. arXiv 2020, arXiv:1704.04861. [Google Scholar]
- Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. MobileNetV2: Inverted residuals and Linear bottlenecks. In Proceedings of the 2018 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Salt Lake City, UT, USA, 18–23 June 2018. [Google Scholar]
- Howard, A.; Sandler, M.; Chu, G. Searching for mobilenetv3. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 1314–1324. [Google Scholar]
Category | Manually Collected | Internet Collected | Total |
---|---|---|---|
Mashu | 532 | 210 | 742 |
Fantuan | 496 | 156 | 652 |
Nuomiji | 512 | 143 | 655 |
Total | 1540 | 509 | 2049 |
Parameters | Configuration |
---|---|
Operating System | Ubuntu 18.04 |
CPU | Intel(R) Xeon(R) Platinum 8255C |
GPU | RTX3080 |
Programming Languages | Python 3.8 |
Deep Learning Framework | Pytorch 1.9 |
Accelerated Environment | CUDA 11.0 |
Name | Numerical Value |
---|---|
Training image resolution | 640 × 640 × 3 |
Epochs | 200 |
Batch_size | 16 |
Optimizer | SGD |
Initial learning rate | 0.01 |
Learning rate momentum (momentum) | 0.937 |
Weight decay factor | 0.0005 |
YOLOv5s | CBAM | SIoU | Ghost | P (%) | R (%) | mAP (%) | Number of Participants |
---|---|---|---|---|---|---|---|
√ | 92.7 | 93 | 95.4 | 7.0 M | |||
√ | √ | 94.3 | 93.7 | 96.6 | 7.2 M | ||
√ | √ | 92.9 | 93.5 | 96.0 | 7.0 M | ||
√ | √ | 93.5 | 93.7 | 96.3 | 6.0 M | ||
√ | √ | √ | 94.3 | 93.8 | 96.8 | 7.2 M | |
√ | √ | √ | 94.4 | 94 | 97 | 6.2 M | |
√ | √ | √ | √ | 94.7 | 94.4 | 97.4 | 6.2 M |
Algorithm | P (%) | R (%) | mAP (%) | Number of Parameters (M) |
---|---|---|---|---|
YOLOv5s | 92.7 | 93 | 95.4 | 7.0 |
YOLOv5s-SE | 93 | 93.3 | 95.9 | 7.2 |
YOLOv5s-CA | 92.9 | 93.4 | 96.1 | 7.2 |
YOLOv5s-CBAM | 94.3 | 93.7 | 96.6 | 7.2 |
Model | mAP (%) | Number of Parameters (M) | FPS |
---|---|---|---|
YOLOv4 | 94.3 | 6.3 | 23 |
YOLOv5s | 95.4 | 7.0 | 55 |
YOLOv5-GCS | 97.4 | 6.3 | 60 |
YOLOv5-MGCS | 96.5 | 3.3 | 83 |
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. |
© 2023 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
Guo, Z.; Yang, J.; Liu, S. Research on Lightweight Model for Rapid Identification of Chunky Food Based on Machine Vision. Appl. Sci. 2023, 13, 8781. https://doi.org/10.3390/app13158781
Guo Z, Yang J, Liu S. Research on Lightweight Model for Rapid Identification of Chunky Food Based on Machine Vision. Applied Sciences. 2023; 13(15):8781. https://doi.org/10.3390/app13158781
Chicago/Turabian StyleGuo, Zhongfeng, Junlin Yang, and Siyi Liu. 2023. "Research on Lightweight Model for Rapid Identification of Chunky Food Based on Machine Vision" Applied Sciences 13, no. 15: 8781. https://doi.org/10.3390/app13158781
APA StyleGuo, Z., Yang, J., & Liu, S. (2023). Research on Lightweight Model for Rapid Identification of Chunky Food Based on Machine Vision. Applied Sciences, 13(15), 8781. https://doi.org/10.3390/app13158781