A YOLOv8n-T and ByteTrack-Based Dual-Area Tracking and Counting Method for Cucumber Flowers
Abstract
1. Introduction
- Collect cucumber flower images in complex greenhouse environments, create a dataset, and conduct visual analysis;
- Improve the YOLOv8n model to enhance the accuracy of the cucumber flower detection model and achieve model lightweighting in response to the complex greenhouse environment;
- Develop a dual-region counting algorithm and integrate it with the tracking and detection cascade framework to achieve dynamic detection of cucumber flowers.
2. Materials and Methods
2.1. Dataset Construction
2.2. Research Methodology
2.2.1. Model Optimization
2.2.2. ByteTrack Integration
2.2.3. Dual-Region Counting Framework
2.3. Evaluation Indicators
2.4. Experimental Configuration and Hyperparameters
3. Experiments and Analysis
3.1. Attention Mechanism Evaluation
3.2. Ablation Study
3.3. Comparative Analysis of Different Models
3.4. Test Set Comparison
3.5. Heatmap Analysis
3.6. Counting System Evaluation
4. Discussion
4.1. Impact of Front Lighting and Back Lighting on Detection
4.2. Detector Impact on Tracking Performance
4.3. Technical Advancements and Future Directions in Video-Based Crop Counting
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Zhang, S.; Tan, F.; Chung, C.; Slavkovic, F.; Devani, R.S.; Troadec, C.; Marcel, F.; Morin, H.; Camps, C.; Gomez Roldan, M.V.; et al. The control of carpel determinacy pathway leads to sex determination in cucurbits. Science 2022, 378, 543–549. [Google Scholar] [CrossRef] [PubMed]
- Chen, H.; Bai, Z.; Chu, Z.; Wen, Y. Study on the effect of the chiral herbicide imazethapyr on flowering initiation in Arabidopsis thaliana. Ecotoxicol. Environ. Saf. 2025, 293, 118049. [Google Scholar] [CrossRef] [PubMed]
- An, Q.; Cui, Y.; Tong, W.; Liu, Y.; Zhao, B.; Wei, L. StraTracker: A dynamic counting method for growing strawberries based on multi-target tracking. Comput. Electron. Agric. 2024, 227, 109564. [Google Scholar] [CrossRef]
- Thorp, K.R.; Dierig, D.A. Color image segmentation approach to monitor flowering in lesquerella. Ind. Crops Prod. 2011, 34, 1150–1159. [Google Scholar] [CrossRef]
- 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. 2019, 21, 387–402. [Google Scholar] [CrossRef]
- Xia, X.; Chai, X.; Li, Z.; Zhang, N.; Sun, T. MTYOLOX: Multi-transformers-enabled YOLO for tree-level apple inflorescences detection and density mapping. Comput. Electron. Agric. 2023, 209, 107803. [Google Scholar] [CrossRef]
- Li, G.; Suo, R.; Zhao, G.; Gao, C.; Fu, L.; Shi, F.; Dhupia, J.; Li, R.; Cui, Y. Real-time detection of kiwifruit flower and bud simultaneously in orchard using YOLOv4 for robotic pollination. Comput. Electron. Agric. 2022, 193, 106641. [Google Scholar] [CrossRef]
- Li, G.; Fu, L.; Gao, C.; Fang, W.; Zhao, G.; Shi, F.; Dhupia, J.; Zhao, K.; Li, R.; Cui, Y. Multi-class detection of kiwifruit flower and its distribution identification in orchard based on YOLOv5l and Euclidean distance. Comput. Electron. Agric. 2022, 201, 107342. [Google Scholar] [CrossRef]
- Wang, Z.; Yang, X. Moving Target Detection and Tracking Based on Pyramid Lucas-Kanade Optical Flow. In Proceedings of the 2018 IEEE 3rd International Conference on Image, Vision and Computing (ICIVC), Chongqing, China, 27–29 June 2018. [Google Scholar] [CrossRef]
- Singla, N. Motion Detection Based on Frame Difference Method. Int. J. Inf. Comput. Technol. 2014, 4, 1559–1565. [Google Scholar]
- 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 (ECCV), Tel Aviv, Israel, 23–27 October 2022. [Google Scholar] [CrossRef]
- Nir, A.; Orfaig, R.; Bobrovsky, B.-Z. Bot-sort: Robust associations multi-pedestrian tracking. arXiv 2022, arXiv:2206.14651. [Google Scholar] [CrossRef]
- Li, X.; Wang, X.; Ong, P.; Yi, Z.; Ding, L.; Han, C. Fast Recognition and Counting Method of Dragon Fruit Flowers and Fruits Based on Video Stream. Sensors 2023, 23, 8444. [Google Scholar] [CrossRef] [PubMed]
- Sekharamantry, P.K.; Melgani, F.; Malacarne, J.; Ricci, R.; de Almeida Silva, R.; Marcato Junior, J. A Seamless Deep Learning Approach for Apple Detection, Depth Estimation, and Tracking Using YOLO Models Enhanced by Multi-Head Attention Mechanism. Computers 2024, 13, 83. [Google Scholar] [CrossRef]
- Ye, X.; Pan, J.; Shao, F.; Liu, G.; Lin, J.; Xu, D.; Liu, J. Exploring the potential of visual tracking and counting for trees infected with pine wilt disease based on improved YOLOv5 and StrongSORT algorithm. Comput. Electron. Agric. 2024, 218, 108671. [Google Scholar] [CrossRef]
- 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. [Google Scholar] [CrossRef]
- Tu, S.; Huang, Y.; Huang, Q.; Liu, H.; Cai, Y.; Lei, H. Estimation of passion fruit yield based on YOLOv8n+OC-SORT+CRCM algorithm. Comput. Electron. Agric. 2025, 229, 109727. [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 (CVPR), Salt Lake City, UT, USA, 18–22 June 2018. [Google Scholar] [CrossRef]
- Xianghe, Z.; Chongyang, W.; Hongen, L.; Zhangwei, Y. Improved ResNet-50 model for identifying defects on wood surfaces. Signal Image Video Process. 2023, 17, 3119–3126. [Google Scholar] [CrossRef]
- Zhang, L.-Q.; Liu, Z.-T.; Jiang, C.-S. An Improved SimAM Based CNN for Facial Expression Recognition. In Proceedings of the 41th Chinese Control Conference (CCC), Hefei, China, 25–27 July 2022; pp. 582–586. [Google Scholar] [CrossRef]
- Qibin, H.; Daquan, Z.; Jiashi, F. Coordinate Attention for Efficient Mobile Network Design. In Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 13–19 June 2020. [Google Scholar] [CrossRef]
- Tong, Z.; Chen, Y.; Xu, Z.; Yu, R. Wise-IoU: Bounding Box Regression Loss with Dynamic Focusing Mechanism. arXiv 2023. [Google Scholar] [CrossRef]
- Han, K.; Wang, Y.; Tian, Q.; Guo, J.; Xu, C.; Xu, C. GhostNet: More Features From Cheap Operations. In Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 13–19 June 2020; pp. 1577–1586. [Google Scholar] [CrossRef]
- Jun, L.; Qiqin, C.; Fumin, Z.; Yintian, Z.; Lyuchao, L.; Guo, F. BiGA-YOLO: A Lightweight Object Detection Network Based on YOLOv5 for Autonomous Driving. Electronics 2023, 12, 2745. [Google Scholar] [CrossRef]
- Pan, L.; Duan, Y.; Zhang, Y.; Xie, B.; Rui, Z. A lightweight algorithm based on YOLOv5 for relative position detection of hydraulic support at coal mining faces. J. Real-Time Image Process. 2023, 20, 40. [Google Scholar] [CrossRef]
- Luo, W.; Xing, J.; Zhang, X.; Zhao, X.; Kim, T.K. Multiple Object Tracking: A Literature Review. Artif. Intell. 2021, 293, 103448. [Google Scholar] [CrossRef]
- Ultralytics. YOLOv8. 2023. Available online: https://github.com/ultralytics/ultralytics (accessed on 17 January 2024).
- Ballena-Ruiz, J.; Arcila-Diaz, J.; Tuesta-Monteza, V. Automated Detection and Counting of Gossypium barbadense Fruits in Peruvian Crops Using Convolutional Neural Networks. AgriEngineering 2025, 7, 152. [Google Scholar] [CrossRef]
- Wu, M.; Yuan, K.; Shui, Y.; Wang, Q.; Zhao, Z. A Lightweight Method for Ripeness Detection and Counting of Chinese Flowering Cabbage in the Natural Environment. Agronomy 2024, 14, 1835. [Google Scholar] [CrossRef]
- Cao, D.; Luo, W.; Tang, R.; Liu, Y.; Zhao, J.; Li, X.; Yuan, L. Research on Apple Detection and Tracking Count in Complex Scenes Based on the Improved YOLOv7-Tiny-PDE. Agriculture 2025, 15, 483. [Google Scholar] [CrossRef]
- Wang, A.; Xu, Y.; Hu, D.; Zhang, L.; Li, A.; Zhu, Q.; Liu, J. Tomato Yield Estimation Using an Improved Lightweight YOLO11n Network and an Optimized Region Tracking-Counting Method. Agriculture 2025, 15, 1353. [Google Scholar] [CrossRef]
Hardware | Configure | Environment | Version |
---|---|---|---|
System | Windows 10 | Python | 3.8.5 |
CPU | AMD Ryzen 7 5700X | PyTorch | 1.13.1 |
GPU | RTX3060 Ti | OpenCV-Python | 4.8.1 |
RAM | 16 G | CUDA | 11.8 |
MODEL | mAP (%) | F1 (%) | Parameters (106 M) | FLOPs (G) | Size (MB) |
---|---|---|---|---|---|
YOLOv8n | 83.9 | 79.5 | 3.0 | 8.1 | 5.96 |
+SE | 86.0 | 81.9 | 2.7 | 7.5 | 5.43 |
+CBAM | 86.0 | 81.0 | 2.7 | 7.5 | 5.45 |
+SimAM | 86.5 | 82.0 | 3.1 | 7.8 | 6.06 |
+CA | 86.9 | 82.1 | 2.7 | 7.5 | 5.45 |
MODEL | C | G | W | mAP (%) | F1 (%) | Parameters (106 M) | FLOPs (G) | Size (MB) |
---|---|---|---|---|---|---|---|---|
YOLOv8n | 83.9 | 79.5 | 3.0 | 8.1 | 5.96 | |||
IPV 1 | √ | × | × | 85.2 | 80.4 | 3.0 | 8.1 | 5.97 |
IPV 2 | × | √ | × | 86.1 | 81.5 | 2.7 | 7.5 | 5.43 |
IPV 3 | × | × | √ | 85.7 | 80.6 | 3.0 | 8.1 | 5.96 |
IPV 4 | × | √ | √ | 86.7 | 81.8 | 2.7 | 7.5 | 5.43 |
IPV 5 | √ | × | √ | 85.5 | 80.9 | 3.0 | 8.1 | 5.97 |
IPV 6 | √ | √ | × | 85.5 | 81.0 | 2.7 | 7.5 | 5.45 |
IPV 7 | √ | √ | √ | 86.9 | 82.1 | 2.7 | 7.5 | 5.45 |
MODEL | mAP (%) | F1 (%) | Parameters (106 M) | FLOPs (G) | Size (MB) |
---|---|---|---|---|---|
YOLOv3tiny | 84.5 | 80.5 | 8.7 | 13.0 | 17.40 |
YOLOv5n | 71.2 | 70.6 | 1.8 | 4.1 | 3.90 |
YOLOv7tiny | 86.9 | 81.3 | 6.0 | 13.2 | 12.30 |
YOLOv8n | 83.9 | 79.5 | 3.0 | 8.1 | 5.96 |
YOLOv10n | 82.0 | 77.2 | 2.7 | 6.7 | 5.80 |
YOLOv8n-T | 86.9 | 82.1 | 2.7 | 7.5 | 5.45 |
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. |
© 2025 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
Su, L.; Zhang, S.; Zhang, H.; Meng, X.; He, X. A YOLOv8n-T and ByteTrack-Based Dual-Area Tracking and Counting Method for Cucumber Flowers. Agronomy 2025, 15, 1744. https://doi.org/10.3390/agronomy15071744
Su L, Zhang S, Zhang H, Meng X, He X. A YOLOv8n-T and ByteTrack-Based Dual-Area Tracking and Counting Method for Cucumber Flowers. Agronomy. 2025; 15(7):1744. https://doi.org/10.3390/agronomy15071744
Chicago/Turabian StyleSu, Liyang, Shujuan Zhang, Hongtu Zhang, Xiangsen Meng, and Xiongkui He. 2025. "A YOLOv8n-T and ByteTrack-Based Dual-Area Tracking and Counting Method for Cucumber Flowers" Agronomy 15, no. 7: 1744. https://doi.org/10.3390/agronomy15071744
APA StyleSu, L., Zhang, S., Zhang, H., Meng, X., & He, X. (2025). A YOLOv8n-T and ByteTrack-Based Dual-Area Tracking and Counting Method for Cucumber Flowers. Agronomy, 15(7), 1744. https://doi.org/10.3390/agronomy15071744