Real-Time Detection of Mango Based on Improved YOLOv4
Abstract
:1. Introduction
- Adjust the width of the backbone network and reduce it by half.
- Reduce the depth of the backbone network and modify the residual blocks in the CSP_Darknet module to layers 1, 2, 4, 4, 2.
- The neck network is modified to remove the convolutional layer, leaving only one convolutional layer module.
- Attention mechanism is added to the channel from backbone network to neck network to improve the detection accuracy of the whole neural network.
2. Materials and Methods
- In order to ensure the diversity of data, the database consisted of many different individual hanging fruits from different trees.
- The shooting time was at night. In order to ensure observable mango fruits, illuminating mangoes with LED lights.
- In order to obtain more characteristic information, the mangoes images should include the presence of complicating factors, such as occlusion. The database should also be sufficiently large.
3. YOLOv4 and the Adjusted Network
3.1. YOLOv4 Model
3.2. Network after Adjustment
3.2.1. Adjust the Width of the Trunk Network
3.2.2. Backbone Network Depth
3.2.3. Modifying the Neck Network
3.2.4. Add Attention Mechanism
3.2.5. New Network
4. Experimental Results and Analysis
4.1. Model Training
4.2. Evaluation Index
4.3. Experimental Results
4.3.1. Width Adjustment Experiment
4.3.2. Adjustment Experiment of Trunk Depth
4.3.3. Shear Comparison Experiment of Neck Network
4.3.4. Comparative Experiment of Attention Mechanism
4.3.5. Comparison Experiment with Other Algorithms
4.4. Result Analysis
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Lin, P.; Lee, W.S.; Chen, Y.M.; Peres, N.; Fraisse, C. A deep-level region-based visual representation architecture for detecting strawberry flowers in an outdoor field. Precis. Agric. 2020, 21, 387–402. [Google Scholar] [CrossRef]
- Wan, S.; Goudos, S. Faster R-CNN for multi-class fruit detection using a robotic vision system. Comput. Netw. 2020, 168, 107036. [Google Scholar] [CrossRef]
- Parvathi, S.; Tamil Selvi, S. Detection of maturity stages of coconuts in complex background using Faster R-CNN model. Biosyst. Eng. 2021, 202, 119–132. [Google Scholar] [CrossRef]
- Zhao, S.; Liu, J.; Wu, S. Multiple disease detection method for greenhouse-cultivated strawberry based on multiscale feature fusion Faster R_CNN. Comput. Electron. Agric. 2022, 199, 107176. [Google Scholar] [CrossRef]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You Only Look Once: Unified, Real-Time Object Detection. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLO9000: Better, Faster, Stronger. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017; pp. 6517–6525. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLOv3: An Incremental Improvement. arXiv 2018, arXiv:1804.02767. [Google Scholar]
- Liu, G.; Nouaze, J.C.; Touko Mbouembe, P.L.; Kim, J.H. YOLO-Tomato: A Robust Algorithm for Tomato Detection Based on YOLOv3. Sensors 2020, 20, 2145. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Wang, X.; Vladislav, Z.; Viktor, O.; Wu, Z.; Zhao, M. Online recognition and yield estimation of tomato in plant factory based on YOLOv3. Sci. Rep. 2022, 12, 8686. [Google Scholar] [CrossRef]
- Liu, T.-H.; Nie, X.-N.; Wu, J.-M.; Zhang, D.; Liu, W.; Cheng, Y.-F.; Zheng, Y.; Qiu, J.; Qi, L. Pineapple (Ananas comosus) fruit detection and localization in natural environment based on binocular stereo vision and improved YOLOv3 model. Precis. Agric. 2022. [Google Scholar] [CrossRef]
- Bochkovskiy, A.; Wang, C.-Y.; Liao, H.-Y.M. Yolov4: Optimal speed and accuracy of object detection. arXiv 2020, arXiv:2004.10934. [Google Scholar]
- Gai, R.; Chen, N.; Yuan, H. A detection algorithm for cherry fruits based on the improved YOLO-v4 model. Neural Comput. Appl. 2021. [Google Scholar] [CrossRef]
- Fan, S.; Liang, X.; Huang, W.; Jialong Zhang, V.; Pang, Q.; He, X.; Li, L.; Zhang, C. Real-time defects detection for apple sorting using NIR cameras with pruning-based YOLOv4 network. Comput. Electron. Agric. 2022, 193, 106715. [Google Scholar] [CrossRef]
- Wang, Y.; Yan, G.; Meng, Q.; Yao, T.; Han, J.; Zhang, B. DSE-YOLO: Detail semantics enhancement YOLO for multi-stage strawberry detection. Comput. Electron. Agric. 2022, 198, 107057. [Google Scholar] [CrossRef]
- Liang, Q.; Zhu, W.; Long, J.; Wang, Y.; Sun, W.; Wu, W. A Real-Time Detection Framework for On-Tree Mango Based on SSD Network. In Proceedings of the Intelligent Robotics and Applications; Springer: Cham, Switzerland, 2018; pp. 423–436. [Google Scholar]
- Vasconez, J.P.; Delpiano, J.; Vougioukas, S.; Auat Cheein, F. Comparison of convolutional neural networks in fruit detection and counting: A comprehensive evaluation. Comput. Electron. Agric. 2020, 173, 105348. [Google Scholar] [CrossRef]
- Anagnostis, A.; Tagarakis, A.C.; Asiminari, G.; Papageorgiou, E.; Kateris, D.; Moshou, D.; Bochtis, D. A deep learning approach for anthracnose infected trees classification in walnut orchards. Comput. Electron. Agric. 2021, 182, 105998. [Google Scholar] [CrossRef]
- Fu, L.; Feng, Y.; Wu, J.; Liu, Z.; Gao, F.; Majeed, Y.; Al-Mallahi, A.; Zhang, Q.; Li, R.; Cui, Y. Fast and accurate detection of kiwifruit in orchard using improved YOLOv3-tiny model. Precis. Agric. 2021, 22, 754–776. [Google Scholar] [CrossRef]
- Magalhães, S.A.; Castro, L.; Moreira, G.; dos Santos, F.N.; Cunha, M.; Dias, J.; Moreira, A.P. Evaluating the Single-Shot MultiBox Detector and YOLO Deep Learning Models for the Detection of Tomatoes in a Greenhouse. Sensors 2021, 21, 3569. [Google Scholar] [CrossRef]
- Gao, F.; Fang, W.; Sun, X.; Wu, Z.; Zhao, G.; Li, G.; Li, R.; Fu, L.; Zhang, Q. A novel apple fruit detection and counting methodology based on deep learning and trunk tracking in modern orchard. Comput. Electron. Agric. 2022, 197, 107000. [Google Scholar] [CrossRef]
- Li, D.; Sun, X.; Elkhouchlaa, H.; Jia, Y.; Yao, Z.; Lin, P.; Li, J.; Lu, H. Fast detection and location of longan fruits using UAV images. Comput. Electron. Agric. 2021, 190, 106465. [Google Scholar] [CrossRef]
- Xu, Z.F.; Jia, R.S.; Liu, Y.B.; Zhao, C.Y.; Sun, H.M. Fast Method of Detecting Tomatoes in a Complex Scene for Picking Robots. IEEE Access 2020, 8, 55289–55299. [Google Scholar] [CrossRef]
- Zhou, Z.; Song, Z.; Fu, L.; Gao, F.; Li, R.; Cui, Y. Real-time kiwifruit detection in orchard using deep learning on Android™ smartphones for yield estimation. Comput. Electron. Agric. 2020, 179, 105856. [Google Scholar] [CrossRef]
- Xiao, D.; Li, H.; Liu, C.; He, Q. Large-Truck Safety Warning System Based on Lightweight SSD Model. Comput. Intell. Neurosci. 2019, 2019, 2180294. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Jiang, L.; Nie, W.; Zhu, J.; Gao, X.; Lei, B. Lightweight object detection network model suitable for indoor mobile robots. J. Mech. Sci. Technol. 2022, 36, 907–920. [Google Scholar] [CrossRef]
- 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; pp. 7132–7141. [Google Scholar]
- Zhang, C.; Lin, G.; Liu, F.; Yao, R.; Shen, C. CANet: Class-Agnostic Segmentation Networks With Iterative Refinement and Attentive Few-Shot Learning. In Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Long Beach, CA, USA, 15–20 June 2019; pp. 5212–5221. [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 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 13–19 June 2020; pp. 11531–11539. [Google Scholar]
- Woo, S.; Park, J.; Lee, J.-Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. In Proceedings of the Computer Vision–ECCV 2018; Springer: Cham, Switzerland, 2018; pp. 3–19. [Google Scholar]
- Qin, Z.; Zhang, P.; Wu, F.; Li, X. FcaNet: Frequency Channel Attention Networks. In Proceedings of the 2021 IEEE/CVF International Conference on Computer Vision (ICCV), Montreal, QC, Canada, 10–17 October 2021; pp. 763–772. [Google Scholar]
Model | F1 | Recall/% | Precision/% | mAP/% | FPS | Model Size/M |
---|---|---|---|---|---|---|
YOLOv4 | 0.93 | 91.64 | 95.18 | 91.32 | 24.5 | 244.4 |
YOLOv4-bo | 0.95 | 96.42 | 92.97 | 95.92 | 29.2 | 166.9 |
YOLOv4-ne | 0.94 | 94.69 | 93.21 | 94.24 | 29.5 | 138.1 |
YOLOv4-half | 0.94 | 95.62 | 92.79 | 95.06 | 32.8 | 61.3 |
Model | F1 | Recall/% | Precision/% | mAP/% | FPS | Model Size/M |
---|---|---|---|---|---|---|
YOLOv4-half | 0.94 | 95.62 | 92.79 | 95.06 | 32.8 | 61.3 |
YOLOv4-half-6 | 0.94 | 94.36 | 93.93 | 93.90 | 35.0 | 57.2 |
YOLOv4-half-4 | 0.94 | 95.62 | 93.15 | 95.08 | 38.0 | 53.1 |
YOLOv4-half-2 | 0.94 | 95.49 | 92.78 | 94.97 | 44.2 | 49.0 |
Model | F1 | Recall/% | Precision/% | mAP/% | FPS | Model Size/M |
---|---|---|---|---|---|---|
YOLOv4-half-4 | 0.94 | 95.62 | 93.15 | 95.08 | 38.0 | 53.1 |
YOLOv4-half-4-Ls | 0.94 | 95.03 | 9281 | 94.46 | 48.1 | 38.0 |
YOLOv4-half-4-Lc | 0.94 | 95.89 | 92.93 | 95.29 | 51.6 | 31.0 |
YOLOv4-half-4-L | 0.94 | 95.42 | 93.08 | 94.79 | 53.0 | 35.6 |
Model | F1 | Recall/% | Precision/% | mAP/% | FPS | Model Size/M |
---|---|---|---|---|---|---|
YOLOv4-half-4-Lc | 0.94 | 95.89 | 92.93 | 95.29 | 51.6 | 31.0 |
YOLOv4-LightC-SE | 0.94 | 95.89 | 92.87 | 95.30 | 48.1 | 31.1 |
YOLOv4-LightC-CA | 0.94 | 95.36 | 92.48 | 94.72 | 44.9 | 31.1 |
YOLOv4-LightC-ECA | 0.94 | 95.56 | 93.09 | 94.90 | 50.8 | 31.0 |
YOLOv4-LightC-CBAM | 0.94 | 96.09 | 92.12 | 95.39 | 45.4 | 31.2 |
YOLOv4-LightC-FCA | 0.94 | 94.89 | 93.53 | 94.34 | 49.9 | 31.1 |
Model | F1 | Recall/% | Precision/% | mAP/% | FPS | Model Size/M |
---|---|---|---|---|---|---|
YOLOv4 | 0.93 | 91.64 | 95.18 | 91.32 | 24.5 | 244.4 |
Faster R-CNN | 0.81 | 97.28 | 69.72 | 94.48 | 1.9 | 108.1 |
SSD | 0.87 | 79.84 | 95.40 | 79.33 | 40.2 | 90.6 |
YOLOv3 | 0.93 | 93.70 | 92.23 | 93.14 | 32.1 | 60.0 |
YOLOv4-Tiny | 0.92 | 93.50 | 90.04 | 92.68 | 98.9 | 22.5 |
YOLOv4-LightC-CBAM | 0.94 | 96.09 | 92.12 | 95.39 | 45.4 | 31.2 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 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
Cao, Z.; Yuan, R. Real-Time Detection of Mango Based on Improved YOLOv4. Electronics 2022, 11, 3853. https://doi.org/10.3390/electronics11233853
Cao Z, Yuan R. Real-Time Detection of Mango Based on Improved YOLOv4. Electronics. 2022; 11(23):3853. https://doi.org/10.3390/electronics11233853
Chicago/Turabian StyleCao, Zhipeng, and Ruibo Yuan. 2022. "Real-Time Detection of Mango Based on Improved YOLOv4" Electronics 11, no. 23: 3853. https://doi.org/10.3390/electronics11233853
APA StyleCao, Z., & Yuan, R. (2022). Real-Time Detection of Mango Based on Improved YOLOv4. Electronics, 11(23), 3853. https://doi.org/10.3390/electronics11233853