Abstract:The quality of steel surface defect inspection directly affects industrial production safety and machine performance. However, in real factories, steel quality control is limited by equipment conditions, making it challenging to achieve high-precision and real-time inspection. To solve this problem, a lightweight YOLOv8n detection algorithm with multi-scale fusion is proposed. Firstly, a lightweight multi-scale fusion backbone network (RepHGnetv2) is introduced, combining HGnetv2 and RepConv to improve the feature extraction and generalization capabilities of Backbone and reduce the complexity of the model. In the Head part, the ordinary convolution of the original algorithm is replaced with the ADown downsampling module, which reduces computational complexity and improves semantic retention. Finally, the loss function of the original algorithm is replaced by SlideLoss to address sample imbalance. Ablation and comparison experiments are conducted on the NEU-DET dataset. Compared with the original algorithm, the improved algorithm increases precision by 9.3%, reduces the model size by 25.5%, decreases computational complexity by 17.2%, and improves FPS to a certain extent. Comparative experiments are conducted on the VOC2012 dataset to evaluate the generalizability of the improved algorithm, and the results show that the improved algorithm exhibits strong generalizability and effectively improves the accuracy and efficiency of defect detection.