Abstract:The rapid and accurate detection of surface defects in materials has become an important objective across various research domains. To enhance detection efficiency and realize lightweight equipment,this paper proposes a target detection optimization algorithm based on YOLOv5, adding DyHead detection head to enhance the detection accuracy of the model by fusing multiple attention mechanisms; replacing the aLRPLoss loss function to reduce the hyperparameter adjustment work and optimize the training process; propose C3-Faster based on FasterNet to replace the C3 module in the network to improve the model detection performance and reduce the model size with the idea of PConv; finally add the lightweight upsampling operator CARAFE to expand the model perceptual field and improve the detection effect on targets of different sizes. The experimental results show that the improved YOLOv5 model improves the overall average accuracy by 4.174%, reduces the parameter volume by 11.25%, reduces the computational complexity by 13.75%, and reduces the weight volume by 10.72% on the steel surface defect dataset compared with the original model, and the detection performance is also higher than that of SSD, RetinaNet, FCOS, YOLOv3, and YOLOv4 and other mainstream target detection algorithms, which have high application value in industrial detection.