Context-guided and multi-level feature fusion DETR for lightweight detection of cacao pod pests and diseases in complex environments
摘要
Cocoa, as an important economic crop, often faces serious threats from pests and diseases. In natural environments, image-based detection methods must overcome challenges such as uneven lighting, occlusion, and fruit overlap, while simultaneously maintaining detection accuracy, processing speed, and low hardware resource consumption. To address these challenges, this study proposes a lightweight network model named Context-Guided and Multi-Level Feature Fusion DETR (CGM-DETR), based on the Real-Time Detection Transformer (RT-DETR). First, a module integrating contextual guidance and residual structures enhances feature extraction capabilities, enabling better identification of partially occluded targets. Second, online re-parameterization techniques are employed to optimize the existing model structure, accelerating training convergence and reducing computational burden without sacrificing performance. Finally, a dynamic feature fusion module is designed to effectively combine high-level semantic information with low-level detailed features, improving the model’s adaptability to complex environments and image details. We evaluated our model on a field dataset of cocoa pests and diseases containing 3,960 images, selecting RT-DETR as the baseline model for performance comparison. Experimental results show that the proposed CGM-DETR model achieves improvements of 1.9% in mAP50, 2.4% in mAP50:95, and 1.5% in recall rate compared to the baseline RT-DETR model. Additionally, the model reduces the number of parameters, GFLOPs, and model size by 33.9%, 40.0%, and 27.7%, respectively. Robustness experiments further validated that the model outperforms other mainstream models in anti-interference capability. These results demonstrate that the proposed model achieves a good balance between detection accuracy and model size, providing a viable technical solution for intelligent cocoa cultivation management.