Rapid detection method for multi-scale tiny defects, computer equipment and storage medium

Through the improved YOLOv8 network structure, combined with the small-objective enhanced backbone network, the neck network based on the DCMAC-PAN structure and the target detection network, the problem of insufficient multi-scale micro defect detection efficiency and accuracy in the existing technology is solved, efficient and accurate defect detection is achieved, and circuit board production quality is improved.

CN119810430AActive Publication Date: 2025-04-11FOSHAN UNIVERSITY

Patent Information

Application Number
CN202510309460.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-04-11
Estimated Expiration
2045-03-17

AI Technical Summary

Technical Problem

When existing vision detection algorithms deal with micro-object detection tasks under high density background, they are easily disturbed by the external environment, and the recognition efficiency and accuracy of multi-scale micro-defects are difficult to meet the technological development needs of the 3C industry.

Method used

A defect detection model based on the improved YOLOv8 network structure is adopted, including a small-objective enhanced backbone network, a neck network based on the DCMAC-PAN structure, and a target detection network. Feature extraction, multi-scale feature fusion and bounding box regression performance are enhanced through offline data enhancement, DAttention module, DySample module and Wise-GIoU loss function.

Benefits of technology

It realizes the rapid and accurate detection of multi-scale micro defects on the circuit board, improves detection efficiency and accuracy, and thus improves the production and processing efficiency and production quality of the circuit board.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810430A_ABST
    Figure CN119810430A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-scale tiny defect rapid detection method, computer equipment and a storage medium, and relates to the technical field of image processing, the method comprises the following steps: collecting an image of a circuit board and preprocessing the image to obtain image detection data; inputting the image detection data into a pre-built defect detection model to obtain a defect detection result; wherein the defect detection model is constructed on the basis of an improved YOLOv8 network structure, and the improved YOLOv8 network structure comprises a backbone network with enhanced small targets, a neck network based on a DCMAC-PAN structure, and a target detection network. According to the invention, multi-scale tiny defects on the circuit board can be rapidly and accurately detected, and the detection efficiency and the detection accuracy are high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method for quickly detecting multi-scale micro defects, a computer device and a storage medium. Background Art

[0002] With the continuous increase in demand for the 3C industry and the improvement of production efficiency, modern equipment is becoming more and more precise, PCB manufacturing technology is becoming more and more mature, and the density of components per unit area of ​​circuit boards is getting higher and higher. Minor defects that appear in various production and manufacturing processes will have a great impact on the performance of the circuit board and even damage the entire circuit board. Existing visual inspection algorithms are easily disturbed by the external environment when dealing with small target detection tasks in high-density backgrounds. The recognition efficiency and accuracy of multi-scale small defects are difficult to meet the technical development needs of the 3C industry.

[0003] In actual industrial environments, defects such as short circuits, open circuits, and missing holes may occur during the printing production process, and these defects are very small in dense circuit boards. Some existing algorithms are insufficient for small target defects, and the accuracy and recall rate are often very low; in addition, the existing visual inspection algorithms have poor detection effects on defects with variable scales. For example, there are also problems of physical damage defects in circuit boards, and virtual copper defects appear during the production process. These two defects have the characteristics of variable scales compared to short circuit and open circuit defects. Among them, physical damage defects are often smaller and difficult to detect; on the contrary, for defects such as virtual copper, although larger, they are flat and long, and the size of the defects is several times that of physical damage; in addition, circuit boards have the characteristics of low recognition, because the surface of the copper plate is covered with a layer of solder mask ink. Under darker light, small defects are often very similar to normal lines. The existing visual inspection model is prone to missed detection, resulting in a very low recall rate of the model; furthermore, although the existing visual inspection algorithm can achieve a faster detection speed, the accuracy is difficult to guarantee.

