Chili Pepper Object Detection Method Based on Improved YOLOv8n
Abstract
:1. Introduction
2. Results and Analysis
2.1. Analysis of Comparative Results of YOLO-Series Algorithms
2.2. Performance of Improved YOLOv8
2.3. Ablation Experiments
2.4. Comparison of Other Backbone Network Replacements
2.5. C2f Optimization Results and Analysis
2.6. Model Visualization
3. Materials and Methods
3.1. Image Acquisition
3.2. Data Filtering and Image Annotation
3.3. Dataset Augmentation
3.4. Chili Pepper Object Detection Method
3.4.1. YOLOv8 Network Structure
3.4.2. Improved YOLOv8 Network
- (1)
- Improved HGNetV2 Model
- Stem layer: This is the initial preprocessing layer of the network, typically consisting of convolutional layers to start extracting features from the raw input data.
- HG block (hierarchical graph block): These blocks are the core components of the network, designed to process data hierarchically. Each HG block may handle data at different abstraction levels, allowing for the network to learn from low-level and high-level features.
- LDS (learnable downsampling) layer: These layers located between HG blocks may perform downsampling operations, reducing the spatial dimensions of the feature maps, decreasing computational load, and potentially increasing the receptive field of subsequent layers.
- GAP (global average pooling): Before final classification, the GAP layer reduces the spatial dimensions of the feature maps to a single vector per feature map, aiding in improving the network’s robustness to spatial transformations of input data.
- Final convolution and fully connected (FC) layers: These include a 1 × 1 convolutional layer to combine features and fully connected layers to map these features to the required number of output classes.
- (2)
- SEAM Attention Mechanism
- (3)
- Dilated Reparam Block
- (4)
- CARAFE
3.5. Training Environment and Evaluation Indicators
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Azlan, A.; Sultana, S.; Huei, C.; Razman, M. Antioxidant, anti-obesity, nutritional and other beneficial effects of different chili pepper: A review. Molecules 2022, 27, 898. [Google Scholar] [CrossRef] [PubMed]
- Saleh, B.; Omer, A.; Teweldemedhin, B. Medicinal uses and health benefits of chili pepper (Capsicum spp.): A review. MOJ Food Process Technol. 2018, 6, 325–328. [Google Scholar] [CrossRef]
- Zhang, D.; Sun, X.; Battino, M.; Wei, X.; Shi, J.; Zhao, L.; Liu, S.; Xiao, J.; Shi, B.; Zou, X. A comparative overview on chili pepper (capsicum genus) and sichuan pepper (zanthoxylum genus): From pungent spices to pharma-foods. Trends Food Sci. Technol. 2021, 117, 148–162. [Google Scholar] [CrossRef]
- Wei, T.; Liu, T.; Zhang, S.; Li, S.; Miao, H.; Liu, S. Recognition and Localization Method of Pepper-Picking Robot Based on Improved YOLOv5s. J. Yangzhou Univ. 2023, 26, 61–69. [Google Scholar] [CrossRef]
- Deng, C.; Zhong, Q.; Shao, D.; Ren, Y.; Li, Q.; Wen, J.; Li, J. Potential Suitable Habitats of Chili Pepper in China under Climate Change. Plants 2024, 13, 1027. [Google Scholar] [CrossRef] [PubMed]
- Zou, Z.; Zou, X. Geographical and ecological differences in pepper cultivation and consumption in China. Front. Nutr. 2021, 8, 718517. [Google Scholar] [CrossRef] [PubMed]
- Li, S. Research on Grading Dried Chili Based on Machine Vision. Ph.D. Thesis, Hebei Agricultural University, Baoding, China, 2019. [Google Scholar] [CrossRef]
- Hendrawan, Y.; Utami, R.; Nurseta, D.; Nuryani, S.; Maharani, D. Classification of total carotene and quality of chili pepper (Capsicum frutescens) based on image analysis. In Proceedings of the International Conference on Green Agro-industry and Bioeconom, Malang, Indonesia, 6–7 July 2021; IOP Conference Series: Earth and Environmental Science. IOP Publishing: Bristol, UK, 2021; Volume 733, p. 012005. [Google Scholar] [CrossRef]
- Azis, Y.; Khuriyati, N.; Suyantohadi, A. Classification of dried chilli quality using image processing. In Proceedings of the International Conference on Smart and Innovative Agriculture, Yogyakarta, Indonesia, 4–5 November 2020; IOP Conference Series: Earth and Environmental Science. IOP Publishing: Bristol, UK, 2021; Volume 686, p. 012058. [Google Scholar] [CrossRef]
- Sajjan, M.; Kulkarni, L.; Anami, B.; Gaddagimath, N. A comparative analysis of color features for classification of bulk chilli. In Proceedings of the 2016 2nd International Conference on Contemporary Computing and Informatics (IC3I), Greater Noida, India, 14–17 December 2016; IEEE: Piscataway, NJ, USA, 2016; pp. 427–432. [Google Scholar] [CrossRef]
- Misra, N.; Dixit, Y.; Al-Mallahi, A.; Bhullar, M.; Upadhyay, R.; Martynenko, A. IoT, big data, and artificial intelligence in agriculture and food industry. IEEE Internet Things J. 2020, 9, 6305–6324. [Google Scholar] [CrossRef]
- Kujawa, S.; Niedbała, G. Artificial neural networks in agriculture. Agriculture 2021, 11, 497. [Google Scholar] [CrossRef]
- Benos, L.; Tagarakis, A.; Dolias, G.; Berruto, R.; Kateris, D.; Bochtis, D. Machine learning in agriculture: A comprehensive updated review. Sensors 2021, 21, 3758. [Google Scholar] [CrossRef]
- Linaza, M.; Posada, J.; Bund, J.; Eisert, P.; Quartulli, M.; Döllner, J.; Pagani, A.; Olaizola, G.; Barriguinha, A.; Moysiadis, T.; et al. Data-driven artificial intelligence applications for sustainable precision agriculture. Agronomy 2021, 11, 1227. [Google Scholar] [CrossRef]
- Zhang, P.; Hu, Y.; Zhang, Y.; Zhang, C.; Chen, Z.; Chen, X. Research on peach tree yellow leaf disease recognition based on improved Faster-RCNN in a complex background. China Agric. Mech. J. 2024, 45, 219–225. [Google Scholar] [CrossRef]
- Liu, Y.; He, Y.; Wu, X.; Wang, W.; Zhang, L. Potato Sprouting and Surface Damage Detection Method Based on Improved Faster R-CNN. Trans. Chin. Soc. Agric. 2024, 55, 371–378. [Google Scholar] [CrossRef]
- Li, C.; Yang, K.; Shen, T.; Shang, Z. Apple Harvesting Visual Localization and Detection Method Based on Improved Faster R-CNN. Trans. Chin. Soc. Agric. 2024, 55, 47–54. [Google Scholar] [CrossRef]
- Xie, H.; Sun, Z.; Ding, Z.; Luo, M.; Li, Y. Single-tree Crown Extraction of Cryptomeria japonica Based on Mask R-CNN and Transfer Learning from UAV Remote Sensing Images. J. Beijing For. Univ. 2024, 46, 153–166. [Google Scholar] [CrossRef]
- Guan, Z. Research on Improved Mask R-CNN Based Cow Face Detection Algorithm. Ph.D. Thesis, Inner Mongolia University of Science and Technology, Baotou, China, 2023. [Google Scholar]
- Zhang, Z.; Luo, M.; Guo, S.; Liu, G.; Li, S. Cherry fruit detection method in natural environments based on improved YOLOv5. Trans. Chin. Soc. Agric. 2022, 53, 232–240. [Google Scholar]
- Liu, M.; Zhu, Z.; Cui, M.; Cui, M.; Yang, Q.; Wang, J. Red Ripeness Stage Strawberry Recognition and Peduncle Detection Based on Improved YOLO v8-Pose. Trans. Chin. Soc. Agric. 2023, 54, 244–251. [Google Scholar]
- Li, M.; Xiao, Y.; Zong, W.; Song, B. Detecting chestnuts using improved lightweight YOLOv8. Trans. Chin. Soc. Agric. Eng. 2024, 40, 201–209. [Google Scholar] [CrossRef]
- Liu, S.; Li, S.; Miao, H.; Chai, Y.; Chen, F. Research on Recognition and Localization of Pepper Harvesting Robots in Different Scenarios Based on YOLOv3. Agric. Mech. Res. 2024, 46, 38–43. [Google Scholar] [CrossRef]
- Wang, Y.; Wu, M.; Shen, Y. Identifying the Growth Status of Hydroponic Lettuce Based on YOLO-EfficientNet. Plants 2024, 13, 372. [Google Scholar] [CrossRef]
- Su, P.; Li, H.; Wang, X.; Wang, Q.; Hao, B.; Feng, M.; Sun, X.; Yang, Z.; Jing, B.; Wang, C. Improvement of the YOLOv5 Model in the Optimization of the Brown Spot Disease Recognition Algorithm of Kidney Bean. Plants 2023, 12, 3765. [Google Scholar] [CrossRef]
- Tsai, F.; Nguyen, V.; Duong, T.; Phan, Q.; Lien, C. Tomato Fruit Detection Using Modified Yolov5m Model with Convolutional Neural Networks. Plants 2023, 12, 3067. [Google Scholar] [CrossRef] [PubMed]
- Sun, Y.; Zhang, D.; Guo, X.; Yang, H. Lightweight Algorithm for Apple Detection Based on an Improved YOLOv5 Model. Plants 2023, 12, 3032. [Google Scholar] [CrossRef] [PubMed]
- Hussain, M. YOLO-v1 to YOLO-v8, the rise of YOLO and its complementary nature toward digital manufacturing and industrial defect detection. Machines 2023, 11, 677. [Google Scholar] [CrossRef]
- Lou, H.; Duan, X.; Guo, J.; Liu, H.; Gu, J.; Bi, L.; Chen, H. DC-YOLOv8: Small-size object detection algorithm based on camera sensor. Electronics 2023, 12, 2323. [Google Scholar] [CrossRef]
- Yang, G.; Wang, J.; Nie, Z.; Yang, H.; Yu, S. A lightweight YOLOv8 tomato detection algorithm combining feature enhancement and attention. Agronomy 2023, 13, 1824. [Google Scholar] [CrossRef]
- Zhao, Y.; Lv, W.; Xu, S.; Wei, J.; Wang, G.; Dang, Q.; Liu, Y.; Chen, J. Detrs beat yolos on real-time object detection. arXiv 2023, arXiv:2304.08069. [Google Scholar] [CrossRef]
- Yu, Z.; Huang, H.; Chen, W.; Su, Y.; Liu, Y.; Wang, X. Yolo-facev2: A scale and occlusion aware face detector. arXiv 2022, arXiv:2208.02019. [Google Scholar] [CrossRef]
- Ding, X.; Zhang, Y.; Ge, Y.; Zhao, S.; Song, L.; Yue, X.; Shan, Y. UniRepLKNet: A Universal Perception Large-Kernel ConvNet for Audio Video Point Cloud Time-Series and Image Recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 17–21 June 2024; pp. 5513–5524. [Google Scholar]
- Wang, J.; Chen, K.; Xu, R.; Liu, Z.; Chen, C.; Lin, D. Carafe: Content-aware reassembly of features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 3007–3016. [Google Scholar]
- Selvaraju, 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. [Google Scholar]
- Chen, Y.; Wu, X.; Zhang, Z.; Yan, J.; Zhang, F.; Yu, L. Method for identifying tea diseases in natural environment using improved YOLOv5s. Trans. Chin. Soc. Agric. Eng. 2023, 39, 185–194. [Google Scholar] [CrossRef]
- Li, P.; Zheng, J.; Li, P.; Long, H.; Li, M.; Gao, L. Tomato maturity detection and counting model based on MHSA-YOLOv8. Sensors 2023, 23, 6701. [Google Scholar] [CrossRef]
Model | P/% | R/% | F0.5-score/% | mAP0.5/% | mAP0.5:0.95/% | Model Size/MB | GFLOPs | Parameters /106 |
---|---|---|---|---|---|---|---|---|
YOLOv5n | 93.6 | 85.8 | 91.93 | 94 | 70.1 | 5.3 | 7.1 | 2.5 |
YOLOv6n | 95.9 | 88.3 | 94.28 | 94.9 | 74.1 | 8.7 | 11.8 | 4.2 |
YOLOv7-tiny | 90.5 | 82.2 | 88.71 | 89.6 | 57.7 | 12.2 | 13.2 | 6.0 |
YOLOv8n | 95.3 | 91.4 | 94.49 | 94.3 | 74.2 | 6.3 | 8.1 | 3.0 |
YOLOv9 | 94.9 | 89.8 | 93.83 | 95.3 | 72.1 | 51.6 | 102.3 | 25.3 |
YOLOv10 | 92.6 | 80.3 | 89.85 | 91 | 69 | 5.7 | 8.2 | 2.7 |
Faster R-CNN | 50.61 | 93.3 | 55.71 | 90.1 | 43.2 | 108 | 370.21 | 137 |
RT-DETR | 94.2 | 93.1 | 93.98 | 96.1 | 74.6 | 59.1 | 100.6 | 28.4 |
Model | P/% | R/% | F0.5-score/% | mAP0.5/% | mAP0.5:0.95/% | Model Size/MB | GFLOPs | Parameters/106 |
---|---|---|---|---|---|---|---|---|
Improved YOLOv8 | 97.8 | 91.5 | 96.47 | 96.3 | 79.4 | 4.6 | 5.8 | 2.1 |
YOLOv8 | 95.3 | 91.4 | 94.49 | 94.3 | 74.2 | 6.3 | 8.1 | 3.0 |
Experiment Number | Baseline | Improved HGNetV2 | SEAM | DRB | CARAFE | F0.5-score/% | mAP/% | mAP0.5:0.95/% | Parameters | Model Size/MB | GFLOPs |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | √ | × | × | × | × | 94.49 | 94.3 | 74.2 | 3,006,038 | 6.3 | 8.1 |
2 | √ | √ | × | × | × | 93.64 | 96.2 | 77.9 | 2,351,290 | 5 | 6.9 |
3 | √ | × | √ | × | × | 93.0 | 94.8 | 74.3 | 2,817,878 | 5.9 | 7.0 |
4 | √ | × | × | √ | × | 95.24 | 95.4 | 75.5 | 2,823,478 | 5.9 | 7.8 |
5 | √ | × | × | × | √ | 95.02 | 95.4 | 75.4 | 3,146,142 | 6.5 | 8.4 |
6 | √ | √ | √ | × | × | 95.46 | 96.7 | 79.6 | 2,163,130 | 4.7 | 5.8 |
7 | √ | √ | √ | √ | × | 96.34 | 96.3 | 78.3 | 1,980,570 | 4.3 | 5.5 |
8 | √ | √ | √ | √ | √ | 96.47 | 96.3 | 79.4 | 2,120,674 | 4.6 | 5.8 |
Backbone Network | P/% | R/% | mAP/% | Model Size/MB | GFLOPs | Parameters |
---|---|---|---|---|---|---|
EfficientViT | 96.5 | 91.9 | 96.3 | 8.8 | 9.4 | 4,008,662 |
Fasternet | 98.5 | 92.8 | 97.1 | 8.6 | 10.7 | 4,172,570 |
EfficientFormerV2 | 98.8 | 92.4 | 97.3 | 41.4 | 11.7 | 5,105,790 |
HGNetV2 | 97.6 | 91.1 | 96.5 | 5.0 | 6.9 | 2,351,290 |
Trial Number | Position in YOLOv8n | Replaced Module | P/% | R/% | F0.5-score/% | GFLOPs | Parameters |
---|---|---|---|---|---|---|---|
1 | 96.2 | 92.6 | 95.46 | 5.8 | 2,163,130 | ||
2 | 16 | C2f-DBB | 94.9 | 91.1 | 94.11 | 5.8 | 2,163,130 |
3 | 16 | C2f-ODConv | 97 | 91.1 | 95.76 | 5.6 | 2,173,214 |
4 | 16 | C2f-FasterBlock | 95.6 | 90.1 | 94.45 | 5.7 | 2,149,370 |
5 | 16 | C2f-DRB | 97.2 | 91.5 | 96.00 | 5.7 | 2,155,482 |
6 | 16/19 | C2f-DRB | 96.7 | 90.5 | 95.39 | 5.6 | 2,121,754 |
7 | 16/19/22 | C2f-DRB | 97.6 | 91.6 | 96.34 | 5.5 | 1,980,570 |
Data | Category | Training Set | Validation Set | Test Set | Total |
---|---|---|---|---|---|
Original dataset | Chili pepper image | 298 | 86 | 43 | 427 |
“pepper” label | 616 | 174 | 85 | 875 | |
Augmented dataset | Chili pepper image | 1494 | 427 | 214 | 2135 |
“pepper” label | 3050 | 884 | 441 | 4375 |
Training Parameters | Values |
---|---|
Initial learning rate | 0.01 |
Optimizer | SGD |
Optimizer momentum | 0.937 |
Optimizer weight decay rate | 0.0005 |
Number of image per batch | 16 |
Number of epochs | 200 |
Model. | F0.5-score/% | mAP0.5/% | mAP0.5:0.95/% | Model Size/MB | GFLOPs | Parameters |
---|---|---|---|---|---|---|
Upsample | 96.34 | 96.2 | 78.3 | 4.3 | 5.5 | 1,980,570 |
CARAFE | 96.47 | 96.3 | 79.4 | 4.6 | 5.8 | 2,120,674 |
DySample | 96.27 | 95.8 | 78.2 | 4.3 | 5.5 | 1,992,922 |
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
Ma, N.; Wu, Y.; Bo, Y.; Yan, H. Chili Pepper Object Detection Method Based on Improved YOLOv8n. Plants 2024, 13, 2402. https://doi.org/10.3390/plants13172402
Ma N, Wu Y, Bo Y, Yan H. Chili Pepper Object Detection Method Based on Improved YOLOv8n. Plants. 2024; 13(17):2402. https://doi.org/10.3390/plants13172402
Chicago/Turabian StyleMa, Na, Yulong Wu, Yifan Bo, and Hongwen Yan. 2024. "Chili Pepper Object Detection Method Based on Improved YOLOv8n" Plants 13, no. 17: 2402. https://doi.org/10.3390/plants13172402
APA StyleMa, N., Wu, Y., Bo, Y., & Yan, H. (2024). Chili Pepper Object Detection Method Based on Improved YOLOv8n. Plants, 13(17), 2402. https://doi.org/10.3390/plants13172402