Improved YOLOv7 based apple target detection in complex environment
Robotic harvesters face challenges in identifying apples under complex natural conditions such as unstable lighting,high fruit diversity,and severe leaf occlusion,which impedes the capture of key features,reducing harvesting efficiency and accuracy.An enhanced apple detection algorithm based on the YOLOv7 model for complex scenarios was proposed.A limited contrast adaptive histogram equalization technique was employed to enhance the contrast of apple images,reducing the background interference and clarifying the target contours.A multi-scale hybrid adaptive attention mechanism was introduced.The features were decomposed and reconstructed,and the spatial and channel attention directives were synergistically integrated to optimize multi-layer feature modeling over various distances,thereby boosting the model's capability to extract apple features and resist background noise.Full-dimensional dynamic convolution was implemented to refine the feature selection process through a meticulous attention mechanism.The number of detection heads was increased to address the challenges of detecting small targets.The Meta-ACON activation function was used to optimize the attention allocation during feature extraction process.Experimental results demonstrated that the improved YOLOv7 model,achieved average accuracy and recall rates of 85.7% and 87.0%,respectively.Compared to Faster R-CNN,SSD,YOLOv5,and the original YOLOv7,the average detection precision was improved by 15.2,7.5,4.5,and 2.5 percentage points,and the average recall was improved by 13.7,6.5,3.6,and 1.3 percentage points,respectively.The model exhibits exceptional performance,providing robust technical support for apple growth monitoring and mechanical harvesting research.
apple target detectionYOLOv7attention mechanismsmall target detectionactivation functionGrad-CAM