[0004] The deficiencies of the existing visual detection algorithms listed above are all due to the model's inadequacy in feature extraction of small targets, the loss of some important information in the multi-scale fusion process of small targets, and the excessive fusion of some features in the scale fusion process, resulting in insufficient fusion of small targets and multi-scale targets, and ultimately leading to poor model performance. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a method for quickly detecting multi-scale tiny defects, a computer device and a storage medium, which can quickly and accurately detect multi-scale tiny defects on a circuit board with high detection efficiency and detection accuracy.

[0006] In order to solve the above technical problems, the present invention provides a method for rapid detection of multi-scale tiny defects, comprising: collecting images of circuit boards and performing preprocessing to obtain image detection data; inputting the image detection data into a pre-built defect detection model to obtain defect detection results; wherein the defect detection model is built based on an improved YOLOv8 network structure, the improved YOLOv8 network structure includes a small target enhanced backbone network, a neck network based on a DCMAC-PAN structure, and a target detection network, and the training steps of the defect detection model include: performing offline data enhancement on the acquired image data set to obtain an image training data set; training the image training data set through the small target enhanced backbone network The invention discloses a method for extracting features of different levels from a data set and retaining feature data of small targets to obtain feature maps of different levels; enhancing the fusion of multi-scale feature data in the feature map through a DAttention module, wherein the DAttention module is arranged at the tail end of the backbone network; enhancing the extraction of context information in the feature map and promoting the fusion of feature maps of different levels through a neck network based on a DCMAC-PAN structure to generate a feature map of multi-scale features; predicting the feature map of multi-scale features through a target detection network to obtain a corresponding prediction box; dynamically adjusting the position and size of the prediction box through a Wise-GIoU loss function to obtain the optimal prediction box and thus completing the training of the model.

[0007] As an improvement of the above-mentioned scheme, the step of performing offline data enhancement on the acquired image data set includes: performing image expansion processing on the acquired image data set to increase the image data in the image data set, wherein the image expansion processing includes any one or more of random flipping, random scaling, random cropping, brightness increase or decrease, and Gaussian noise processing.

[0008] As an improvement of the above scheme, the improvement steps of the backbone network for small target enhancement include: adding multiple SpdConv modules to the backbone network of the original YOLOv8 network structure to enhance the feature extraction of small target information, wherein the newly added backbone network includes a first Conv module, a second Conv module, a first SpdConv module, a first C2F module, a third Conv module, a second SpdConv module, a second C2F module, a fourth Conv module, a third SpdConv module, a third C2F module, a fifth Conv module, a fourth SpdConv module, a fourth C2F module and an SPPF module connected in sequence; a DAttention module connected to the SPPF module is introduced after the SPPF module to construct a backbone network for small target enhancement; wherein the first Conv module is used to receive an input image training data set, and the second C2F module, the third C2F module and the DAttention module respectively output feature maps of different levels to the DCMAC-PAN structure.

[0009] As an improvement of the above scheme, the improvement steps of the neck network based on the DCMAC-PAN structure include: replacing the original structure with the DCMAC-PAN structure in the original neck network to enhance the extraction of context information in the feature map and integrate feature data of different scales; wherein, replacing the original upsampling module with the DySample module in the DCMAC-PAN structure to retain more small targets or finer-grained feature data; The DCMAC-PAN structure includes a first CA module, a first Conv2d module, a first DySample module, a second DySample module, a first feature fusion module, a second Conv2d module, a third Conv2d module and a second feature fusion module connected in sequence; Among them, the first Conv2d module is also connected to the second feature fusion module, the second Conv2d module is also connected to the third feature fusion module, and the first DySample module is also connected to the third feature fusion module via the fourth feature fusion module; the feature maps of different levels output by the backbone network for small target enhancement are respectively input into the DCMAC-PAN structure via the first CA module, the fourth feature fusion module and the first feature fusion module, and the first feature fusion module, the second feature fusion module and the third feature fusion module respectively fuse the feature maps of different levels and output the corresponding multi-scale feature feature maps to the target detection network.

