Abstract Production defects caused by irresistible factors such as process design problems or differences in steel properties in strip production affect the economic benefits of the enterprise and threaten production safety. Traditional defect detection methods are difficult to achieve real-time and high-precision detection, so developing surface defect detection methods based on deep learning is of great significance for strip production. In order to effectively improve the accuracy of the deep learning model in detecting surface defects on hot-rolled strip, in this work we propose a real-time detection model for surface defects on strip steel based on the YOLOv8n model. Firstly, the newly convolutional layer Con5v is designed to replace the original convolutional layer in the neck, and an attention mechanism is added in front of each Con5v to improve the algorithm's ability to extract small target information. Secondly, an additional set of upsampled feature extraction units is added to the neck in order to enhance the spatial information of the feature map. Subsequently, a set of feature fusion units is incorporated and the convolutional layers in it are improved to provide better feature maps. Thirdly, the number of decoupling detection heads is increased to receive more high-quality features. The final experimental results show that YOLOv8n-GAM (YOLOv8 Nano Model with Global Attention Mechanism) achieves 81.4mAP and 82.0FPS on the NEU-DET dataset and 71.2mAP and 55.0FPS on the GC10-DET dataset, which are 5.7% and 6.9% higher than those of YOLOv8n, respectively. The model proposed in this paper achieves a comprehensive performance improvement in strip steel.