In order to solve the problem that PCB bare boards were likely to have missed detections and false detections during the small target defect detection process,a PCB bare board defect detection algorithm based on improved YOLOv7,called YOLO-BCN,was proposed.First,the BRA attention mechanism was introduced into the original YOLOv7 backbone network to achieve more flexible computing allocation and content awareness,so that the network had dynamic query-aware sparsity.Then the CARAFE upsampling operator was replaced to extract more shallow features,thereby effectively improving the detection performance of the model for small targets.Finally,the NWD loss function was introduced and combined with IoU to optimize the regression loss function and reduce the sensitivity to small target position deviations.Experimental results show that the mAP@0.5 value and mAP@0.5:0.9 value of the improved YOLOv7 are increased by 3.28%and 2.74%respectively,compared with the original model,the F1 factor is increased by 3.91%,and the detection rate is 46.84 FPS,which effectively improves the accuracy of PCB small target defect detection.
关键词
PCB裸板/YOLOv7/小目标检测/注意力机制/损失函数
Key words
PCB bare board/YOLOv7/small object detection/attention mechanism/loss function