YOLOv8n-CA: Improved YOLOv8n Model for Tomato Fruit Recognition at Different Stages of Ripeness - Xin Gao; Jieyuan Ding; Ruihong Zhang; Xiaobo Xi (Agronomy)
This study addresses the challenges of tomato maturity recognition in natural environments, such as occlusion caused by branches and leaves, and the difficulty in detecting stacked fruits. To overcome these issues, we propose a novel YOLOv8n-CA method for tomato maturity recognition, which defines four maturity stages: unripe, turning color, turning ripe, and fully ripe. The model is based on the YOLOv8n architecture, incorporating the coordinate attention (CA) mechanism into the backbone network to enhance the model’s ability to capture and express features of the tomato fruits. Additionally, the C2f-FN structure was utilized in both the backbone and neck networks to strengthen the model’s capacity to extract maturity-related features. The CARAFE up-sampling operator was integrated to expand the receptive field for improved feature fusion. Finally, the SIoU loss function was used to solve the problem of insufficient CIoU of the original loss function. Experimental results showed that the YOLOv8n-CA model had a parameter count of only 2.45 × 106, computational complexity of 6.9 GFLOPs, and a weight file size of just 4.90 MB. The model achieved a mean average precision (mAP) of 97.3%. Compared to the YOLOv8n model, it reduced the model size slightly while improving accuracy by 1.3 percentage points. When compared to seven other models—Faster R-CNN, YOLOv3s, YOLOv5s, YOLOv5m, YOLOv7, YOLOv8n, YOLOv10s, and YOLOv11n—the YOLOv8n-CA model was the smallest in size and demonstrated superior detection performance.