Improved YOLOv7-based surface defect detection method incorporating feature retention and densely-scale spatial attention mechanisms
Year: 2026
Type: article
Abstract: In recent years, convolutional neural networks (CNNs) have been widely applied to automated defect detection. However, the feature information of small defects is easily lost during feature extraction, and as the network deepens, the increased computational burden and the insufficient utilization of existing features also affect detection performance. In addition, when the model is trained using stochastic gradient descent (SGD), it may converge to a local optimum, which limits its detection performance. To address these issues, this paper proposes a method based on YOLOv7-tiny that integrates feature retaining blocks (FRBs) and densely-scale spatial attention (DSSA) blocks into the backbone network and incorporates a cosine annealing (CA) learning rate schedule during training. The proposed method, termed Cosine Annealing Learning Rate Scheduled YOLOv7 with Densely-Scale Spatial Attention and Feature Retaining Block (CA-YOLOv7-DF), is applied to surface defect detection. Experiments were conducted on the public NEU-DET dataset, and the components were analyzed through gradient-weighted class activation mapping (Grad-CAM), confusion matrices, and training convergence analysis. Under a unified training protocol with three random seeds, CA-YOLOv7-DF achieved a mean average precision (mAP) of 71.9 ± 1.2%, compared with 70.9 ± 1.0% for YOLOv7-tiny; the FRBs provided the largest average gain, whereas the effects of the DSSA blocks and the CA schedule were within the run-to-run variation. Moreover, the proposed method achieves a detection speed of 11.6 frames per second (FPS) on the Jetson Nano embedded device, which makes it applicable to low- to moderate-speed or sampling inspection. On the GC10-DET dataset, the method did not improve on YOLOv7-tiny, indicating that its benefit depends on defect scale and the amount of training data.
Source: Scientific Reports
Language: English
Subfield: Industrial and Manufacturing Engineering
Field: Engineering
Domain: Physical Sciences
Open Access status: gold
Estimated APC paid: $2,690
OpenAlex ID: W7225321808
