Acta Agriculturae Zhejiangensis ›› 2026, Vol. 38 ›› Issue (2): 383-396.DOI: 10.3969/j.issn.1004-1524.20250100

• Biosystems Engineering • Previous Articles     Next Articles

Lightweight and improved apple orchard fruit recognition model CS_YOLOv7

OUYANG Yu(), LIU Shuo(), LI Mengmin, ZHANG Peng   

  1. School of Mathematics & Computer Science, Wuhan Polytechnic University, Wuhan 430048, China
  • Received:2025-02-10 Online:2026-02-25 Published:2026-03-24

Abstract:

Aiming at the problems faced by current fruit recognition in apple orchards, such as excessive model parameter scale, high computational resource consumption, and difficulty in achieving a good balance between model detection accuracy and speed, a lightweight improved model CS_YOLOv7 based on YOLOv7 was proposed. Firstly, the channel-split efficient layer aggregation network (CS_ELAN) and the spatial pyramid pooling fast (SPPF) module were introduced into the model to achieve overall lightweighting of the model. Secondly, the K-means++algorithm was adopted to generate new anchor boxes suitable for the dataset in this study, so as to enhance the model’s target localization capability. Thirdly, the Wise-IoU loss function was used to replace the original loss function, which reduced the harmful gradients of low-quality samples and improved the model convergence speed and target recognition localization accuracy. Finally, an attention mechanism SE_CBAM based on spatial and channel dimensions was added to enable the model to extract key features of small apple targets from a more global perspective. The results showed that, compared with the original YOLOv7 model, the improved model achieved a 1.7 percentage points increase in the mean average precision under the intersection over union of 0.5 (mAP@0.5), a reduction of 22.3 MB in model size, and an improvement of 118.9 frames·s-1 in detection speed. Meanwhile, the number of model parameters and computational complexity decreased by 31.8% and 16.1%, respectively. The CS_YOLOv7 model achieves multi-dimensional lightweighting while optimizing accuracy, which can be applied to the rapid recognition of young fruits in orchard datasets, and lays a foundation for efficient real-time target recognition and subsequent robotic picking in the future.

Key words: apple orchard, fruit recognition, machine vision, model optimization

CLC Number: