Lightweight Network of Multi-Stage Strawberry Detection Based on Improved YOLOv7-Tiny
Abstract
:1. Introduction
1.1. Related Work
1.2. Motivation and Contributions
- A real-time lightweight detection network YOLO-GCWA is investigated for strawberry detection on the agricultural robot. A lightweight Ghost convolution is used in the neck network. The CA attention module is embedded into the backbone network CSP-Darknet, and a detection head is added to detect small strawberries on the 160 × 160 × 64 feature map, optimizing the performance of the model.
- The advanced WIoU loss function is employed to enhance the model’s focus on anchor boxes of normally distributed samples, thereby improving object localization. Additionally, the introduction of the advanced Adan optimizer addresses the issue of high model training costs.
- Extensive experiments on a mixed strawberry dataset under various conditions (directions, lighting, and backgrounds) demonstrate that the proposed YOLO-GCWA algorithm achieves an impressive performance of 88.2% . Additionally, and are reduced by 1.54% and 12.10%, respectively, significantly outperforming other popular object detection networks.
2. Materials and Methods
2.1. Data Acquisition
2.2. Dataset Establishment
2.3. YOLOv7-Tiny Model
2.4. Improvement of YOLOv7-Tiny
2.4.1. Ghost Convolution Module
2.4.2. Coordinate Attention Mechanism
2.4.3. WIoU Loss Function
2.4.4. Adan Optimizer
2.5. Model Evaluation Metrics
3. Experiments and Results
3.1. Comparative Experiment of Attention Mechanism
3.2. Ablation Experiments
3.3. Comparison Detection Experiment of Original Model and Proposed Model
3.4. Comparison of Different Algorithms
Different Model Detection Analysis
3.5. Model Visualization Analysis
4. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Du, X.; Cheng, H.; Ma, Z.; Lu, W.; Wang, M.; Meng, Z.; Jiang, C.; Hong, F. DSW-YOLO: A detection method for ground-planted strawberry fruits under different occlusion levels. Comput. Electron. Agric. 2023, 214, 108304. [Google Scholar] [CrossRef]
- Zhang, Y.; Yu, J.; Chen, Y.; Yang, W.; Zhang, W.; He, Y. Real-time strawberry detection using deep neural networks on embedded system (rtsd-net): An edge AI application. Comput. Electron. Agric. 2022, 192, 106586. [Google Scholar] [CrossRef]
- Cui, Y.; NAGATA, M.; Guo, F.; Hiyoshi, K.; Kinoshita, O.; Mitarai, M. Study on strawberry harvesting robot using machine vision for strawberry grown on annual hill top (Part 2) Ripeness judgment and recognition of peduncle using picking camera, and fabrication of the picking hand. J. Jpn. Soc. Agric. Mach. 2007, 69, 60–68. [Google Scholar]
- Feng, Q.; Wang, X.; Wang, G.; Li, Z. Design and test of tomatoes harvesting robot. In Proceedings of the 2015 IEEE International Conference on Information and Automation, Lijiang, China, 8–10 August 2015; pp. 949–952. [Google Scholar]
- He, F.; Zhang, Q.; Deng, G.; Li, G.; Yan, B.; Pan, D.; Luo, X.; Li, J. Research Status and Development Trend of Key Technologies for Pineapple Harvesting Equipment: A Review. Agriculture 2024, 14, 975. [Google Scholar] [CrossRef]
- Zhou, J.; Zhang, Y.; Wang, J. A dragon fruit picking detection method based on YOLOv7 and PSP-Ellipse. Sensors 2023, 23, 3803. [Google Scholar] [CrossRef]
- Sun, H.; Wang, B.; Xue, J. YOLO-P: An efficient method for pear fast detection in complex orchard picking environment. Front. Plant Sci. 2023, 13, 1089454. [Google Scholar] [CrossRef] [PubMed]
- Nan, Y.; Zhang, H.; Zeng, Y.; Zheng, J.; Ge, Y. Intelligent detection of Multi-Class pitaya fruits in target picking row based on WGB-YOLO network. Comput. Electron. Agric. 2023, 208, 107780. [Google Scholar] [CrossRef]
- Yamamoto, S.; Hayashi, S.; Yoshida, H.; Kobayashi, K. Development of a stationary robotic strawberry harvester with a picking mechanism that approaches the target fruit from below. Jpn. Agric. Res. Q. JARQ 2014, 48, 261–269. [Google Scholar] [CrossRef]
- Hayashi, S.; Yamamoto, S.; Saito, S.; Ochiai, Y.; Kamata, J.; Kurita, M.; Yamamoto, K. Field operation of a movable strawberry-harvesting robot using a travel platform. Jpn. Agric. Res. Q. JARQ 2014, 48, 307–316. [Google Scholar] [CrossRef]
- Yiping, T.; Wangming, H.; Anguo, H.; Weiyang, W. Design and experiment of intelligentized tea-plucking machine for human riding based on machine vision. Nongye Jixie Xuebao/Trans. Chin. Soc. Agric. Mach. 2016, 47. [Google Scholar]
- Li, B.; Wang, M.; Wang, N. Development of a Real-Time Fruit Recognition System for Pineapple Harvesting Robots; American Society of Agricultural and Biological Engineers: St. Joseph, MI, USA, 2010; p. 1. [Google Scholar]
- Bulanon, D.M.; Kataoka, T.; Ota, Y.; Hiroma, T. AE—automation and emerging technologies: A segmentation algorithm for the automatic recognition of Fuji apples at harvest. Biosyst. Eng. 2002, 83, 405–412. [Google Scholar] [CrossRef]
- Zhou, R.; Damerow, L.; Sun, Y.; Blanke, M.M. Using colour features of cv.‘Gala’apple fruits in an orchard in image processing to predict yield. Precis. Agric. 2012, 13, 568–580. [Google Scholar] [CrossRef]
- Chaivivatrakul, S.; Dailey, M.N. Texture-based fruit detection. Precis. Agric. 2014, 15, 662–683. [Google Scholar] [CrossRef]
- Li, J.; Dai, Y.; Su, X.; Wu, W. Efficient Dual-Branch Bottleneck Networks of Semantic Segmentation Based on CCD Camera. Remote Sens. 2022, 14, 3925. [Google Scholar] [CrossRef]
- Liu, X.; Wang, J.; Li, J. URTSegNet: A real-time segmentation network of unstructured road at night based on thermal infrared images for autonomous robot system. Control Eng. Pract. 2023, 137, 105560. [Google Scholar] [CrossRef]
- Girshick, R. Fast r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Santiago, Chile, 7–13 December 2015; pp. 1440–1448. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Spatial pyramid pooling in deep convolutional networks for visual recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2015, 37, 1904–1916. [Google Scholar] [CrossRef]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You only look once: Unified, real-time object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788. [Google Scholar]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.Y.; Berg, A.C. Ssd: Single shot multibox detector. In Proceedings of the Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, 11–14 October 2016; Proceedings, Part I 14. Springer: Cham, Switzerland, 2016; pp. 21–37. [Google Scholar]
- Fu, L.; Feng, Y.; Majeed, Y.; Zhang, X.; Zhang, J.; Karkee, M.; Zhang, Q. Kiwifruit detection in field images using Faster R-CNN with ZFNet. IFAC-PapersOnLine 2018, 51, 45–50. [Google Scholar] [CrossRef]
- Parvathi, S.; Selvi, S.T. Detection of maturity stages of coconuts in complex background using Faster R-CNN model. Biosyst. Eng. 2021, 202, 119–132. [Google Scholar] [CrossRef]
- Li, J.; Li, J.; Zhao, X.; Su, X.; Wu, W. Lightweight detection networks for tea bud on complex agricultural environment via improved YOLO v4. Comput. Electron. Agric. 2023, 211, 107955. [Google Scholar] [CrossRef]
- Sun, D.; Zhang, K.; Zhong, H.; Xie, J.; Xue, X.; Yan, M.; Wu, W.; Li, J. Efficient Tobacco Pest Detection in Complex Environments Using an Enhanced YOLOv8 Model. Agriculture 2024, 14, 353. [Google Scholar] [CrossRef]
- Zheng, T.; Jiang, M.; Li, Y.; Feng, M. Research on tomato detection in natural environment based on RC-YOLOv4. Comput. Electron. Agric. 2022, 198, 107029. [Google Scholar] [CrossRef]
- Gai, R.; Chen, N.; Yuan, H. A detection algorithm for cherry fruits based on the improved YOLO-v4 model. Neural Comput. Appl. 2023, 35, 13895–13906. [Google Scholar] [CrossRef]
- Wang, C.Y.; Bochkovskiy, A.; Liao, H.Y.M. YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 7464–7475. [Google Scholar]
- Liu, S.; Qi, L.; Qin, H.; Shi, J.; Jia, J. Path aggregation network for instance segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 8759–8768. [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, Seattle, WA, USA, 13–19 June 2020; pp. 1580–1589. [Google Scholar]
- Hou, Q.; Zhou, D.; Feng, J. Coordinate attention for efficient mobile network design. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 13713–13722. [Google Scholar]
- Tong, Z.; Chen, Y.; Xu, Z.; Yu, R. Wise-IoU: Bounding box regression loss with dynamic focusing mechanism. arXiv 2023, arXiv:2301.10051. [Google Scholar]
- Zheng, Z.; Wang, P.; Liu, W.; Li, J.; Ye, R.; Ren, D. Distance-IoU loss: Faster and better learning for bounding box regression. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 12993–13000. [Google Scholar]
- Xie, X.; Zhou, P.; Li, H.; Lin, Z.; Yan, S. Adan: Adaptive nesterov momentum algorithm for faster optimizing deep models. arXiv 2022, arXiv:2208.06677. [Google Scholar] [CrossRef] [PubMed]
- Hu, J.; Shen, L.; Sun, G. Squeeze-and-excitation networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 7132–7141. [Google Scholar]
- Wang, Q.; Wu, B.; Zhu, P.; Li, P.; Zuo, W.; Hu, Q. ECA-Net: Efficient channel attention for deep convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 11534–11542. [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]
- Yang, L.; Zhang, R.Y.; Li, L.; Xie, X. Simam: A simple, parameter-free attention module for convolutional neural networks. In Proceedings of the International Conference on Machine Learning, Vienna, Austria, 18–24 July 2021; pp. 11863–11874. [Google Scholar]
- Selvaraju, R.R.; Cogswell, M.; Das, A.; Vedantam, R.; Parikh, D.; Batra, D. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 618–626. [Google Scholar]
Configuration | Parameters |
---|---|
CPU | i5-13400F |
GPU | COLORFUL GeForce RTX 3060Ti |
Operating sysrem | Windows 10 |
Accelerated environment | CUDA 11.3 |
Library | torch 1.11.0 + cu113; matplotlib 3.7.3 |
Model | P | R | |||
---|---|---|---|---|---|
YOLOv7-tiny | 89.9% | 80.8% | 86.1% | 13.0 | 5.87 |
+SEnet | 90.5% | 80.1% | 86.8% | 13.2 | 6.06 |
+ECA | 90.2% | 80.5% | 86.6% | 13.1 | 5.88 |
+CBAM | 90.5% | 78.6% | 86.4% | 13.2 | 5.97 |
+SimAM | 89.6% | 80.6% | 86.5% | 13.2 | 5.88 |
+CA | 91.2% | 81.1% | 86.9% | 13.3 | 6.13 |
Tag | Basic | + | + | + | + | + | |||
---|---|---|---|---|---|---|---|---|---|
Model | Ghost-Conv | CA | WIoU | Adan | YOLO Head | ||||
0 | ✔ | 86.1% | 13.0 | 5.87 | |||||
1 | ✔ | ✔ | 85.6% | 10.8 | 4.24 | ||||
2 | ✔ | ✔ | 86.9% | 13.3 | 6.13 | ||||
3 | ✔ | ✔ | 87.2% | 13.0 | 5.87 | ||||
4 | ✔ | ✔ | 87.3% | 13.0 | 5.87 | ||||
5 | ✔ | ✔ | 87.1% | 15.4 | 5.97 | ||||
6 | ✔ | ✔ | ✔ | 86.9% | 12.4 | 4.43 | |||
7 | ✔ | ✔ | ✔ | ✔ | 87.8% | 12.8 | 5.16 | ||
8 | ✔ | ✔ | ✔ | ✔ | ✔ | 87.7% | 12.4 | 4.43 | |
9 | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | 88.2% | 12.8 | 5.16 |
Model | Precision | Recall | |||
---|---|---|---|---|---|
YOLOv5s | 91.8% | 79.6% | 86.2% | 15.8 | 6.85 |
YOLOv6n | – | – | 86.7% | 45.2 | 18.50 |
YOLOv7-tiny | 89.9% | 80.8% | 86.1% | 13.0 | 5.87 |
YOLOv7 | 88.7% | 80.6% | 87.3% | 103.2 | 35.63 |
YOLOv8s | 89.3% | 80% | 87.2% | 28.4 | 10.87 |
Faster R-CNN | – | – | 84.5% | 370.2 | 137.10 |
YOLO-GCWA | 91.3% | 82.3% | 88.2% | 12.8 | 5.16 |
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
Li, C.; Wu, H.; Zhang, T.; Lu, J.; Li, J. Lightweight Network of Multi-Stage Strawberry Detection Based on Improved YOLOv7-Tiny. Agriculture 2024, 14, 1132. https://doi.org/10.3390/agriculture14071132
Li C, Wu H, Zhang T, Lu J, Li J. Lightweight Network of Multi-Stage Strawberry Detection Based on Improved YOLOv7-Tiny. Agriculture. 2024; 14(7):1132. https://doi.org/10.3390/agriculture14071132
Chicago/Turabian StyleLi, Chenglin, Haonan Wu, Tao Zhang, Jiahuan Lu, and Jiehao Li. 2024. "Lightweight Network of Multi-Stage Strawberry Detection Based on Improved YOLOv7-Tiny" Agriculture 14, no. 7: 1132. https://doi.org/10.3390/agriculture14071132