Scientific Reports (Oct 2024)
A Novel YOLOv5_ES based on lightweight small object detection head for PCB surface defect detection
Abstract
Abstract In the manufacturing process of printed circuit boards (PCBs), surface defects have a significant negative impact on product quality. Considering that traditional object detection algorithms have low accuracy in handling PCB images with complex backgrounds, various types, and small-sized defects, this paper proposes a PCB defect detection algorithm based on a novel YOLOv5 multi-scale attention mechanism(EMA) spatial pyramid dilated Convolution (SPD-Conv) (YOLOv5_ES) network improved YOLOv5s framework. Firstly, the detection head is optimized by removing medium and large detection layers, fully leveraging the capability of the small detection head to identify minor target defects. This approach not only improves model accuracy but also achieves lightweighting. Secondly, in order to further reduce the number of parameters and computational costs, the SPD-Conv is introduced to improve the feature extraction capability by reducing information loss. Thirdly, a EMA module is introduced to fuse context information of different scales, enhancing the model’s generalization ability. Compared to the YOLOv5s model, there is a 3.1% improvement in mean average precision (mAP0.5), a 55.8% reduction in model parameters, and a 4.8% reduction in giga floating-point operations per second (GFLOPs). These results demonstrate a significant improvement in both accuracy and model parameter efficiency.