Abstract:To address the critical challenges in surface character defect detection of consumer batteries, including dynamic defect localization, multi-scale adaptability, and fine-scale defect recognition, this paper proposes an innovative DDP-YOLOv8 framework. Firstly, to resolve the limitation of YOLOv8 in effectively adjusting feature map weights during feature extraction, we design a DCNv3-LKA attention module to achieve adaptive spatial weight adjustment through dynamic convolution and large-kernel attention fusion. Secondly, aiming to overcome the fixed sampling positions and poor multi-scale adaptability of YOLOv8’s neck network in character defect detection, we restructure the neck architecture by adopting a CCFM framework and propose a dynamic sampler (DS-CCFM module) incorporating dual-driven dynamic sampling mechanism. Finally, to mitigate the insufficient feature representation and information loss caused by standard convolution layers in YOLOv8’s detection head when handling small-scale battery characters, we introduce a P2 small-target detection layer and integrate multiple self-attention mechanisms from DynamicHead into the detection head (P2-DynamicHead module) to improves small defect recognition. Experimental results demonstrate that the DCNv3-LKA, DS-CCFM, and P2-DynamicHead modules achieve mean average precision (mAP) mAP@0.5 of 91.8%, 91.2%, and 92.4% respectively on the character defect dataset, representing improvements of 1.7%, 1.1%, and 2.3% over baseline YOLOv8n. DDP-YOLOv8 achieves a final mAP@0.5 of 94.0%, representing a 3.9% improvement over the baseline model YOLOv8n. With an FPS of 85.1, the model meets the requirements of high accuracy and real-time performance for character defect detection in large-scale customized battery production.