MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12

As the performance requirements for printed circuit boards (PCBs) in electronic devices continue to increase, reliable defect detection during PCB manufacturing is vital. However, due to the small size, complex categories, and subtle differences in defect features, traditional detection methods are...

Full description

Saved in:
Bibliographic Details
Main Authors: Xupeng Yin, Zikai Zhao, Liguo Weng
Format: Article
Language:English
Published: MDPI AG 2025-06-01
Series:Applied Sciences
Subjects:
Online Access:https://www.mdpi.com/2076-3417/15/11/6238
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1850160868308811776
author Xupeng Yin
Zikai Zhao
Liguo Weng
author_facet Xupeng Yin
Zikai Zhao
Liguo Weng
author_sort Xupeng Yin
collection DOAJ
description As the performance requirements for printed circuit boards (PCBs) in electronic devices continue to increase, reliable defect detection during PCB manufacturing is vital. However, due to the small size, complex categories, and subtle differences in defect features, traditional detection methods are limited in accuracy and robustness. To overcome these challenges, this paper proposes MAS-YOLO, a lightweight detection algorithm for PCB defect detection based on improved YOLOv12 architecture. In the Backbone, a Median-enhanced Channel and Spatial Attention Block (MECS) expands the receptive field through median enhancement and depthwise convolution to generate attention maps that effectively capture subtle defect features. In the Neck, an Adaptive Hierarchical Feature Integration Network (AHFIN) adaptively fuses multi-scale features through weighted integration, enhancing feature utilization and focus on defect regions. Moreover, the original YOLOv12 loss function is replaced with the Slide Alignment Loss (SAL) to improve bounding box localization and detect complex defect types. Experimental results demonstrate that MAS-YOLO significantly improves mean average precision (mAP) and frames per second (FPS) compared to the original YOLOv12, fulfilling real-time industrial detection requirements.
format Article
id doaj-art-5c1f21435f8940ecb06857b1bc4844c8
institution OA Journals
issn 2076-3417
language English
publishDate 2025-06-01
publisher MDPI AG
record_format Article
series Applied Sciences
spelling doaj-art-5c1f21435f8940ecb06857b1bc4844c82025-08-20T02:23:01ZengMDPI AGApplied Sciences2076-34172025-06-011511623810.3390/app15116238MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12Xupeng Yin0Zikai Zhao1Liguo Weng2Jiangsu Key Laboratory of Big Data Analysis Technology, Nanjing University of Information Science and Technology, Nanjing 210044, ChinaCollaborative Innovation Center on Atmospheric Environment and Equipment Technology, Nanjing University of Information Science and Technology, Nanjing 210044, ChinaJiangsu Key Laboratory of Big Data Analysis Technology, Nanjing University of Information Science and Technology, Nanjing 210044, ChinaAs the performance requirements for printed circuit boards (PCBs) in electronic devices continue to increase, reliable defect detection during PCB manufacturing is vital. However, due to the small size, complex categories, and subtle differences in defect features, traditional detection methods are limited in accuracy and robustness. To overcome these challenges, this paper proposes MAS-YOLO, a lightweight detection algorithm for PCB defect detection based on improved YOLOv12 architecture. In the Backbone, a Median-enhanced Channel and Spatial Attention Block (MECS) expands the receptive field through median enhancement and depthwise convolution to generate attention maps that effectively capture subtle defect features. In the Neck, an Adaptive Hierarchical Feature Integration Network (AHFIN) adaptively fuses multi-scale features through weighted integration, enhancing feature utilization and focus on defect regions. Moreover, the original YOLOv12 loss function is replaced with the Slide Alignment Loss (SAL) to improve bounding box localization and detect complex defect types. Experimental results demonstrate that MAS-YOLO significantly improves mean average precision (mAP) and frames per second (FPS) compared to the original YOLOv12, fulfilling real-time industrial detection requirements.https://www.mdpi.com/2076-3417/15/11/6238defect detectionsmall target detectionYOLOv12attention mechanismloss function
spellingShingle Xupeng Yin
Zikai Zhao
Liguo Weng
MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
Applied Sciences
defect detection
small target detection
YOLOv12
attention mechanism
loss function
title MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
title_full MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
title_fullStr MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
title_full_unstemmed MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
title_short MAS-YOLO: A Lightweight Detection Algorithm for PCB Defect Detection Based on Improved YOLOv12
title_sort mas yolo a lightweight detection algorithm for pcb defect detection based on improved yolov12
topic defect detection
small target detection
YOLOv12
attention mechanism
loss function
url https://www.mdpi.com/2076-3417/15/11/6238
work_keys_str_mv AT xupengyin masyoloalightweightdetectionalgorithmforpcbdefectdetectionbasedonimprovedyolov12
AT zikaizhao masyoloalightweightdetectionalgorithmforpcbdefectdetectionbasedonimprovedyolov12
AT liguoweng masyoloalightweightdetectionalgorithmforpcbdefectdetectionbasedonimprovedyolov12