Optimization hyperparameters of YOLO using the coati algorithm for detecting and counting unripe citrus fruits
Keywords:
unripe citrus fruit, target detection, YOLO, hyperparameter optimization, multi-objective trackingAbstract
Real-time inspection of citrus orchards can provide reliable support for production management processes, such as fruit thinning and setting, sunburn prevention and control, and yield prediction. To address problems such as the difficulty of identifying unripe citrus fruits in a natural environment and the high labor cost of counting, this study proposes an unripe citrus fruit detection, tracking, and counting algorithm based on YOLOv7-tiny-Convolutional Block Attention Module-Wise IoU (YOLO-CW) combined with StrongSORT. First, to improve the feature extraction ability of the model for unripe citrus fruits in small targets and complex backgrounds, this study employed YOLOv7-tiny as the baseline model. The Convolutional Block Attention Module (CBAM) was integrated into the ELAN-T module ahead of the P3 detection head in YOLOv7-tiny and redesigned as the ELAN-TC module. Second, the loss function CIoU in YOLOv7-tiny was replaced with Wise IoUv3 to improve the model’s ability to detect overlapping unripe citrus fruits in complex backgrounds, thereby reducing the impact of harmful gradients produced by low-quality unripe citrus fruit samples. Third, to address the challenge of hyperparameter optimization that relies on experience and manpower, this study employed the Coati Optimization Algorithm (COA) to optimize the hyperparameters of the model, further enhancing detection accuracy. Finally, the YOLO-CW model was ported to an edge computing platform, enabling real-time data collection of unripe citrus fruits using multiple wireless IP cameras. The collected data were tracked and counted using StrongSORT. The experimental results demonstrate that the Precision and mAP@0.5 of the YOLO-CW model optimized by COA were 93.80% and 96.62%, respectively. Compared to the baseline model YOLOv7-tiny, the YOLO-CW model exhibited improvements of 1.68% in Precision and 0.71% in mAP@0.5. The YOLO-CW model’s Computation and Parameters were 13.2 GFlops and 6.01×106, respectively. Compared to the baseline model YOLOv7-tiny is reduced by 5.03% and 3.53%. An edge computing platform and a dual-channel wireless IP camera were used for image acquisition and processing to evaluate the performance of the proposed YOLO-CW model in tracking and counting unripe citrus fruits. The results indicate that the average frame rate was 23 FPS and the overall system power consumption was 17.11 W. Compared to the baseline model YOLOv7-tiny has 10% increase in average frame rate and 7.62% reduction in power consumption. These findings indicate that the proposed model can track and count unripe citrus fruits in real time in natural environments, providing valuable theoretical support for citrus yield assessment.
Key words: unripe citrus fruit; target detection; YOLO; hyperparameter optimization; multi-objective tracking
DOI: 10.25165/j.ijabe.20261904.9599
Citation: Lyu S, Chen Y C, Gao P, Liu X Y, Li Z, Chen J Y, et al. Optimization hyperparameters of YOLO using the coati
algorithm for detecting and counting unripe citrus fruits. Int J Agric & Biol Eng, 2026; 19(4): 268–281.
References
[1] Luo X W, Liao J, Zang Y, Ou Y G, Wang P. Developing from mechanized to smart agricultural production in China. Chinese Journal of Chemical Engineering, 2022; 24(1): 46–54. (in Chinese) DOI: 10.15302/J-SSCAE-2022.01.005
[2] Yang T, Sun F C, Huang B, Wu B Q, Ran G Z. Research progress on key technologies of orchard operating platform. Journal of Chinese Agricultural Mechanization, 2024; 45(1): 152–159. (in Chinese) DOI: 10.13733/j.jcam.issn.2095-5553.2024.01.022
[3] Gan H, Lee W S, Alchanatis V, Ehsani R, Schueller J K. Immature green citrus fruit detection using color and thermal images. Computers & Electronics in Agriculture, 2018; 152: 117–125.
[4] Wu D H, Lyv S C, Jiang M, Song H B. Using channel pruning-based YOLO v4 deep learning algorithm for the real-time and accurate detection of apple flowers in natural environments. Computers & Electronics in Agriculture, 2020; 178: 105742.
[5] Song H B, Shang Y Y, He D J. Review on deep learning technology for fruit target recognition. Transactions of the CSAM, 2023; 54(1): 1–19. (in Chinese) DOI: 10.6041/j.issn.1000-1298.2023.01.001
[6] Qiu C, Tian G Z, Zhao J W, Liu Q, Xie S J, Zheng K. Grape maturity detection and visual pre-positioning based on improved YOLOv4. Electronics, 2022; 11(17): 2677.
[7] Li P, Zheng J S, Li P Y, Long H W, Li M, Gao L H. Tomato maturity detection and counting model based on MHSA-YOLOv8. Sensors, 2023; 23(15): 6701.
[8] Yang S Z, Wang W, Gao S, Deng Z P. Strawberry ripeness detection based on YOLOv8 algorithm fused with LW-Swin Transformer. Computers & Electronics in Agriculture, 2023; 215: 108360.
[9] Chen F J, Chen C, Zhu X Y, Shen D Y, Zhang X W. Detection of Camellia oleifera fruit maturity based on improved YOLOv7. Transactions of the CSAE, 2024; 40(5): 177–186. (in Chinese) http://dx. doi.org/10.11975/j.issn.1002-6819.202311030
[10] Wang Z F, Zhang Z H, Lu Y Q, Luo R, Niu Y, Yang X B, et al. SE-COTR: A novel fruit segmentation model for green apples application in complex orchard. Plant Phenomics, 2022; 2022: 0005.
[11] Ren R, Sun H X, Zhang S J, Wang N, Lu X Y, Jing J P, et al. Intelligent detection of lightweight “Yuluxiang” pear in non-structural environment based on YOLO-GEW. Agronomy, 2023; 13(9): 2418.
[12] Zhang B, Xia Y Y, Wang R R, Yong W, Yin C H, Fu M, et al. Recognition of mango and location of picking point on stem based on a multi-task CNN model named YOLOMS. Precision Agriculture, 2024; 25: 1454–1476.
[13] Yue K, Zhang P C, Wang L, Guo Z M, Zhang J J. Recognizing citrus in complex environment using improved YOLOv8n. Transactions of the CSAE, 2024; 40(8): 152–158. (in Chinese) DOI: 10.11975/j.issn.1002-6819.202401118
[14] Zhang W L, Wang J Q, Liu Y X, Chen K Z, Li H B, Duan Y L, et al. Deep-learning-based in-field citrus fruit detection and tracking. Horticulture Research, 2022; 9: uhac003.
[15] Tu S Q, Huang Y F, Liang Y, Liu H X, Cai Y F, Lei H. A passion fruit counting method based on the lightweight YOLOv5s and improved DeepSORT. Precision Agriculture, 2024; 25: 1731–1750.
[16] Shi R, Li T X, Yasushi Y. An attribution-based pruning method for real-time mango detection with YOLO network. Computers & Electronics in Agriculture, 2020; 169: 105214.
[17] Huang H Q, Huang T B, Li Z, Lyu S L, Hong T. Design of citrus fruit detection system based on mobile platform and edge computer device. Sensors, 2022; 22(1): 59.
[18] Lyu S L, Li R Y, Zhao Y W, Li Z, Fan R J, Liu S Y. Green citrus detection and counting in orchards based on YOLOv5-CS and AI edge system. Sensors, 2022; 22(2): 576.
[19] Liu Y, Zheng H T, Zhang Y H, Zhang Q J, Chen H L, Xu X Y, et al. “Is this blueberry ripe?”: a blueberry ripeness detection algorithm for use on picking robots. Frontiers in Plant Science, 2023; 14: 1198650.
[20] Zhao Z Q, Wang J, Zhao H. Research on apple recognition algorithm in complex orchard environment based on deep learning. Sensors, 2023; 23(12): 5425.
[21] Zhong Z Y, Yun L J, Cheng F Y, Chen Z Q, Zhang C J. Light-YOLO: A lightweight and efficient YOLO-based deep learning model for mango detection. Agriculture, 2024; 14(1): 140.
[22] Kim Y, Chung M. An approach to hyperparameter optimization for the objective function in machine learning. Electronics, 2019; 8(11): 1267.
[23] Li Y, Abdallah S. On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing, 2020; 415: 295–316.
[24] Yu C H, Liu Y K, Zhang W R, Zhang X, Zhang Y H, Jiang X. Foreign objects identification of transmission line based on improved YOLOv7. IEEE Access, 2023; 11: 51997–52008.
[25] Lyu S L, Zhou X, Li Z, Liu X Y, Chen Y C, Zeng W B. YOLO-SCL: a lightweight detection model for citrus psyllid based on spatial channel interaction. Frontiers in Plant Science, 2023; 14: 1276833.
[26] Stefano F S, Laio O S, Anne C R K, Raúl G O, Valderi R Q L. Hypertuned-YOLO for interpretable distribution power grid fault location based on EigenCAM. Ain Shams Engineering Journal, 2024; 15: 102722.
[27] Wang C Y, Bochkovskiy A, Liao H M. YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022; pp.7464-7475. DOI: 10.48550/arXiv.2207.02696
[28] Woo S, Park J, Lee J, Kweon I. CBAM: Convolutional block attention module. 2018; arXiv preprint arXiv: 1807.06521. DOI: 10.48550/arXiv.1807.06521
[29] Zheng Z H, Wang P, Liu W, Li J Z, Ye R G, Ren D W. Distance-IoU loss: Faster and better learning for bounding box regression. AAAI Conference on Artificial Intelligence, 2020; 34(7): 12993–13000.
[30] Tong Z J, Chen Y H, Xu Z W, Yu R. Wise-IoU: Bounding box regression loss with dynamic focusing mechanism. 2023; arXiv preprint arXiv: 2301.10051. DOI: 10.48550/arXiv.2301.10051.
[31] Mohammad D, Zeinab M, Eva T, Pavel T. Coati optimization algorithm: A new bio-inspired metaheuristic algorithm for solving optimization problems. Knowledge-Based Systems, 2023; 259: 110011.
[32] Wang C, Yeh I, Liao H. You only learn one representation: Unified network for multiple tasks. Journal of Information Science and Engineering, 2021; 39: 691–709.
[33] Wang C, Yeh I, Liao H. YOLOv9: Learning what you want to learn using programmable gradient information. 2024; arXiv preprint arXiv: 2402.13616. DOI: 10.48550/arXiv.2402.13616.
[34] Wang A, Chen H, Liu L H, Chen K, Lin Z J, Han J G, et al. YOLOv10: Real-time end-to-end object detection. 2024; arXiv preprint arXiv: 2405.14458. DOI: 10.48550/arXiv.2405.14458.
[35] Rahima K, Muhammad H. YOLOv11: An overview of the key architectural enhancements. 2024; arXiv preprint arXiv: 2410.17725. DOI: 10.48550/arXiv.2410.17725.
[36] Tian Y J, Ye Q X, David D. YOLOv12: Attention-centric real-time object detectors. 2025; arXiv preprint arXiv: 2502.12524. DOI: 10.48550/arXiv.2502.12524.
[37] Lei M Q, Li S Q, Wu Y H, Hu H, Zhou Y, Zheng X H, et al. YOLOv13: Real-time object detection with hypergraph-enhanced adaptive visual perception. 2025; arXiv preprint arXiv: 2506.17733. DOI: 10.48550/arXiv.2506.17733.
[38] Bewley A, Ge Z, Ott L, Ramos F, Upcroft B. Simple online and realtime tracking. IEEE International Conference on Image Processing (ICIP), 2016; pp.3464-3468. DOI: 10.1109/ICIP.2016.7533003
[39] Du Y H, Zhao Z C, Song Y, Zhao Y Y, Su F, Gong T, et al. StrongSORT: Make DeepSORT great again. IEEE Transactions on Multimedia, 2022; 25: 8725–8737.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 International Journal of Agricultural and Biological Engineering

This work is licensed under a Creative Commons Attribution 4.0 International License.
IJABE is an international peer reviewed, open access journal, adopting Creative Commons Copyright Notices as follows.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).