| The development of a quick and accurate automated defect detection method for Printed Circuit Boards(PCB)is highly important,both theoretically and practically,to ensure the quality of product production and meet the demands of industrial assembly line processes.In the field of object detection,deep learning has become the go-to option due to its powerful feature representation capability,but the mainstream object detection frameworks still face the problem of small object detection for PCB surface defects where it is difficult to extract feature information due to the tiny defect.This paper proposes a YOLOv5-based defect detection algorithm for tiny defects with the aim of increasing the precision of the detection model while maintaining real-time detection speed,and the main research content is as follows:1)In this paper,a PCB defect detection algorithm combining dilated convolution and detail feature fusion network is proposed.The PCB surface defects dataset was first counted and analyzed.For the problem of tiny targets which are difficult to locate accurately,this paper uses AFK-~2 algorithm to cluster suitable anchor sizes to enhance the detection precision;In this paper,we introduce a hybrid dilated convolution module in YOLOv5backbone to enhance the fine-grained representation of tiny targets in the feature extraction process;Meanwhile,a detail feature fusion network(DDFN)is proposed to further fuse the feature maps from 4 times down sampling for YOLOv5 feature fusion is not sufficient;Finally,the detection accuracy of tiny defects is further improved by adding small target prediction layers and discarding the redundant prediction layers at the output.Experiments show that,combined with the above four tricks,the m AP of the model can be increased to97.7%while maintaining real-time performance.2)Furthermore,this paper proposes a defect detection algorithm based on the attention mechanism and involution operator to address the issue of a limited defect size and lack of feature information.Firstly,the Coordinate Attention(Coord Attention,CA)module is fused in the backbone of YOLOv5s to retain the important location information;To identify defective features more accurately and ignore irrelevant background details,a CBAM module that combines spatial and channel attention is integrated into the neck of the network.In this paper,experiments are conducted on the PCB defect dataset,the experimental results show that both CA and CBAM attention mechanisms have a gaining effect on the model performance,and the final m AP is improved to 97.1%.Finally,to further validate the effect of the attention mechanism and the involution operator on the performance improvement of the model,experiments are conducted on the DAGM2007 defective dataset.An involution operator is introduced simultaneously to capture the remote contextual information based on the fusion of the two attention mechanisms.The experimental results show that both attention mechanisms and the involution operator improve the model performance to different degrees,and the final detection precision reaches 96.0%. |