DOI: 10.3390/horticulturae12101199 ISSN: 2311-7524

Simultaneous Maturity Recognition and Yield Counting of Truss and Individual Tomatoes Using Improved YOLOv8-EME and Optimized ByteTrack Tracker

Liying Shi, Sen Lin, Haihang Zhao, Tianlong Sun, Dongdong Sun, Yuchen Yang

Crop maturity detection and yield estimation are critical components of protected agriculture, supporting optimized harvest timing, fruit quality control, and coordination of production and marketing. Existing studies on detection and counting predominantly address a single category—either truss or individual fruits. To advance automation and intelligence in production management, this study proposes a tomato detection and counting system that integrates an improved YOLOv8-EME model with the ByteTrack algorithm, enabling simultaneous detection and counting of truss and individual fruits with maturity classification. The improved YOLOv8-EME model combines the EfficientNet architecture with the EffectiveSE attention mechanism, improving feature extraction and computational efficiency. In addition, the optimized network structure yields a lightweight design, reducing FLOPs to 6.9 G. The model attains a mean Average Precision (mAP) of 0.942, 0.883, 0.850, and 0.956 for the Ripe, Raw, Medium-Raw, and Truss categories, respectively. A proposed cross-line counting method integrated with an improved ByteTrack algorithm mitigates target loss, ID drift, and duplicate counting through ID drift association, trajectory fusion, historical trajectory cues, and a cooldown scheme. These designs significantly improve detection and counting accuracy for truss and fruit maturity, achieving a counting accuracy of 94%. The system offers efficient and accurate technical support for tomato detection and counting in smart agriculture.