# MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
## 3 Experiment and Analysis
### Experimental Process
#### 3.3.5 Comprehensive Ablation Experiment
For instance, in Figure 6a, the YOLOv12 model fails to accurately identify all instances of Missing hole defects, exhibiting missed detections. Furthermore, the boundary boxes it delineates for certain holes are not precise, failing to accurately outline the complete contours of the Missing hole defects. Similarly, in Figure 6c, the model's performance on Open circuit defects is subpar, as it struggles to accurately detect subtle Open circuit areas, leading to incomplete detection results. Figure 5: Comparison of receptive fields before and after improvement. (a) Receptive field of YOLOv12; (b) receptive field of MAS-YOLO. Conversely, the MAS-YOLO model demonstrates significant advantages following the improvements. It is capable of accurately identifying small defect targets within complex backgrounds and has enhanced the precision of defect boundary localization. Take the Spur defect in Figure 6e as an example, the MAS-YOLO model accurately captures the minute characteristics of the Spur and delineates it with boundary boxes that closely match its actual shape, thereby reducing instances of misjudgment and missed detection. Additionally, in the case of the Spurious copper defect in Figure 6f, the improved model not only accurately identifies the locations of excess copper but also distinguishes them more effectively from normal circuit patterns, thereby significantly enhancing detection accuracy. Across various defect detection tasks, the MAS-YOLO model delivers outstanding performance. Its confusion matrix for classification detection is depicted in Figure 7. An analysis of the confusion matrix reveals that while there are still extremely few misclassifications between the Missing hole and Open circuit categories, the number of such misclassifications has been substantially reduced compared to the original model. This indicates that the MAS-YOLO model not only improves detection accuracy but also enhances its ability to accurately classify different defect types. Furthermore, refined label preprocessing in the future can further decrease these minor misclassifications. Using the same merged dataset, the improved MAS-YOLO algorithm was compared with other state-of-the-art detection algorithms for overall performance. The experimental results are shown in Figure 8 and Table 10. Although [PERSON]'s CS-ResNet model [17] achieves a classification accuracy of 93.7%, slightly higher than this study, its model parameter size and complexity limit its detection frame rate to only 15.1 frames per second, making it unsuitable for real-time detection in production line applications. While [PERSON]'s Faster-RCNN [12] has an advantage in detection frame rate, its mAP value is only 75.8, far below the detection accuracy of this study. Therefore, the MAS-YOLO proposed in this study performs better in both average detection accuracy and real-time detection, making it particularly suitable for real-time defect detection on PCB production lines. It  
Figure 6: Detection performance comparison before and after improvement. (**a–f**) represent the classification detection of Missing hole, Mouse bite, Open circuit, Short, Spur, and Spurious copper. Each subfigure juxtaposes the detection outcomes of the two models, with the left side illustrating the original YOLOv12 results and the right side showcasing the MAS-YOLO results.