[0010] As an improvement of the above solution, the first feature fusion module, the second feature fusion module, the third feature fusion module and the fourth feature fusion module are all CMAC modules, and the CAMC module can fuse feature information of different scales.

[0011] As an improvement of the above scheme, the CMAC module includes a second CA module, a third CA module, a Conv2d module, a Multiply module, an Add module and a C2F module. The second CA module is connected to the Multiply module via the Conv2d module, and the third CA module is connected to the Multiply module. The second CA module and the third CA module are respectively used to receive feature maps of different levels. The Multiply module is connected to the C2F module via the Add module, and the C2F module is used to fuse feature maps of different levels and output the fusion result.

[0012] Correspondingly, the present invention further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0013] Accordingly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0014] The implementation of the present invention has the following beneficial effects: The present invention can quickly and accurately detect multi-scale tiny defects on a circuit board through an improved defect detection model, with high detection efficiency and detection accuracy, thereby improving the production and processing efficiency and production quality of the circuit board.

[0015] Among them, the defect detection model can enhance the extraction performance of feature data of small targets and promote the fusion of multi-scale feature data in feature maps to integrate global information and local information and improve the detection capability of small target information; the model also adopts the neck network of the DMAC-PAN network structure, and uses DySample to replace the upsampling module in the original structure, and combines the idea of ​​PAN's feature pyramid to effectively fuse feature maps at different levels, which can enhance the feature representation capability, thereby improving the model's recognition capability of small targets in complex scenes; the model also uses the Wise-GIoU loss function to enhance the bounding box regression performance, so as to dynamically adjust the position and size of the prediction box, thereby obtaining the optimal prediction box information and improving detection accuracy and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a flow chart of the method for rapid detection of multi-scale micro defects of the present invention; Figure 2 is an improved training flow chart of the defect detection model of the present invention; Figure 3 It is an improved structural diagram of the backbone network of the present invention; Figure 4is an improved structural diagram of the neck network of the present invention; Figure 5 It is a working structure diagram of the defect detection model of the present invention; Figure 6 It is a structural diagram of the CMAC module of the present invention; Figure 7 is a curve chart showing the change of mAP@0.5 of the improved model of the present invention and other models; Figure 8 It is a change curve diagram of mAP@0.5:0.95 of the improved model of the present invention and other models. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. It is hereby stated that the directional terms such as up, down, left, right, front, back, inside, outside, etc. that appear or will appear in the text of the present invention are only based on the accompanying drawings of the present invention, and are not specific limitations of the present invention.

[0018] like Figure 1 As shown, a specific embodiment of the present invention provides a method for rapid detection of multi-scale micro defects, including: S101, collecting images of the circuit board and performing preprocessing to obtain image detection data; It should be noted that the image data of the circuit board to be tested (such as the image data of the PCB) can be collected by the image acquisition device, and the collected image data can be preprocessed to improve the image quality, facilitate subsequent detection processing, and improve the detection accuracy. The image preprocessing means is a conventional technical means in this field and will not be described in detail here.

[0019] S102, inputting the image detection data into a pre-built defect detection model to obtain a defect detection result; It should be noted that the pre-trained defect detection model can be used to quickly perform defect detection on image detection data, especially the detection and identification of multi-scale tiny defects, so as to obtain highly accurate defect detection results; based on the detection results, the quality rate of the circuit board to be tested can be accurately determined and the good and bad products can be classified, thereby improving the production and processing efficiency and production quality of the circuit board.

[0020] The defect detection model is built based on an improved YOLOv8 network structure, which includes a small target enhanced backbone network, a DCMAC-PAN structure-based neck network, and a target detection network. Figure 2 As shown, the training steps of the defect detection model include: S201, performing offline data enhancement on the acquired image dataset to obtain an image training dataset; Specifically, the step of performing offline data enhancement on the acquired image data set includes: performing image expansion processing on the acquired image data set to increase the image data in the image data set, wherein the image expansion processing includes any one or more of random flipping, random scaling, random cropping, brightness increase or decrease, and Gaussian noise processing.

