Online available: 2025-03-24
Objective In modern agriculture, the rapid and accurate detection of chillies at different maturity stages is a critical step for determining the optimal harvesting time and achieving intelligent sorting of field-grown chillies. However, existing target detection models face challenges in efficiency and accuracy when applied to the task of detecting chilli maturity, which limits their widespread use and effectiveness in practical applications. To address these challenges, a new algorithm, Chilli-YOLO, was proposed for achieving efficient and precise detection of chilli maturity in complex environments. Methods This research focused on field-grown chillis cultivated at the national precision agriculture base in Changping district, Beijing, China. A comprehensive image dataset was collected, capturing chillis under diverse and realistic agricultural conditions, including varying lighting conditions, camera angles, and background complexities. These images were then meticulously categorized into four distinct maturity stages: Immature, transitional, mature, and dried. To ensure data quality and robustness, the initial image pool underwent a rigorous process of manual screening, followed by precise annotation using bounding boxes to delineate individual chillis. Furthermore, data augmentation techniques were employed to expand the dataset and enhance the model's generalization capabilities. To develop an accurate and efficient chili maturity detection system, the YOLOv10s object detection network was chosen as the foundational architecture. The model's performance was further enhanced through strategic optimizations targeting the backbone network. Specifically, standard convolutional layers were replaced with Ghost convolutions. This technique generated more feature maps from fewer parameters, resulting in significant computational savings and improved processing speed without compromising feature extraction quality. Additionally, the C2f module was substituted with the more computationally efficient GhostConv module, further reducing redundancy and enhancing the model's overall efficiency. To improve the model's ability to discern subtle visual cues indicative of maturity, particularly in challenging scenarios involving occlusion, uneven lighting, or complex backgrounds, the Partial Self-Attention (PSA) module within YOLOv10s was replaced with the Second-Order Channel Attention (SOCA) mechanism. SOCA leverages higher-order feature correlations to more effectively capture fine-grained characteristics of the chillis. This enabled the model to focus on relevant feature channels and effectively identify subtle maturity-related features, even when faced with significant visual noise and interference. Finally, to refine the precision of target localization and minimize bounding box errors, the Extended Intersection over Union (XIoU) loss function was integrated into the model training process. XIoU enhances the traditional IoU loss by considering factors such as the aspect ratio difference and the normalized distance between the predicted and ground truth bounding boxes. By optimizing for these factors, the model achieved significantly improved localization accuracy, resulting in a more precise delineation of chillis in the images and contributing to the overall enhancement of the detection performance. The combined implementation of these improvements aimed to construct an effective approach to correctly classify the maturity level of chillis within the challenging and complex environment of a real-world farm. Results and Discussion The experimental results on the custom-built chilli maturity detection dataset showed that the Chilli-YOLO model performed excellently across multiple evaluation metrics. The model achieved an accuracy of 90.7%, a recall rate of 82.4%, and a mean average precision (mAP) of 88.9%. Additionally, the model's computational load, parameter count, model size, and inference time were 18.3 GFLOPs, 6.37 M, 12.6 M, and 7.3 ms, respectively. Compared to the baseline model, Chilli-YOLO improved accuracy by 2.6 percent point, recall by 2.8 percent point and mAP by 2.8 percent point. At the same time, the model's computational load decreased by 6.2 GFLOPs, the parameter count decreased by 1.67 M, model size reduced by 3.9 M. These results indicated that Chilli-YOLO strikes a good balance between accuracy and efficiency, making it capable of fast and precise detection of chilli maturity in complex agricultural environments. Moreover, compared to earlier versions of the YOLO model, Chilli-YOLO showed improvements in accuracy of 2.7, 4.8, and 5 percent point over YOLOv5s, YOLOv8n, and YOLOv9s, respectively. Recall rates were higher by 1.1, 0.3, and 2.3 percent point, and mAP increased by 1.2, 1.7, and 2.3 percent point, respectively. In terms of parameter count, model size, and inference time, Chilli-YOLO outperformed YOLOv5. This avoided the issue of YOLOv8n's lower accuracy, which was unable to meet the precise detection needs of complex outdoor environments. When compared to the traditional two-stage network Faster RCNN, Chilli-YOLO showed significant improvements across all evaluation metrics. Additionally, compared to the one-stage network SSD, Chilli-YOLO achieved substantial gains in accuracy, recall, and mAP, with increases of 16.6%, 12.1%, and 16.8%, respectively. Chilli-YOLO also demonstrated remarkable improvements in memory usage, model size, and inference time. These results highlighted the superior overall performance of the Chilli-YOLO model in terms of both memory consumption and detection accuracy, confirming its advantages for chilli maturity detection. Conclusion The proposed Chilli-YOLO model optimizes the network structure and loss functions, not only significantly improving detection accuracy but also effectively reducing computational overhead, making it better suited for resource-constrained agricultural production environments. This model provides a reliable technical reference for intelligent harvesting of chillies in agricultural production environments, especially in resource-constrained settings. By improving both performance and efficiency, Chilli-YOLO represents a significant step forward in the field of agricultural automation and precision farming.