Research on surface defect detectionbased on improved YOLOv7
In industrial production processes,surface defects often occur on products,which can affect their aesthetics,com-fort,and performance.Therefore,the key to addressing the low detection accuracy of traditional surface defect detection methods lies in defect detection.To address this issue,an improved surface defect detection algorithm based on YOLOv7 is proposed.The main network is enhanced using DCNv2,which introduces deformable convolutions in the convolution process.This allows for dynamic adjustment of the receptive field when capturing features,better adapting to irregularly shaped defects,and improving detection accuracy and robustness.By introducing polarized self-attention mechanism,long-range dependencies between features can be better captured,enhancing the focus and utilization of important features,thereby improving detection accuracy and robust-ness.Furthermore,optimizing the original loss function using normalized Wasserstein distance enables better handling of the prob-lem of uneven class distribution and balancing the weights between different classes during the training process,thereby improving the model's detection performance for various defect types.Experimental results demonstrate that the improved model achieves higher performance and reliability,enabling defect detection in industrial production processes with higher accuracy.Based on experiments,it achieves an accuracy of 70.4%on the GC10-DET dataset,outperforming other existing models.