[0021] It should be noted that the acquired image data set includes at least image data of categories such as rat bite, missing hole, short circuit, open circuit, disconnection, virtual copper, stray and normal. Image expansion processing is performed on the image data set to obtain more image data for training, verification and testing. Among them, the image expansion processing is to expand each image data into 5 image data by means of random flipping, random scaling, random cropping, brightness increase and decrease and Gaussian noise operation, so that a large amount of image data can be obtained for training, verification and testing.

[0022] The expanded image data can be divided into image training data set, image verification data set and image test data set according to preset grouping rules. The above offline data enhancement method can ensure the stability of the model during the training process, help the model perform better during the convergence process, and significantly increase the diversity of the data set, thereby improving the model's robustness and generalization ability.

[0023] Preferably, the preset grouping rule is to perform random division according to the rule of training set: validation set: test set (8:1:1), but this is not limited to this.

[0024] S202, extracting features at different levels from the image training data set through a small object enhanced backbone network and retaining feature data of small objects to obtain feature maps at different levels; S203, enhancing the fusion of multi-scale feature data in the feature map through a DAttention module, wherein a DAttention (Deformable Attention) layer is set at the tail end of the backbone network; Specifically, the improvement steps of the backbone network for small target enhancement include: Step 1: Add multiple SpdConv modules to the backbone network of the original YOLOv8 network structure to enhance the feature extraction of small target information; It should be noted that the original backbone feature extraction network has the problem of insufficient small target feature extraction capability. To address this problem, the present invention introduces multiple SpdConv modules into the original backbone network. The SpdConv module can replace the stride convolution and pooling layers in the existing CNN architecture. Figure 3and 5 As shown, the newly added backbone network includes a first Conv module, a second Conv module, a first SpdConv module, a first C2F module, a third Conv module, a second SpdConv module, a second C2F module, a fourth Conv module, a third SpdConv module, a third C2F module, a fifth Conv module, a fourth SpdConv module, a fourth C2F module and an SPPF (Spatial Pyramid Pooling Fast, efficient spatial pyramid pooling) module connected in sequence; after the SPPF module, a DAttention module connected thereto is introduced to construct a backbone network for small target enhancement. Among them, the Conv module is a convolution module, which is used to extract feature information of input data (such as an image) through a convolution operation. The C2F module is a feature fusion module, which is used to fuse different feature maps and output the fusion result to improve the nonlinear ability and representation ability of the network, thereby improving the network's modeling ability for complex data.

[0025] The SpdConv module consists of a spatial-to-depth (SPD) layer and a non-strided convolution (Conv) layer. The role of the spatial-to-depth (SPD) layer is to reduce each spatial dimension of the input feature map to the channel dimension while preserving the information within the channel; this can be achieved by mapping each pixel or feature of the input feature map to a channel, in which the size of the spatial dimension is reduced while the size of the channel dimension is increased.

[0026] The non-stride convolution (Conv) layer works after the SPD layer. Unlike the existing conventional stride convolution, the non-stride convolution does not move on the feature map, but performs a convolution operation on each pixel or feature map, which helps reduce the over-downsampling problem that may occur in the SPD layer and retains more fine-grained information.

[0027] The SPD-Conv combination enables the input feature map to be converted through the SPD layer and then output to the Conv layer. The Conv layer performs a convolution operation on it, thereby reducing the size of the spatial dimension without losing information while retaining the information in the channel, which helps to improve the detection performance of CNN for low-resolution images and small objects.

[0028] Therefore, the present invention can improve the model's feature extraction capability and recognition accuracy for small targets by introducing SpdConv modules after each Conv module. The SpdConv module can convert the spatial dimension of the feature map into the depth dimension to enhance the feature representation, thereby compensating for the problem of insufficient information in low-resolution images, better retaining the feature information of small targets, and can effectively extract small target information in the feature map compared to traditional convolution, better capture edge and detail information, thereby enhancing the model's feature extraction capability for small targets and improving recognition accuracy.

