Abstract:
In order to solve the problem of difficulty in detecting PCB surface defects caused by miniaturization and refinement of PCB, this paper takes the YOLOv8n model as the baseline model and proposes an improved YOLOv8n-PCB model. First, add the convolution block attention module (Convolutional Block Attention Module (CBAM) is embedded into the backbone and neck of YOLOv8n, allowing defect features to be screened through channel attention and spatial attention mechanisms before connection. CBAM is used to strengthen feature recalibration, channel attention screens important channels, and spatial attention locates key areas; Secondly, a P2 detection layer is added by downsampling in the neck network, and a new 160×160 size detection layer is used to realize 4 times downsampling, and the feature map at the lower level of the backbone network is directly used to retain richer feature information; Finally, the NWD LOSS loss function is used to model the bounding box as a two-dimensional Gaussian distribution to provide meaningful gradients and further improve the detection accuracy. Experimental results show that compared with the YOLOv8n baseline model, the YOLOv8n-PCB model increases mAP@0.5 by 2.79 percentage points to 94.21%, and increases mAP@0.75/% by 6.98%.