A lightweight deep learning model for real-time rectangle NdFeB surface defect detection with high accuracy on a global scale
摘要
To solve the problem that it is difficult to detect dynamic tiny square neodymium-iron-boron (NdFeB) surface defects in the case of limited computing resources, this paper proposes a square NdFeB magnet surface defect detection method based on the YOLO (YOLOv8-FCW) lightweight network. Initially, the lightweight global adaptive feature enhancement module (DFNet) network is used as the backbone feature extraction net-work. By customizing the depth of the feature matrix and reducing unnecessary branch structures, the model complexity is reduced while enhancing the network’s ability to extract multi-scale feature information. Subsequently, the deformable convolution module (DCNv3) is utilized to acquire twice downsampling feature maps without information loss, aiming to expand the receptive field for small-sized defects. Finally, to further improve detection accuracy, the Wise-IOU (WIOU) v3 bounding box loss function is introduced to focus on the samples that are difficult to identify and reduce the gradient penalty for low-quality samples. The experimental results show that the YOLOv8-FCW algorithm achieves a mean Average Precision (mAP@0.5) of 78.6% on the rectangle NdFeB magnet dataset, with a model parameter quantity and computational cost reduction of 33.2% and 24.7%, respectively compared with the baseline, and requires less computational resources for higher detection accuracy compared to other mainstream object detection algorithms. Finally, the model was deployed to industrial Automated Optical Inspection (AOI) devices using TensorRT. This deployment reduced the inference time for a single image to 2.7 ms and increased speed by 6.6 times, enabling dynamic micro-detection of surface defects in square NdFeB.