[0029] Step 2: After the SPPF module, a DAttention module connected to it is introduced to construct a backbone network for small object enhancement; It should be noted that the SPPF module is used to obtain multi-scale feature information through pooling operations of different scales, which enhances the network's adaptability to objects of different sizes. The SPPF module can significantly reduce the amount of calculation while ensuring calculation accuracy and improving calculation efficiency by changing the implementation method of pyramid pooling.

[0030] After the feature extraction of small targets is enhanced in the above steps, the defect detection model uses the SPPF module to enhance the multi-scale feature representation of the feature map. In order to further enhance the fusion of these multi-scale features and make the model more effective in processing objects of different sizes, the present invention adds a DAttention module after the SPPF module to flexibly adjust the position and range of the focus or important features, as well as a sparse sampling mechanism, which can more accurately integrate global and local information, improve the model's ability to recognize small targets in complex scenes, and maintain high detection accuracy and efficient calculation.

[0031] Among them, Figure 5 As shown, in the backbone network for small target enhancement, the first Conv module is used to receive the input image training data set, and the second C2F module, the third C2F module and the DAttention module respectively output feature maps of different levels to the neck network based on the DCMAC-PAN structure. The backbone network for small target enhancement can effectively enhance the model's ability to extract features of small targets and improve recognition accuracy and efficiency.

[0032] S204, enhancing the extraction of context information in the feature map through a neck network based on a DCMAC-PAN structure and promoting the fusion of feature maps at different levels to generate a feature map of multi-scale features; Specifically, the improvement steps of the neck network based on the DCMAC-PAN (dynamic screening feature aggregation network) structure include: replacing the original PA-FPN network structure with the DCMAC-PAN structure in the original neck network to enhance the extraction of context information in the feature map and integrate feature data of different scales; wherein, replacing the original upsampling module with the DySample (dynamic upsampling) module in the DCMAC-PAN structure to retain more small targets or finer-grained feature data in the feature map; like Figure 4 As shown, the DCMAC-PAN structure includes a first CA module, a first Conv2d module (two-dimensional convolution module), a first DySample module, a second DySample module, a first feature fusion module, a second Conv2d module, a third Conv2d module and a second feature fusion module connected in sequence; wherein, the CA (Channel Attention) module helps the network to better focus on important feature information, suppress useless or noise information, and improve feature extraction capabilities by dynamically adjusting the importance of each channel.

[0033] Among them, the first Conv2d module is also connected to the second feature fusion module, the second Conv2d module is also connected to the third feature fusion module, and the first DySample module is also connected to the third feature fusion module via the fourth feature fusion module; the feature maps of different levels output by the backbone network for small target enhancement (i.e., feature maps P3, P4 and P5 with different feature information) are respectively input into the DCMAC-PAN structure via the first CA module, the fourth feature fusion module and the first feature fusion module, and the first feature fusion module, the second feature fusion module and the third feature fusion module respectively fuse the feature maps of different levels and output the corresponding multi-scale feature feature maps to the target detection network.

[0034] exist Figure 4 In the figure, N3, N4 and N5 are the feature maps of different levels fused by the bottom-up feature fusion of the pyramid structure, that is, the output results of the first feature fusion module, the second feature fusion module and the third feature fusion module. M4 and M5 are the intermediate fusion results or the marks of the intermediate fusion layers of the DCMAC-PAN structure to better characterize the structural processing process.

