Surface defects on steel are a significant challenge for the steel industry.Traditional steel defect detection methods suffer from low efficiency and accuracy.To address these issues,an AFSD-YOLOv7 model has been designed for real-time steel surface defect detection.First,a lightweight convolutional structure was used to replace the standard convolu-tional structure in the YOLOv7 model,speeding up the inference process.Next,a fast spatial pyramid pooling structure was used to replace the original spatial pyramid pooling structure to accelerate the network's feature extraction process.Finally,an improved ECA-Net attention mechanism was added to enhance the model′s detection accuracy.Experimental results show that AFSD-YOLOv7 can effectively identify steel defects.Compared to the YOLOv7 model,AFSD-YOLOv7 reduces compu-tation by 54.8%and improves mAP by 3.2%,indicating significant practical value for steel surface defect detection.