Aiming at the challenges faced by existing steel surface defect detection algorithms,such as excessive parameters,high computational complexity,low accuracy,and difficulty in deployment on resource-limited embedded devices,a lightweight steel detec-tion algorithm YOLO-LGM was proposed based on the YOLOv8n object detection algorithm.The backbone feature extraction network of YOLOv8n was reconstructed by designing a lightweight network LCNet-C to reduce the parameters number and computation.The Neck layer Conv module of the YOLOv8n network model was replaced with GSConv module to reduce computation and improve accuracy.Effi-cient multi-scale attention(EMA)was integrated into the C2f module to construct the C2f-EMA module.By replacing all C2f modules in the neck layer with C2f-EMA modules after integrating attention mechanism,the model accuracy was further enhanced.Experimental results demonstrate that YOLO-LGM has a model size of 3.5 MB with 1 642 622 parameters and 5.0 GFLOPs while achieving a mean average accuracy of 76.4%on NEU-DET dataset.Comparing with YOLOv8n,the model size of the proposed method is reduced by 43.5%,the parameter number is reduced by 45.4%,the GFLOPs is reduced by 38.3%,and mean average accuracy is improved by 1.6%.The improved algorithm is effective in detecting steel defects,and the model is more lightweight and suitable for deployment in embedded devices.