[0035] It should be noted that the structure diagram of the neck network based on the DCMAC-PAN structure is as follows Figure 4As shown in the figure, by replacing the original upsampling module with the DySample module, the information loss in the upsampling process can be minimized to improve the sampling capability, thereby retaining more small targets or finer-grained feature data. At the same time, by adopting the DCMAC-PAN structure, the original top-down structure can be improved to a top-down and bottom-up aggregation structure, which can better handle multi-scale features and improve the detection performance of the model on objects of different scales. At the same time, the context information in the feature map is enhanced, so that the improved model can further improve its recognition ability in complex scenes.

[0036] Among them, the first feature fusion module, the second feature fusion module, the third feature fusion module and the fourth feature fusion module are all CMAC modules. The CAMC module can fuse feature information of different scales and reduce the amount of parameters required for processing.

[0037] Furthermore, if Figure 6 As shown, the CMAC module includes a second CA module, a third CA module, a Conv2d module, a Multiply module (multiplication module), an Add module and a C2F module. The second CA module is connected to the Multiply module via the Conv2d module, and the third CA module is connected to the Multiply module. Figure 6 Pi is the feature map of the current level, Pi+1 is the feature map of the next level, and Ni is the newly fused feature map of the current level. The second CA module and the third CA module are respectively used to receive feature maps of different levels, the Multiply module is connected to the C2F module via the Add module, and the C2F module is used to fuse feature maps of different levels and output the fusion result.

[0038] Among them, the CA module is used to enhance the important features in the input feature map and suppress the unimportant features; the Conv2d module is used to extract local features in the image to help the model identify important information such as edges and textures in the image; the Multiply module can enhance the interaction between the two feature maps and highlight their common features; the Add module uses the residual idea to add new feature information while keeping the original feature map information intact; finally, the C2F module further fuses features and maintains the integrity of information between different feature layers. The CMAC module can fully fuse feature information of different scales, and compared with the original structure, it reduces more parameters, which can speed up the training and reasoning of the model, thereby enhancing multi-scale feature fusion and improving the detection ability of objects of different scales.

[0039] S205, predicting the feature map of the multi-scale features through the target detection network to obtain a corresponding prediction box; like Figure 5As shown, the target detection network includes multiple Detect modules, and the target detection network is responsible for converting the input feature map into the final specific detection result, including the target category and the bounding box (i.e., the prediction box), etc. In this embodiment, the target detection network can perform prediction processing on the input multi-scale feature feature map (i.e., convert the multi-scale feature feature map) to obtain the corresponding prediction box.

[0040] S206. Dynamically adjust the position and size of the prediction box through the Wise-GIoU loss function to obtain the optimal prediction box to complete the model training.

[0041] It should be noted that the Wise-GIoU loss function introduces a dynamic attention mechanism, which can dynamically adjust the attention level of the loss function according to the difficulty of the sample, thereby improving the training efficiency and accuracy of the model.

[0042] In the prediction structure, the Detect module predicts the feature map of multi-scale features to obtain the corresponding prediction results, that is, the predicted box after recognition. By replacing the original CIoU loss function with the Wise-GIoU loss function, a dynamic attention mechanism can be introduced to enhance the bounding box regression performance in the target detection task; by dynamically adjusting the penalty intensity, the accuracy of bounding box regression and the generalization ability of the model can be improved. For example, the Wise-GIoU loss function can enhance the ability of back propagation in the convolutional neural network, continuously update the weights of YOLOv8, adjust the position and size of the prediction box, so as to improve the accuracy of the prediction box, thereby obtaining the optimal prediction box as the detection result, and completing the training of the defect detection model.

[0043] In order to verify the effectiveness, feasibility and superiority of the method of the present invention, the method of the present invention is described and verified with specific examples below.

