Improved Feature Fusion in YOLOv5 for Accurate Detection and Counting of Chinese Flowering Cabbage (Brassica campestris L. ssp. chinensis var. utilis Tsen et Lee) Buds
Abstract
:1. Introduction
2. Materials and Methods
2.1. Image Acquisition and Data Sets
2.2. Detection and Counting Method
2.2.1. Original YOLOv5
2.2.2. Bud Detection Method Based on Improved YOLOv5
- Add a 4× down-sampling layer.
- Feature fusion with a spatial-aware attention mechanism.
2.2.3. Tracking and Counting Based on Bytetrack
Algorithm 1. A Special Tracking and Counting Method |
Input: idi; classi; (xi,yi); |
Output: Arraytop; Arraydown; Total; nclass0; nclass1; nclass2 |
Constant: (0,ytop1); (width,ytop2); (0,ydown1); (width,ydown2) |
1: if 0 ≤ xi ≤ width and ytop1 ≤ yi ≤ ytop2 then |
2: if idi not in Arraytop then |
3: idi add into Arraytop |
4: if idi in Arraydown then |
5: Total ← Tatal + 1 |
6: if classi == 0 then |
7: nclass0 ← nclass0 + 1 |
8: if classi == 1 then |
9: nclass1 ← nclass1 + 1 |
10: if classi == 2 then |
11: nclass2 ← nclass2 + 1 |
12: Arraydown remove idi |
13: else if 0 ≤ xi ≤ width and ydown1 ≤ yi ≤ ydown2 then |
14: if idi not in Arraydown then |
15: idi add into Arraydown |
16: if idi in Arraytop then |
17: Tatal ← Tatal + 1 |
18: if classi == 0 then |
19: nclass0 ← nclass0 + 1 |
20: if classi == 1 then |
21: nclass1 ← nclass1 + 1 |
22: if classi == 2 then |
23: nclass2 ← nclass2 + 1 |
24: Arraytop remove idi |
25: end if |
26: return total, nclass0, nclass1, nclass2 |
2.3. Evaluation Metrics
3. Results
3.1. Model Training Results and Ablation Experiment
3.2. Experiment on Different Feature Fusion Methods
3.3. Compared with Other Detection Models
3.4. Analysis of Tracking and Counting Results
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Kleiber, T.; Kleiber, T.; Liu, W.; Liu, Y. A review of progress in current research on Chinese flowering cabbage (Brassica campestris L. ssp. chinensis var. utilis Tsen et Lee). J. Elem. 2021, 26, 149–162. [Google Scholar] [CrossRef]
- Hongmei, X.; Kaidong, Z.; Linhuan, J.; Yuanjie, L.; Wenbin, Z. Flower bud detection model for hydroponic Chinese kale based on the fusion of attention mechanism and multi-scale feature. Trans. Chin. Soc. Agric. Eng. 2021, 37, 161–168. [Google Scholar] [CrossRef]
- Gil, M.; Tudela, J.; Martínez-Sánchez, A.; Luna, M. Harvest maturity indicators of leafy vegetables. Stewart Postharvest Rev. 2012, 8, 1–9. [Google Scholar] [CrossRef]
- Yiyu, J.; Shuo, W.; Lina, Z.; Yu, T. Maturity classification using mechanical characteristics of hydroponic lettuce. Trans. Chin. Soc. Agric. Eng. 2023, 39, 179–187. [Google Scholar] [CrossRef]
- Cakmak, H. 10-Assessment of fresh fruit and vegetable quality with non-destructive methods. In Food Quality and Shelf Life; Galanakis, C.M., Ed.; Academic Press: New York, NY, USA, 2019; pp. 303–331. [Google Scholar] [CrossRef]
- Mahanti, N.K.; Pandiselvam, R.; Kothakota, A.; Ishwarya, S.P.; Chakraborty, S.K.; Kumar, M.; Cozzolino, D. Emerging non-destructive imaging techniques for fruit damage detection: Image processing and analysis. Trends Food Sci. Technol. 2022, 120, 418–438. [Google Scholar] [CrossRef]
- Antonelli, M.G.; Zobel, P.B.; Durante, F.; Raparelli, T. Development of an Automated System for the Selective Harvesting of Radicchio. Int. J. Auto. Technol.-Jpn. 2017, 11, 415–424. [Google Scholar] [CrossRef]
- Birrell, S.; Hughes, J.; Cai, J.Y.; Iida, F. A field-tested robotic harvesting system for iceberg lettuce. J. Field Robot. 2020, 37, 225–245. [Google Scholar] [CrossRef]
- Cakmak, H.; Sogut, E. Imaging Techniques for Evaluation of Ripening and Maturity of Fruits and Vegetables. In Nondestructive Quality Assessment Techniques for Fresh Fruits and Vegetables; Pathare, P.B., Rahman, M.S., Eds.; Springer Nature: Singapore, 2022; pp. 35–59. [Google Scholar] [CrossRef]
- NY/T 1647-2008; Guangzhou Ministry of Agriculture Vegetable and Fruit Quality Supervision, I.A.T.C. Grades and Specifications of Flowering Chinese Cabbage. Industry Standards-Agricultural: Beijing, China, 2008.
- Xiao, F.; Wang, H.; Li, Y.; Cao, Y.; Lv, X.; Xu, G. Object Detection and Recognition Techniques Based on Digital Image Processing and Traditional Machine Learning for Fruit and Vegetable Harvesting Robots: An Overview and Review. Agronomy 2023, 13, 639. [Google Scholar] [CrossRef]
- Mamat, N.; Othman, M.F.; Abdoulghafor, R.; Belhaouari, S.B.; Mamat, N.; Hussein, S.F.M. Advanced Technology in Agriculture Industry by Implementing Image Annotation Technique and Deep Learning Approach: A Review. Agriculture 2022, 12, 1033. [Google Scholar] [CrossRef]
- Yu, X.; Fan, Z.; Wang, X.; Wan, H.; Wang, P.; Zeng, X.; Jia, F. A lab-customized autonomous humanoid apple harvesting robot. Comput. Electr. Eng. 2021, 96, 107459. [Google Scholar] [CrossRef]
- Hameed, K.; Chai, D.; Rassau, A. Texture-based latent space disentanglement for enhancement of a training dataset for ANN-based classification of fruit and vegetables. Inf. Process. Agric. 2023, 10, 85–105. [Google Scholar] [CrossRef]
- Lin, G.; Tang, Y.; Zou, X.; Cheng, J.; Xiong, J. Fruit detection in natural environment using partial shape matching and probabilistic Hough transform. Precis. Agric. 2020, 21, 160–177. [Google Scholar] [CrossRef]
- Septiarini, A.; Sunyoto, A.; Hamdani, H.; Kasim, A.A.; Utaminingrum, F.; Hatta, H.R. Machine vision for the maturity classification of oil palm fresh fruit bunches based on color and texture features. Sci. Hortic. 2021, 286, 110245. [Google Scholar] [CrossRef]
- Bhargava, A.; Bansal, A. Classification and grading of multiple varieties of apple fruit. Food Anal. Method. 2021, 14, 1359–1368. [Google Scholar] [CrossRef]
- Hua, X.; Li, H.; Zeng, J.; Han, C.; Chen, T.; Tang, L.; Luo, Y. A Review of Target Recognition Technology for Fruit Picking Robots: From Digital Image Processing to Deep Learning. Appl. Sci. 2023, 13, 4160. [Google Scholar] [CrossRef]
- Akkem, Y.; Biswas, S.K.; Varanasi, A. Smart farming using artificial intelligence: A review. Eng. Appl. Artif. Intell. 2023, 120, 105899. [Google Scholar] [CrossRef]
- Darwin, B.; Dharmaraj, P.; Prince, S.; Popescu, D.E.; Hemanth, D.J. Recognition of Bloom/Yield in Crop Images Using Deep Learning Models for Smart Agriculture: A Review. Agronomy 2021, 11, 646. [Google Scholar] [CrossRef]
- Amjoud, A.B.; Amrouch, M. Object Detection Using Deep Learning, CNNs and Vision Transformers: A Review. IEEE Access 2023, 11, 35479–35516. [Google Scholar] [CrossRef]
- Zhu, L.; Wang, X.; Ke, Z.; Zhang, W.; Lau, R. BiFormer: Vision Transformer with Bi-Level Routing Attention. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 10323–10333. [Google Scholar] [CrossRef]
- Li, Y.; Huang, Q.; Pei, X.; Chen, Y.; Jiao, L.; Shang, R. Cross-Layer Attention Network for Small Object Detection in Remote Sensing Imagery. IEEE J. Sel. Top. Appl. Earth Obs. Remote Sens. 2021, 14, 2148–2161. [Google Scholar] [CrossRef]
- Li, R.; Wu, Y. Improved YOLO v5 Wheat Ear Detection Algorithm Based on Attention Mechanism. Electronics 2022, 11, 1673. [Google Scholar] [CrossRef]
- Chen, Y.; Zheng, L.L.; Peng, H.X. Assessing Pineapple Maturity in Complex Scenarios Using an Improved Retinanet Algorithm. Eng. Agric. 2023, 43, e20220180. [Google Scholar] [CrossRef]
- Rong, J.; Zhou, H.; Zhang, F.; Yuan, T.; Wang, P. Tomato cluster detection and counting using improved YOLOv5 based on RGB-D fusion. Comput. Electron. Agric. 2023, 207, 107741. [Google Scholar] [CrossRef]
- Wang, Z.; Walsh, K.; Koirala, A. Mango Fruit Load Estimation Using a Video Based MangoYOLO-Kalman Filter-Hungarian Algorithm Method. Sensors 2019, 19, 2742. [Google Scholar] [CrossRef] [PubMed]
- Li, Y.; Ma, R.; Zhang, R.; Cheng, Y.; Dong, C. A Tea Buds Counting Method Based on YOLOv5 and Kalman Filter Tracking Algorithm. Plant Phenomics 2023, 5, 30. [Google Scholar] [CrossRef] [PubMed]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You Only Look Once: Unified, Real-Time Object Detection. Computer Vision & Pattern Recognition. arXiv 2016, arXiv:1506.02640. [Google Scholar]
- Park, H.; Yoo, Y.; Seo, G.; Han, D.; Yun, S.; Kwak, N. C3: Concentrated-Comprehensive Convolution and its application to semantic segmentation. arXiv 2018. [Google Scholar] [CrossRef]
- Wang, K.; Liew, J.H.; Zou, Y.; Zhou, D.; Feng, J. Panet: Few-shot image semantic segmentation with prototype alignment. In Proceedings of the the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 9197–9206. [Google Scholar]
- Thuan, D. Evolution of Yolo Algorithm and Yolov5: The State-of-the-Art Object Detection Algorithm; Oulu University of Applied Sciences: Oulu, Finland, 2021. [Google Scholar]
- Li, S.; Zhang, S.; Xue, J.; Sun, H. Lightweight target detection for the field flat jujube based on improved YOLOv5. Comput. Electron. Agric. 2022, 202, 107391. [Google Scholar] [CrossRef]
- Dai, X.; Chen, Y.; Xiao, B.; Chen, D.; Liu, M.; Lu, Y.; Zhang, L. Dynamic Head: Unifying Object Detection Heads with Attentions. arXiv 2021. [Google Scholar] [CrossRef]
- Han, Z.; Fang, Z.; Li, Y.; Fu, B. A novel Dynahead-Yolo neural network for the detection of landslides with variable proportions using remote sensing images. Front. Earth Sci. 2023, 10, 1077153. [Google Scholar] [CrossRef]
- Chen, Y.; Dai, X.; Liu, M.; Chen, D.; Yuan, L.; Liu, Z. Dynamic ReLU. In Proceedings of the Computer Vision—ECCV 2020: 16th European Conference, Glasgow, UK, 23–28 August 2020; Proceedings, Part XIX 16. Springer: Berlin/Heidelberg, Germany, 2020; pp. 351–367. [Google Scholar] [CrossRef]
- Zhang, Y.; Sun, P.; Jiang, Y.; Yu, D.; Weng, F.; Yuan, Z.; Luo, P.; Liu, W.; Wang, X. Bytetrack: Multi-Object tracking by associating every detection box. In Proceedings of the European Conference on Computer Vision, Tel Aviv, Israel, 23–27 October 2022; Springer: Berlin/Heidelberg, Germany, 2022; pp. 1–21. [Google Scholar] [CrossRef]
- Hsu, W.-Y.; Lin, W.-Y. Adaptive Fusion of Multi-Scale YOLO for Pedestrian Detection. IEEE Access 2021, 9, 110063–110073. [Google Scholar] [CrossRef]
- Liu, Y.; Lu, N.; Shieh, P.; Sun, C. Combination of a Self-Regulation Module and Mobile Application to Enhance Treatment Outcome for Patients with Acne. Medicina 2020, 56, 276. [Google Scholar] [CrossRef]
- Mahdavi-Hormat, A.; Menhaj, M.B.; Shakarami, A. An effective Reinforcement Learning method for preventing the overfitting of Convolutional Neural Networks. Adv. Comput. Intell. 2022, 2, 34. [Google Scholar] [CrossRef]
- Lawal, O.M.; Huamin, Z.; Fan, Z. Ablation studies on YOLOFruit detection algorithm for fruit harvesting robot using deep learning. Iop Conf. Ser. Earth Environ. Sci. 2021, 922, 12001. [Google Scholar] [CrossRef]
- Liu, Y.; Sun, P.; Wergeles, N.; Shang, Y. A survey and performance evaluation of deep learning methods for small object detection. Expert Syst. Appl. 2021, 172, 114602. [Google Scholar] [CrossRef]
- Yang, J.; Ge, H.; Yang, J.; Tong, Y.; Su, S. Online multi-object tracking using multi-function integration and tracking simulation training. Appl. Intell. 2022, 52, 1268–1288. [Google Scholar] [CrossRef]
- Dai, J.; Qi, H.; Xiong, Y.; Li, Y.; Zhang, G.; Hu, H.; Wei, Y. Deformable convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 764–773. [Google Scholar]
- Sun, Q.; Chai, X.; Zeng, Z.; Zhou, G.; Sun, T. Noise-tolerant RGB-D feature fusion network for outdoor fruit detection. Comput. Electron. Agric. 2022, 198, 107034. [Google Scholar] [CrossRef]
- Li, Y.; He, L.; Jia, J.; Lv, J.; Chen, J.; Qiao, X.; Wu, C. In-field tea shoot detection and 3D localization using an RGB-D camera. Comput. Electron. Agric. 2021, 185, 106149. [Google Scholar] [CrossRef]
Set | Number of Images | Target Boxes | |||
---|---|---|---|---|---|
Ripe | Growing | Over-Ripe | Total | ||
Train | 3110 | 13,953 | 9317 | 4351 | 27,621 |
Validation | 890 | 4245 | 2323 | 1125 | 7693 |
Test | 445 | 2644 | 1506 | 558 | 4708 |
Total | 4445 | 20,842 | 13,146 | 6034 | 40,022 |
Configuration | Parameter |
---|---|
Development environment | Anaconda3-2021.11 + Pycharm (v 2022.1.3) |
CPU (Central Processing Unit) | Intel Core i9-11900 K |
GPU (Graphic Processing Unit) | Nvidia GeForce RTX 3060Ti |
Operating system | Windows 10 |
Accelerated environment | CUDA11.3 CUDNN8.3.0 |
Development of language | Python3.8 |
Add_P2 | Spatial-Aware Attention | Scale-Aware Attention | Task-Aware Attention | Precision (%) | Recall (%) | [email protected] (%) |
---|---|---|---|---|---|---|
- | - | - | - | 83.5 | 85.5 | 88.7 |
√ | - | - | - | 83.3 | 86.5 | 89.2 |
√ | √ | - | - | 85.5 | 88.3 | 92.6 |
√ | √ | √ | - | 85.9 | 89.7 | 93.4 |
√ | √ | √ | √ | 86.5 | 90.1 | 93.9 |
Method | Layers | Parameters | Flops | Precision (%) | Recall (%) | [email protected] (%) |
---|---|---|---|---|---|---|
A | 194 | 4,837,152 | 58.0 G | 83.3 | 86.5 | 89.2 |
B | 260 | 7,172,000 | 75.2 G | 87.1 | 86.8 | 91.4 |
C | 278 | 7,231,214 | 77.6 G | 85.4 | 87.2 | 90.3 |
D | 165 | 4,486,860 | 48.8 G | 86.3 | 88.2 | 91.6 |
E | 231 | 5,003,980 | 63.8 G | 86.5 | 90.1 | 93.9 |
F | 297 | 7,349,068 | 81.0 G | 86.2 | 89.8 | 92.7 |
Model | Parameters | Flops | Precision (%) | Recall (%) | [email protected] (%) |
---|---|---|---|---|---|
SSD-VGG | 23,879,570 | 1.096 T | 83.6 | 87.5 | 89.6 |
Faster-RCNN | 136,729,994 | 1.176 T | 81.6 | 85.3 | 87.2 |
YOLOv4 | 63,948,456 | 567.74 G | 86.5 | 89.1 | 90.7 |
YOLOX-S | 8,938,456 | 107.045 G | 83.5 | 87.3 | 91.0 |
YOLOv7 | 9,324,824 | 106.7 G | 85.9 | 89.6 | 92.6 |
FPNDyH-YOLOv5 | 5,003,980 | 63.8 G | 86.5 | 90.1 | 93.9 |
Video | Manual Counting | Algorithm Counting | ||||||
---|---|---|---|---|---|---|---|---|
Ripe | Growing | Over-Ripe | Total | Ripe | Growing | Over-Ripe | Total | |
1 | 87 | 37 | 21 | 145 | 79 | 30 | 20 | 129 |
2 | 70 | 42 | 14 | 126 | 64 | 35 | 16 | 115 |
3 | 68 | 36 | 15 | 119 | 61 | 27 | 14 | 102 |
4 | 73 | 35 | 20 | 128 | 64 | 26 | 22 | 112 |
5 | 76 | 40 | 18 | 134 | 70 | 34 | 20 | 124 |
Total | 374 | 190 | 88 | 652 | 338 | 152 | 92 | 582 |
Average counting accuracy (%) | 90.4 | 80 | 95.1 | 88.5 |
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
Yuan, K.; Wang, Q.; Mi, Y.; Luo, Y.; Zhao, Z. Improved Feature Fusion in YOLOv5 for Accurate Detection and Counting of Chinese Flowering Cabbage (Brassica campestris L. ssp. chinensis var. utilis Tsen et Lee) Buds. Agronomy 2024, 14, 42. https://doi.org/10.3390/agronomy14010042
Yuan K, Wang Q, Mi Y, Luo Y, Zhao Z. Improved Feature Fusion in YOLOv5 for Accurate Detection and Counting of Chinese Flowering Cabbage (Brassica campestris L. ssp. chinensis var. utilis Tsen et Lee) Buds. Agronomy. 2024; 14(1):42. https://doi.org/10.3390/agronomy14010042
Chicago/Turabian StyleYuan, Kai, Qian Wang, Yalong Mi, Yangfan Luo, and Zuoxi Zhao. 2024. "Improved Feature Fusion in YOLOv5 for Accurate Detection and Counting of Chinese Flowering Cabbage (Brassica campestris L. ssp. chinensis var. utilis Tsen et Lee) Buds" Agronomy 14, no. 1: 42. https://doi.org/10.3390/agronomy14010042
APA StyleYuan, K., Wang, Q., Mi, Y., Luo, Y., & Zhao, Z. (2024). Improved Feature Fusion in YOLOv5 for Accurate Detection and Counting of Chinese Flowering Cabbage (Brassica campestris L. ssp. chinensis var. utilis Tsen et Lee) Buds. Agronomy, 14(1), 42. https://doi.org/10.3390/agronomy14010042