# MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
## 3 Experiment and Analysis
### Experimental Process
#### 3.3.2 Performance Evaluation and Comparative Experiments of MECS Module  
The MECS module was integrated between the Neck and the prediction network of the model. Its performance was compared on both datasets against the baseline YOLOv12 model and a variant incorporating the classic spatial-channel attention module CBAM [39; 40]. The experimental results are summarized in Tables 3 and 4.  
For the Kaggle PCB Defects dataset, the integration of the MECS module significantly enhanced the model's mean average precision, increasing from 85.3% to 92.0%, a notable gain of 6.7%. Additionally, compared to the YOLOv12 + CBAM model, the mAP also  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **mAP/\%** & **FPS** \\ \hline YOLOv12 & 85.3 & 47.2 \\ YOLOv12 + CBAM & 87.2 & 46.8 \\ YOLOv12 + MECS & 92.0 & 47.1 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Impact of MECS module on performance (Peking University PCB Defect dataset).  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Model** & **mAP/\%** & **Precision/\%** & **Recall/\%** & **Parameters/MB** & **GFLOPs** & **FPS** \\ \hline SSD & 77.1 & 66.7 & 78.8 & 7.8 & 26.9 & 47.6 \\ CNN & 78.4 & 75.4 & 79.2 & 18.2 & 45.3 & 9.5 \\ Mask R-CNN & 84.1 & 79.8 & 84.6 & 13.6 & 33.3 & 11.2 \\ RetinaNet & 80.5 & 77.1 & 80.9 & 9.1 & 15.6 & 48.6 \\ EfficientDet & 82.0 & 81.8 & 79.7 & 10.3 & 18.4 & 39.4 \\ YOLOv8 & 83.3 & 82.1 & 80.2 & 12.2 & 22.1 & 46.9 \\ YOLOv12 & 84.2 & 85.7 & 82.4 & 12.4 & 23.2 & 48.0 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Different model detection performance (Peking University PCB Defect dataset).  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **mAP/\%** & **FPS** \\ \hline YOLOv12 & 85.3 & 47.2 \\ YOLOv12 + CBAM & 87.2 & 46.8 \\ YOLOv12 + MECS & 92.0 & 47.1 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Impact of MECS module on performance (Kaggle PCBA Defects dataset).  
showed a 4.8 percentage point increase. It is noteworthy that despite the significant increase in mAP, the model's frame rate only decreased slightly from 47.2 frames per second to 47.1 frames per second, showing almost no impact.  
In the Peking University PCB Defects dataset test, the YOLOv12 + MECS model's average precision increased from 84.2% to 91.7%, a rise of 7.5 percentage points. Compared to YOLOv12 + CBAM, the mAP improved by 3.6 percentage points. Although the precision showed a significant improvement, the FPS only dropped from 48.0 to 47.4, with minimal impact. YOLOv12 + MECS maintained a high frame rate while improving precision, making it suitable for real-time applications.  
This finding confirms that the MECS module significantly enhances the model's detection accuracy while maintaining stable frame rates, demonstrating its excellent performance improvement potential in object detection tasks. This performance enhancement is attributed to the innovative design of the MECS pooling layer and convolutional kernels. Unlike the classic channel and spatial attention mechanisms CBAM, the MECS module not only utilizes global average pooling and global max pooling in feature extraction but also incorporates median pooling and multi-scale convolutional kernel designs. These designs help the model handle PCB detection tasks with significant noise, such as reflections, dust occlusions, and physical noise in the input feature maps, by effectively removing noise while preserving important feature information.