[0044] This embodiment uses the PCB data set disclosed by Peking University for data experiments, and performs ablation experiments with some base models to prove that the improvement of the present invention is effective. Table 1 below shows the experimental comparison results of the improved model of the present invention and other models (such as YOLOv8s, YOLOv8s+SPD, YOLOv8+SPD+HS-FPN, YOLOv8+SPD+DCMAC-PAN and YOLOv8+SPD+DCMAC-PAN+DAttention models). It can be seen from the table that the improved model proposed by the present invention has a 4.9% increase in mAP@0.5 and a 3.0% increase in mAP@0.5:0.95 when the number of parameters is less than that of the base model, and the processing efficiency is relatively high, the model detection processing time is short, and the recall rate reaches 87.8%, that is, an increase of 6.6%. The high recall rate can ensure the high reliability and low defect rate of the product, which is very important for the detection of minor PCB defects in industry.

[0045] Table 1 Comparison of different indicators of different models

[0046] To more intuitively show the effectiveness of each improvement part, such as Figures 7 to 8 The mAP@0.5 and mAP@0.5:0.95 curves of the improved model of the present invention and other models are shown, where the horizontal axis epoch parameter represents the number of iterations of the training data set during the training process. It can be seen from the figure that the improvement of each module has different improvements on the performance of the model, so that the improved model finally improved by the present invention can accurately detect small defects in PCBs in the industry and improve the detection efficiency.

[0047] Furthermore, the model proposed in the present invention has good results compared with the existing common mainstream target detection algorithms such as YOLOv5, YOLOv7, YOLOv10, RT-DETR, etc. The following Table 2 shows the experimental comparison results of the modified model of the present invention and other models (YOLOv5s, YOLOv7-tiny, YOLOv10s, YOLOv10m and RT-DETR-r18 models). It can be seen from the table that the improved model of the present invention achieves higher mAP50 and mAP@0.5:0.95 values ​​while maintaining a higher frame rate (Fps). In addition, in terms of precision and recall rate, the algorithm of the present invention is superior to the existing algorithms, greatly improving the detection efficiency and accuracy.

[0048] Table 2 Comparative experiments of different model algorithms

[0049] Therefore, the present invention not only achieves a higher accuracy in the detection task, but also maintains real-time performance, making the improved model have a higher practical value in practical applications. At the same time, based on the above advantages, the improved model of the present invention has a wider application value in the actual PCB multi-scale small target industrial detection.

[0050] Correspondingly, the present invention further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0051] Accordingly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0052] In summary, the present invention can quickly and accurately detect multi-scale tiny defects on a circuit board through an improved defect detection model, with high detection efficiency and accuracy, thereby improving the production and processing efficiency and production quality of the circuit board.

[0053] Among them, the defect detection model can enhance the extraction performance of feature data of small targets and promote the fusion of multi-scale feature data in feature maps to integrate global information and local information and improve the detection capability of small target information; the model also adopts the neck network of the DMAC-PAN network structure, and uses DySample to replace the upsampling module in the original structure, and combines the idea of ​​PAN's feature pyramid to effectively fuse feature maps at different levels, which can enhance the feature representation capability, thereby improving the model's recognition capability of small targets in complex scenes; the model also uses the Wise-GIoU loss function to enhance the bounding box regression performance, so as to dynamically adjust the position and size of the prediction box, thereby obtaining the optimal prediction box information and improving detection accuracy and efficiency.

[0054] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for rapid detection of multi-scale micro defects, characterized in that: include: Collect images of the circuit board and perform preprocessing to obtain image detection data; Inputting the image detection data into a pre-built defect detection model to obtain a defect detection result; The defect detection model is built based on an improved YOLOv8 network structure, which includes a small target enhanced backbone network, a neck network based on a DCMAC-PAN structure, and a target detection network. The training steps of the defect detection model include: Perform offline data enhancement on the acquired image dataset to obtain an image training dataset; Performing feature extraction of different levels on the image training data set through a small object enhanced backbone network and retaining feature data of small objects to obtain feature maps of different levels; Enhance the fusion of multi-scale feature data in the feature map through a DAttention module, wherein the DAttention module is arranged at the tail end of the backbone network; The context information in the feature map is enhanced and extracted through a neck network based on a DCMAC-PAN structure, and feature maps at different levels are fused to generate a feature map with multi-scale features; The feature map of multi-scale features is predicted through the target detection network to obtain the corresponding prediction box; The position and size of the prediction box are dynamically adjusted through the Wise-GIoU loss function to obtain the optimal prediction box and complete the model training.

