Abstract:Deep learning methods are widely applied in agricultural vision tasks. Determining harvesting parameters is a primary task for the mechanized harvesting of Camellia oleifera fruits, and automated fruit detection and object counting based on deep learning are crucial for accurately setting these parameters. However, factors such as occlusion and illumination variations in complex orchard environments directly affect the efficiency and accuracy of detection methods. An efficient, lightweight model named YOLO-LGC was proposed based on YOLO 11n, aiming to enhance target detection accuracy and spatial localization capability in complex orchard environments. Firstly, the LNN ghost dynamic convolution (LGC) module was introduced into the backbone network to optimize feature extraction through adaptive kernel selection, thereby improving detection accuracy in complex environments. Secondly, the programmable gradient information (PGI) mechanism was adopted to dynamically adjust gradient propagation, addressing feature conflicts caused by occlusion and illumination changes. Finally, the Dynamic UpSample module was integrated, guided by PGI, to enhance feature retention and improve spatial localization accuracy. Combined axis-aligned bounding boxes (AABB), an inertial measurement unit (IMU), and Kalman filtering to visualize the spatial distribution of Camellia oleifera fruits at heights of 0~1.5m, 1.5~1.8m, and above 1.8m. By analyzing the spatial relationships of the fruits, more accurate positional information was provided. Experimental results showed that compared with YOLO 11n, YOLO-LGC improved detection precision from 82.0% to 83.0%, recall from 76.4% to 78.0%, mAP@0.5 from 85.1% to 87.6%, and FPS from 229.8f/s to 299.7f/s, with computational complexity slightly increased to 6.7×109. While maintaining the advantage of high inference speed, YOLO-LGC enhances detection performance, outperforming existing mainstream detection methods. The spatial distribution error rate was less than 5%, meeting practical detection requirements. The findings can provide a basis for matching mechanized harvesting parameters for Camellia oleifera fruits.