Improved YOLOv8-Seg Network for Instance Segmentation of Healthy and Diseased Tomato Plants in the Growth Stage
Abstract
:1. Introduction
- (1)
- To enhance the edge features of the tomatoes, algorithms such as Gaussian blur, Sobel operator, and weighted superposition were used to sharpen the 1600 photos in the original dataset. Further data enhancement operations expanded the dataset to 9600 photos;
- (2)
- (3)
- An improved YOLOv8s-Seg algorithm was proposed to address the slow running time, high parameter count, and large number of calculations of the two-stage instance segmentation model. This algorithm was designed with the aim of effective, real-time instance segmentation of healthy and diseased tomatoes.
2. Materials and Methods
2.1. Data Acquisition
2.2. Image Preprocessing
2.3. Tomato Instance Segmentation Based on Improved YOLOv8s-Seg
2.4. Model Training and Performance Evaluation
3. Results and Discussion
3.1. Instance Segmentation between Growing and Diseased Tomatoes
3.2. Comparison with Other Instance Segmentation Algorithms
3.3. Comparison of the Improved YOLOv8s-Seg and YOLOv8s-Seg
3.4. Effect of Different Image Resolutions on Tomato Segmentation
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Data Availability Statement
Conflicts of Interest
References
- Lee, J.; Nazki, H.; Baek, J.; Hong, Y.; Lee, M. Artificial intelligence approach for tomato detection and mass estimation in precision agriculture. Sustainability 2020, 12, 9138. [Google Scholar] [CrossRef]
- Fan, Y.Y.; Zhang, Z.M.; Chen, G.P. Application of vision sensor in the target fruit recognition system of picking robot. Agric. Mech. Res. 2019, 41, 210–214. [Google Scholar]
- Gongal, A.; Amatya, S.; Karkee, M.; Zhang, Q.; Lewis, K. Sensors and systems for fruit detection and localization: A review. Comput. Electron. Agric. 2015, 116, 8–19. [Google Scholar] [CrossRef]
- Si, Y.; Liu, G.; Feng, J. Location of apples in trees using stereoscopic vision. Comput. Electron. Agric. 2015, 112, 68–74. [Google Scholar] [CrossRef]
- Yin, H.; Chai, Y.; Yang, S.X.; Mittal, G.S. Ripe tomato recognition and localization for a tomato harvesting robotic system. In Proceedings of the International Conference of Soft Computing and Pattern Recognition, Malacca, Malaysia, 4–7 December 2009; pp. 557–562. [Google Scholar] [CrossRef]
- He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. Mask r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 2961–2969. [Google Scholar] [CrossRef]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster r-cnn: Towards real-time object detection with region proposal networks. In Proceedings of the Advances in Neural Information Processing Systems 28 (NIPS 2015), NeurIPS, Montreal, BC, Canada, 7–12 December 2015; p. 28. [Google Scholar] [CrossRef]
- Jia, W.; Tian, Y.; Luo, R.; Zhang, Z.; Lian, J.; Zheng, Y. Detection and segmentation of overlapped fruits based on optimized mask R-CNN application in apple harvesting robot. Comput. Electron. Agric. 2020, 172, 105380. [Google Scholar] [CrossRef]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar] [CrossRef]
- Huang, Y.P.; Wang, T.H.; Basanta, H. Using fuzzy mask R-CNN model to automatically identify tomato ripeness. IEEE Access 2020, 8, 207672–207682. [Google Scholar] [CrossRef]
- Afonso, M.; Fonteijn, H.; Fiorentin, F.S.; Lensink, D.; Mooij, M.; Faber, N.; Polder, G.; Wehrens, R. Tomato fruit detection and counting in greenhouses using deep learning. Front. Plant Sci. 2020, 11, 571299. [Google Scholar] [CrossRef]
- Wang, D.; He, D. Fusion of Mask RCNN and Attention Mechanism for Instance Segmentation of Apples under Complex Background. Comput. Electron. Agric. 2022, 196, 106864. [Google Scholar] [CrossRef]
- Wang, C.; Yang, G.; Huang, Y.; Liu, Y.; Zhang, Y. A Transformer-based Mask R-CNN for Tomato Detection and Segmentation. Intell. Fuzzy Syst. 2023, 44, 8585–8595. [Google Scholar] [CrossRef]
- Wang, Q.; Qi, F.; Sun, M.; Qu, J.; Xue, J. Identification of Tomato Disease Types and Detection of Infected Areas Based on Deep Convolutional Neural Networks and Object Detection Techniques. Comput. Intell. Neurosci. 2019, 2019, 9142753. [Google Scholar] [CrossRef]
- Hsieh, K.W.; Huang, B.Y.; Hsiao, K.Z.; Tuan, Y.H.; Shih, F.P.; Hsieh, L.C.; Chen, S.; Yang, I.C. Fruit maturity and location identification of beef tomato using R-CNN and binocular imaging technology. Food Meas. Charact. 2021, 15, 5170–5180. [Google Scholar] [CrossRef]
- Liu, L.; Bi, Q.; Liang, J.; Li, Z.; Wang, W.; Zheng, Q. Farmland Soil Block Identification and Distribution Statistics Based on Deep Learning. Agriculture 2022, 12, 2038. [Google Scholar] [CrossRef]
- Bolya, D.; Zhou, C.; Xiao, F.; Lee, Y.J. Yolact: Real-time instance segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, South Korea, 27 October–2 November 2019; pp. 9157–9166. [Google Scholar] [CrossRef]
- Mubashiru, L.O. YOLOv5-LiNet: A lightweight network for fruits instance segmentation. PLoS ONE 2023, 18, e0282297. [Google Scholar] [CrossRef]
- Li, C.; Li, L.; Jiang, H.; Weng, K.; Geng, Y.; Li, L.; Ke, Z.; Li, Q.; Cheng, M.; Nie, W.; et al. YOLOv6: A single-stage object detection framework for industrial applications. arXiv 2022. [Google Scholar] [CrossRef]
- Weng, K.; Chu, X.; Xu, X.; Huang, J.; Wei, X. EfficientRep: An Efficient Repvgg-style ConvNets with Hardware-aware Neural Network Design. arXiv 2023. [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] [PubMed]
- 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, 18–22 June 2023; pp. 7464–7475. [Google Scholar] [CrossRef]
- Feng, C.; Zhong, Y.; Gao, Y.; Scott, M.R.; Huang, W. Tood: Task-aligned one-stage object detection. In Proceedings of the 2021 IEEE/CVF International Conference on Computer Vision (ICCV), Montreal, QC, Canada, 10–17 October 2021; pp. 3490–3499. [Google Scholar] [CrossRef]
- Li, X.; Wang, W.; Wu, L.; Chen, S.; Hu, X.; Li, J.; Tang, J.; Yang, J. Generalized focal loss: Learning qualified and distributed bounding boxes for dense object detection. Adv. Neural Inf. Process. Syst. 2020, 33, 21002–21012. [Google Scholar] [CrossRef]
- Ge, Z.; Liu, S.; Wang, F.; Li, Z.; Sun, J. Yolox: Exceeding yolo series in 2021. arXiv 2021. [Google Scholar] [CrossRef]
- Wang, C.Y.; Liao, H.Y.M.; Wu, Y.H.; Chen, P.Y.; Hsieh, J.W.; Yeh, I.H. CSPNet: A new backbone that can enhance learning capability of CNN. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 390–391. [Google Scholar] [CrossRef]
- Liu, S.; Qi, L.; Qin, H.; Shi, J.; Jia, J. Path aggregation network for instance segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 8759–8768. [Google Scholar] [CrossRef]
- Lin, T.Y.; Dollár, P.; Girshick, R.; He, K.; Hariharan, B.; Belongie, S. Feature pyramid networks for object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 2117–2125. [Google Scholar] [CrossRef]
- Tian, Y.; Yang, G.; Wang, Z.; Li, E.; Liang, Z. Instance segmentation of apple flowers using the improved mask R–CNN model. Biosyst. Eng. 2020, 193, 264–278. [Google Scholar] [CrossRef]
Type | Number of Images after Sharpening | Train (Data Enhancement) | Validation (Data Enhancement) | Number of Instances (Validation) |
---|---|---|---|---|
late blight | 156 | 655 | 281 | 602 |
crack | 150 | 630 | 270 | 740 |
grey mold | 152 | 638 | 274 | 593 |
virus | 164 | 689 | 295 | 589 |
rot | 174 | 731 | 313 | 601 |
canker | 166 | 697 | 299 | 579 |
ripe | 161 | 677 | 289 | 852 |
half-ripe | 152 | 638 | 274 | 778 |
immature | 168 | 706 | 302 | 900 |
young | 157 | 659 | 283 | 780 |
Total | 1600 | 6720 | 2880 | 6744 |
Models | Seg mAP@0.5 (%) | Model Size (MB) |
---|---|---|
YOLOv8n-Seg | 0.853 | 6.5 |
YOLOv8s-Seg | 0.898 | 20.4 |
YOLOv8m-Seg | 0.900 | 54.8 |
YOLOv8l-Seg | 0.903 | 92.3 |
YOLOv8x-Seg | 0.907 | 143.9 |
learning rate | 0.01 |
batch size | 16 |
momentum | 0.937 |
weight decay | 0.0005 |
number of iterations | 300 epochs |
image size | 640 × 640 pixels |
Type | Canker | Immature | Crack | Ripe | Half-Ripe | Grey Mold | Late Blight | Rot | Young Fruit | Virus |
---|---|---|---|---|---|---|---|---|---|---|
precision (%) | 91.5 | 89.9 | 91.3 | 92.7 | 92.3 | 92.6 | 92.4 | 92.2 | 91.2 | 93 |
Method | Precision (%) | Recall (%) | F1 Score (%) | Segment mAP@0.5 | Inference Time (ms) |
---|---|---|---|---|---|
Mask RCNN | 89.8 | 85.5 | 87.6 | 0.915 | 90 |
YOLOv5s-Seg | 89.0 | 83.0 | 85.9 | 0.890 | 2.5 |
YOLOv7-Seg | 91.4 | 84.8 | 87.9 | 0.904 | 15.2 |
YOLOv8s-Seg | 90.3 | 85.4 | 87.7 | 0.898 | 3.1 |
Improved YOLOv8s-Seg(ours) | 91.9 | 85.8 | 88.7 | 0.922 | 3.5 |
Methods | Model Size | Δ% MB | GFLOPs | Δ% FLOPs | Parameters | Δ% Parameters | Inference Time (ms) |
---|---|---|---|---|---|---|---|
YOLOv8s-Seg | 20.4 | 42.5 | 11,783,470 | 3.1 | |||
Improved YOLOv8s-Seg | 21.1 | +0.7 | 47.2 | +4.7 | 10,400,750 | −1,382,720 | 3.5 |
Resolutions (Pixels) | Segment mAP@0.5 (%) | Inference Time (ms) |
---|---|---|
416 × 416 pixels | 91.1 | 0.9 |
640 × 640 pixels | 92.2 | 3.5 |
768 × 768 pixels | 92.4 | 7.9 |
1024 × 1024 pixels | 92.5 | 9.8 |
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
Yue, X.; Qi, K.; Na, X.; Zhang, Y.; Liu, Y.; Liu, C. Improved YOLOv8-Seg Network for Instance Segmentation of Healthy and Diseased Tomato Plants in the Growth Stage. Agriculture 2023, 13, 1643. https://doi.org/10.3390/agriculture13081643
Yue X, Qi K, Na X, Zhang Y, Liu Y, Liu C. Improved YOLOv8-Seg Network for Instance Segmentation of Healthy and Diseased Tomato Plants in the Growth Stage. Agriculture. 2023; 13(8):1643. https://doi.org/10.3390/agriculture13081643
Chicago/Turabian StyleYue, Xiang, Kai Qi, Xinyi Na, Yang Zhang, Yanhua Liu, and Cuihong Liu. 2023. "Improved YOLOv8-Seg Network for Instance Segmentation of Healthy and Diseased Tomato Plants in the Growth Stage" Agriculture 13, no. 8: 1643. https://doi.org/10.3390/agriculture13081643
APA StyleYue, X., Qi, K., Na, X., Zhang, Y., Liu, Y., & Liu, C. (2023). Improved YOLOv8-Seg Network for Instance Segmentation of Healthy and Diseased Tomato Plants in the Growth Stage. Agriculture, 13(8), 1643. https://doi.org/10.3390/agriculture13081643