2. The rapid detection method of multi-scale micro defects according to claim 1 is characterized in that: The step of performing offline data enhancement on the acquired image dataset comprises: The acquired image data set is subjected to image expansion processing to increase the image data in the image data set, wherein the image expansion processing includes any one or more of random flipping, random scaling, random cropping, brightness increase or decrease, and Gaussian noise processing.

3. The rapid detection method of multi-scale micro defects according to claim 1 is characterized in that: The improvement steps of the backbone network for small target enhancement include: Adding multiple SpdConv modules to the backbone network of the original YOLOv8 network structure to enhance the feature extraction of small target information, wherein the newly added backbone network includes a first Conv module, a second Conv module, a first SpdConv module, a first C2F module, a third Conv module, a second SpdConv module, a second C2F module, a fourth Conv module, a third SpdConv module, a third C2F module, a fifth Conv module, a fourth SpdConv module, a fourth C2F module and an SPPF module connected in sequence; A DAttention module connected to the SPPF module is introduced after the SPPF module to construct a backbone network for small object enhancement; Among them, the first Conv module is used to receive an input image training data set, and the second C2F module, the third C2F module and the DAttention module respectively output feature maps of different levels to the DCMAC-PAN structure.

4. The method for rapid detection of multi-scale micro defects according to claim 1, characterized in that: The improvement steps of the neck network based on the DCMAC-PAN structure include: In the original neck network, the DCMAC-PAN structure is used to replace the original structure to enhance the extraction of context information in the feature map and integrate feature data of different scales; Wherein, in the DCMAC-PAN structure, the DySample module is used to replace the original upsampling module to retain more small targets or finer-grained feature data; The DCMAC-PAN structure includes a first CA module, a first Conv2d module, a first DySample module, a second DySample module, a first feature fusion module, a second Conv2d module, a third Conv2d module and a second feature fusion module connected in sequence; Among them, the first Conv2d module is also connected to the second feature fusion module, the second Conv2d module is also connected to the third feature fusion module, and the first DySample module is also connected to the third feature fusion module via the fourth feature fusion module; the feature maps of different levels output by the small target enhanced backbone network are respectively input into the DCMAC-PAN structure via the first CA module, the fourth feature fusion module and the first feature fusion module, and the first feature fusion module, the second feature fusion module and the third feature fusion module respectively fuse the feature maps of different levels and output the corresponding multi-scale feature feature maps to the target detection network.

5. The method for rapid detection of multi-scale micro defects according to claim 4, characterized in that: The first feature fusion module, the second feature fusion module, the third feature fusion module and the fourth feature fusion module are all CMAC modules, and the CAMC module can fuse feature information of different scales.

6. The method for rapid detection of multi-scale micro defects according to claim 5, characterized in that: The CMAC module includes a second CA module, a third CA module, a Conv2d module, a Multiply module, an Add module and a C2F module. The second CA module is connected to the Multiply module via the Conv2d module, and the third CA module is connected to the Multiply module. The second CA module and the third CA module are respectively used to receive feature maps of different levels. The Multiply module is connected to the C2F module via the Add module, and the C2F module is used to fuse feature maps of different levels and output the fusion result.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Single board defect identification method and system based on deep learning

    CN117853783A

  • Integrated circuit wafer pin print image defect detection method

    CN118096693A

  • Steel plate surface defect detection method based on improved YOLOv8

    CN118279272A

  • Small target traffic sign identification method based on improved YOLOv8

    CN119339350A

  • Photovoltaic cell defect detection method

    CN119359632A

Cited By

  • Method and device for enhancing partial discharge detection data

    CN120801946A