PCB small target defect detection method based on improved YOLOv8x

By improving the Backbone and Neck networks of the YOLOv8x model, an efficient feature extraction module was introduced, which solved the problem of insufficient feature extraction capabilities when detecting small PCB defects, and achieved higher detection accuracy and classification capabilities.

CN119722669AInactive Publication Date: 2025-03-28DALIAN UNIV OF TECH +1

Patent Information

Application Number
CN202510220970.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-03-28
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When detecting small target defects on PCB, the YOLO model has problems with limited feature extraction capabilities, which makes it difficult to accurately detect defects with small shapes, low contrast and irregular boundaries.

Method used

Improve the Backbone and Neck networks of the YOLOv8x model, and enhance feature extraction and detection capabilities by designing the C2f_SA_MLCA ​​module and the C2f_WT_SCSA module, the SAConv convolution kernel and the MLCA fusion hybrid local channel attention module, as well as the WTConv convolution kernel and the SCSA fusion space and channel collaborative attention module.

Benefits of technology

The model's feature extraction and classification capabilities of small PCB target defects are improved, and the detection accuracy of defects with small shapes, low contrast and irregular boundaries is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119722669A_ABST
    Figure CN119722669A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of PCB defect detection, and discloses a PCB small target defect detection method based on improved YOLOv8x. Performing data enhancement on the original PCB defect picture data set; a Backbone network is improved, a SAConv convolution kernel is introduced, and a fusion MLCA mixed local channel attention module is added; a Neck network is improved, a small target detection head for processing a 160 * 160 pixel feature map is added, in addition, a WTconv convolution kernel is introduced into the Neck network, and an SCSA fusion space and channel collaborative attention module is added; and performing PCB small target defect detection by using the trained improved YOLOv8x model. The method is suitable for defect detection of small targets in pictures under the complex background of the pictures, and compared with an original YOLOv8x model, the method has the advantage that the detection precision is improved on the premise that the detection speed is not affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of PCB defect detection, and in particular to a PCB small target defect detection method based on improved YOLOv8x. Background Art

[0002] In the modern electronic manufacturing industry, PCB (printed circuit board) is the basic component of electronic products. The traditional PCB defect detection method mainly relies on manual visual inspection, but this method is inefficient, error-prone, and greatly affected by subjective factors. Therefore, artificial intelligence PCB defect detection technology has become a crucial solution.

[0003] Currently, deep learning algorithms are developing rapidly and achieving remarkable results in the field of target detection with their powerful learning ability and trainable feature extraction capabilities. Among them, the YOLO (You Only Look Once) model has fast responsiveness and convenient migration when performing detection tasks based on its own end-to-end model structure characteristics, which is very suitable for detection scenarios under industrial assembly lines, such as PCB defect detection.

[0004] However, although the YOLO model has a fast detection speed, its own model structure has limited feature extraction capabilities. In particular, it is difficult to locate defects on PCBs, such as short circuits, open circuits, burrs, leaks, rat bites, copper scraps and other small target defects. These defects are often small in shape, have low contrast with the surrounding area, and have irregular and unclear defect boundaries. This brings many problems and challenges to deep learning algorithms represented by the YOLO model. Summary of the invention

[0005] To solve the above problems, the present invention proposes a PCB small target defect detection method based on improved YOLOv8x. The method is based on the YOLOv8x model and improves its Backbone network and Neck network.

[0006] The technical solution of the present invention is as follows: A PCB small target defect detection method based on improved YOLOv8x comprises the following steps:

[0007] Obtain an online open source data set, wherein the online open source data set contains real PCB defect images; perform data enhancement on the PCB defect images according to the category labels of the online open source data set, and input the data enhanced images into the improved YOLOv8x network for training;

[0008] The improved YOLOv8x network is obtained by improving the Backbone network and the Neck network of the original YOLOv8x; the improved Backbone network of the original YOLOv8x is specifically:

[0009] Design a C2f_SA_MLCA ​​module to replace the C2f module in the original YOLOv8x Backbone network;

[0010] The network structure of the C2f_SA_MLCA ​​module includes a first CBS module, a segmentation module, three SA_MLCA_Bottleneck modules connected in series, and a second CBS module, which are connected according to the residual network structure;

[0011] When the feature map is input into the C2f_SA_MLCA ​​module, the number of channels is divided into two branches after the first CBS module. The first branch passes through the segmentation module and three SA_MLCA_Bottleneck modules in series, and the feature map processed by each module is saved at the same time. The second branch and the feature map processed by each module are Figure 1 After the feature map after the two branches are merged and calculated is input into the second CBS module, the C2f_SA_MLCA ​​module is output.

[0012] The SA_MLCA_Bottleneck module introduces the SAConv convolution kernel and the MLCA fusion hybrid local channel attention module to improve the feature extraction capability; the SAConv convolution kernel uses different void rates to convolve the feature map to capture the contextual information of the feature map at multiple scales and improve the feature extraction capability; the MLCA fusion hybrid local channel attention module first uses local average pooling to extract the feature information of the local area, then uses global average pooling to extract the global feature information, then uses the Conv1d convolution kernel to compress the channel of the feature map for feature conversion, and finally uses the local feature vector after feature conversion and the global feature vector after feature conversion for feature fusion, thereby enhancing the interaction between the information expressed by the overall image and the local targets in the image during the feature extraction process, improving the ability to understand the targets in the image and the context around the targets, and improving the feature extraction capability.

[0013] Improve the original YOLOv8x Neck network, specifically:

[0014] Based on the original three detection heads of YOLOv8x, a small target detection head that processes 160×160 pixel feature maps is added to increase the receptive field of Neck network detection;

[0015] Design a C2f_WT_SCSA module to replace the C2f module in the original Neck network;

[0016] The network structure of the C2f_WT_SCSA module includes a first CBS module, a segmentation module, three WT_SCSA_Bottleneck modules connected in series, and a second CBS module, which are connected according to the residual network structure;

[0017] When the feature map is input into the C2f_WT_SCSA module, the first CBS module takes half of the number of channels and divides it into two branches for processing; the first branch passes through the segmentation module and three WT_SCSA_Bottleneck modules in series, and saves the feature map processed by each module at the same time; the second branch and the feature map processed by each module are Figure 1 The two branches are merged and calculated, and the feature maps after the two branches are merged and calculated are input into the second CBS module, and then output to the C2f_WT_SCSA module.

[0018] The WT_SCSA_Bottleneck module introduces the WTConv convolution kernel and the SCSA fusion space and channel collaborative attention module to enhance the feature representation capability of the feature map; the WTConv convolution kernel adds a cascade wavelet decomposition network layer in the process of convolution of the feature map, sets different frequency bandwidths from low to high, performs convolution in the frequency bandwidths respectively, and finally obtains the convolved feature map by inverse wavelet transform, so as to ensure that the low-frequency information will not be lost in the convolution process, enhance the feature representation of the low-frequency signal in the feature map, and improve the possibility of detecting local small targets; the SCSA fusion space and channel collaborative attention module first uses multi-scale Conv1d convolution inside to capture the spatial information of the feature map at different scales to obtain multi-scale sub-feature vectors; the multi-scale sub-feature vectors are normalized to obtain the attention feature map containing spatial information, and then the attention feature map containing spatial information is calculated according to different channels using a single-head self-attention mechanism. In the process of feature fusion, the SCSA fusion space and channel collaborative attention module simultaneously considers the spatial information and channel information of the feature map to enhance the feature representation capability of the feature map;

[0019] The trained improved YOLOv8x model is used for PCB small target defect detection.

[0020] The SA_MLCA_Bottleneck module includes a 3×3 CBS module, a 3×3 SA_B_S module and an MLCA fusion hybrid local channel attention module, which are connected according to the residual network structure;

[0021] When the feature map is input into the SA_MLCA_Bottleneck module, the number of channels is divided into two branches for processing. The first branch is processed by the 3×3 CBS module, the 3×3 SA_B_S module, and the MLCA fusion hybrid local channel attention module in sequence. The first branch is processed by the MLCA fusion hybrid local channel attention module and then merged with the second branch.

[0022] The CBS module includes a standard Conv2d convolution kernel, a standard BatchNorm2d batch normalization module and a standard SiLU activation function;

[0023] The SA_B_S module replaces the standard Conv2d convolution kernel in the CBS module with the SAConv convolution kernel, and convolves the feature map using different hole rates.

[0024] The WT_SCSA_Bottleneck module includes a 3×3 CBS module, a 3×3 WT_B_S module, and an SCSA fusion space and channel collaborative attention module, which are connected according to the residual network structure;

[0025] The CBS module has the same network structure as the CBS module in the Backbone network;

[0026] The WT_B_S module replaces the standard Conv2d convolution kernel in the CBS module with the WTConv convolution kernel.

[0027] Compared with the prior art, the present invention has the following beneficial effects:

[0028] Based on the YOLOv8x model, the present invention improves the original YOLOv8x network structure.

[0029] Compared with the original YOLOv8x network structure, the present invention improves the algorithm model of the Backbone network of YOLOv8x, designs a C2f_SA_MLCA ​​module in the Backbone network to replace the original C2f module, introduces the SAConv convolution kernel in the Bottleneck module of the C2f_SA_MLCA ​​module, and adds an MLCA fusion mixed local channel attention module to fuse local and global features using convolution kernels with different void rates, thereby enhancing the feature extraction capability of the Backbone network; improves the algorithm model of the Neck network of YOLOv8x, and adds a small target detection head at the feature map position of 160×160 pixels on the basis of the original three detection heads of YOLOv8x , which is used to increase the receptive field of feature map detection and enhance the feature representation ability of feature maps for small targets; in the Neck network design, the C2f_WT_SCSA module replaces the original C2f module, introduces the WTconv convolution kernel in the Bottleneck module of the C2f_WT_SCSA module and adds the SCSA fusion space and channel collaborative attention module. The WTconv convolution kernel is more sensitive to the low-frequency information of the feature map, which enhances the model's feature representation of different types of defects and improves the model's classification ability for different PCB defects. The SCSA fusion space and channel collaborative attention module is used to suppress irrelevant or redundant feature map areas and channels from both the spatial and channel dimensions, enhancing the feature representation ability of local small targets in the feature map. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 A flow chart of a PCB small target defect detection method based on improved YOLOv8x used in an embodiment of the present invention;

[0031] Figure 2 A schematic diagram of the network structure of the C2f_SA_MLCA ​​module used in an embodiment of the present invention;

[0032] Figure 3 A schematic diagram of the network structure of the SA_MLCA_Bottleneck module used in an embodiment of the present invention;

[0033] Figure 4 A schematic diagram of the network structure of the C2f_WT_SCSA module used in an embodiment of the present invention;

[0034] Figure 5 A schematic diagram of the network structure of the WT_SCSA_Bottleneck module used in an embodiment of the present invention;

[0035] Figure 6 A schematic diagram of the network structure of a PCB small target defect detection method based on improved YOLOv8x used in an embodiment of the present invention. DETAILED DESCRIPTION

[0036] In order to make the technical solution, purpose and advantages of the present invention more clear, the present invention is further described in detail below through the accompanying drawings and embodiments. It should be pointed out that the provided embodiments are only used to explain the present invention, rather than to limit the scope of protection of the present invention.

[0037] Improve the C2f module of the Backbone network, introduce the SAConv convolution kernel in the Bottleneck module in the C2f module, and add the MLCA fusion hybrid local channel attention module according to the residual network structure. Use convolution kernels with different void rates to fuse the local features and global features of the feature map at the same time to enhance the feature extraction of small targets.

[0038] Improve the C2f module of the Neck network, add a small target detection layer to the Neck network, introduce the WTconv convolution kernel in the Bottleneck module of the C2f module of the Neck network, and add the SCSA fusion space and channel collaborative attention module according to the residual network structure. The WTconv convolution kernel is more sensitive to the low-frequency information of the feature map, and enhances the extraction of low-frequency signals from the feature map. The SCSA fusion space and channel collaborative attention module is used to suppress irrelevant or redundant feature map regions and channels from both the spatial and channel dimensions, and enhance the feature representation of feature maps in different types of defects from both spatial and channel dimensions, which is used to enhance the feature representation capability of local small targets in the feature map and improve the model's classification capability for different PCB defects.

[0039] The following is a detailed description of a specific implementation method of a PCB small target defect detection method based on improved YOLOv8x, which is intended to help understand the technical solution and operation steps of the present invention.

[0040] See also Figure 1 , the method comprises the following steps:

[0041] S110, obtaining the open source PCB defect dataset PKU-Market-PCB from the Peking University Intelligent Robotics Open Laboratory, performing data enhancement on the PCB defect images according to the category labels, and constructing the data-enhanced images into a training dataset and a test dataset;

[0042] S120, improving the algorithm model of the Backbone network of YOLOv8x, designing a C2f_SA_MLCA ​​module to replace the C2f module in the original YOLOv8x Backbone network; the network structure of the C2f_SA_MLCA ​​module includes a first CBS module, a segmentation module, three SA_MLCA_Bottleneck modules connected in series, and a second CBS module, which are connected according to the residual network structure;

[0043] The SA_MLCA_Bottleneck module introduces the SAConv convolution kernel into the Bottleneck module of the C2f module of the Backbone network and adds the MLCA fusion mixed local channel attention module to fuse local and global features using convolution kernels with different void rates, thereby enhancing the feature extraction capability of the Backbone network.

[0044] S130. Improve the algorithm model of the Neck network of YOLOv8x, add a small target detection layer to the Neck network, and design a C2f_WT_SCSA module to replace the C2f module in the original Neck network;

[0045] The network structure of the C2f_WT_SCSA module includes a first CBS module, a segmentation module, three WT_SCSA_Bottleneck modules connected in series, and a second CBS module, which are connected according to the residual network structure;

[0046] WT_SCSA_Bottleneck introduces the WTconv convolution kernel into the Bottleneck module of the C2f module of the Neck network and adds the SCSA fusion space and channel collaborative attention module. The WTconv convolution kernel is more sensitive to the low-frequency information of the feature map. The SCSA fusion space and channel collaborative attention module is used to suppress irrelevant or redundant feature map regions and channels from both the spatial and channel dimensions, and to enhance the feature representation capability of small local targets in the feature map.

[0047] S140, input the training data set for training according to the improved YOLOv8x to obtain the trained YOLOv8x, and input the test data set for testing and evaluation.

[0048] In this embodiment, the detailed implementation steps of step S110 include:

[0049] The PKU-Market-PCB dataset contains a total of 6 defect categories, namely short circuit, open circuit, burr, leak, rat bite, and copper. Data enhancement is performed on the original dataset to increase the diversity and complexity of the dataset. Training YOLOv8x with data-enhanced images can improve the generalization of the model.

[0050] The original images in the images folder of the PKU-Market-PCB dataset were subjected to four data enhancement methods: random scaling and cropping, random rotation, Mosaic, and contrast enhancement. Among them, random scaling and cropping first set the scaling ratio to a random number (0.5, 1.0) to scale the original image, and then set the ratio of the cropping area to the original image area to a random number (0.5, 0.85) and the aspect ratio of the cropping box to a random number (0.75, 1.25) to randomly crop the scaled image; random rotation sets the image to rotate with the upper left corner as the vertex, and sets the rotation angle to (-30°, 30°); Mosaic first partially crops four different images, and then splices the four locally cropped images to obtain the Mosaic enhanced image; contrast enhancement adjusts the contrast of the original image according to the histogram equalization algorithm.

[0051] The image enhanced by the above four data enhancement methods is resized to 640×640 output to obtain the data enhanced image and the annotation file of the data enhanced image. The data enhanced image and the original image are mixed at random according to the defect category to obtain the data enhanced data set, which contains 250 images for each defect category, totaling 1500 images. The data enhanced data set is divided into training data set and test data set according to the defect category in a ratio of 8:2. The training data set is used to train the improved YOLOv8x model, and the test data set is used to evaluate the performance of the trained improved YOLOv8x model according to four evaluation indicators.

[0052] See also Figure 2 In this embodiment, the detailed implementation steps of step S120 include:

[0053] In this embodiment, the four C2f modules in the Backbone network of the original YOLOv8x are improved into C2f_SA_MLCA ​​modules. The deep_factor of the YOLOv8x model is set to 1.0, n represents the number of SA_MLCA_Bottleneck modules in the C2f_SA_MLCA ​​module, n = 3*deep_factor, and the number of SA_MLCA_Bottleneck modules in the C2f_SA_MLCA ​​module in this embodiment is 3.

[0054] See also Figure 3 In this embodiment, the SA_MLCA_Bottleneck module includes a first 1×1 CBS module, a second 3×3 SA_B_S module, and a third MLCA fusion hybrid local channel attention module, and the above three modules are connected according to the residual network structure;

[0055] The CBS module includes a standard Conv2d convolution kernel, a standard BatchNorm2d batch normalization module, and a standard SiLU activation function; the SA_B_S module replaces the standard Conv2d convolution kernel in the CBS module with a SAConv convolution kernel. The SAConv convolution kernel uses two different hole rates to convolve the feature map. Compared with the original Conv2d, the receptive field is increased, and the features of more areas of the feature map can be received. The use of two different hole rates can capture feature information of different scales and enhance the feature extraction capability. In addition, the two different hole rates use the same trainable weights. The present invention adds the SAConv convolution kernel to the SA_MLCA_Bottleneck module. The feature map will be Spilt-processed before being input into the SA_MLCA_Bottleneck module, reducing the number of channels to half. Therefore, this design improves the model feature extraction capability, while only a small amount of model parameters are added, and the model efficiency is taken into account from a structural perspective.

[0056] The MLCA fusion hybrid local channel attention module first uses local average pooling to extract feature information of local areas based on the SAConv convolution kernel convolution processing feature map, and then uses global average pooling to extract global feature information, and then uses the Conv1d convolution kernel to compress the channels of the feature map for feature conversion. This method of processing the feature map (C, W, H) based on channels for local average pooling and global average pooling is similar to the spatial attention mechanism, which performs maximum pooling and average pooling on the feature map spatially and then performs convolution on the space. It is used to fuse the feature maps according to channel attention while taking into account the spatial characteristics of the feature maps. Finally, the local feature vector and the global feature vector after feature conversion are used for feature fusion, which is used to enhance the semantic information of the feature map and enhance the feature capture capability.

[0057] See also Figure 4 In this embodiment, the detailed implementation steps of step S130 include:

[0058] This example sets the YOLOv8x input image size to 640×640, see Figure 6 On the basis of the original YOLOv8x three detection heads, a small target detection head is added at the 160×160 pixel feature map position to increase the receptive field of feature map detection and enhance the feature map's ability to represent small targets.

[0059] In this embodiment, all C2f modules in the original YOLOv8x Neck network and the added small target detection head are improved into C2f_WT_SCSA modules. Referring to step S120, the number of WT_SCSA_Bottleneck modules in the C2f_WT_SCSA module in this embodiment is 3.

[0060] See also Figure 5 In this embodiment, the WT_SCSA_Bottleneck module includes a first 1×1 CBS module, a second 3×3 WT_B_S module, and a third SCSA fusion space and channel collaborative attention module, and the above three modules are connected according to the residual network structure;

[0061] The CBS module is the same as the CBS module in the Backbone network;

[0062] The WT_B_S module replaces the standard Conv2d convolution kernel in the CBS module with the WTConv convolution kernel. Based on wavelet transform, a cascade wavelet decomposition network layer is added in the process of feature map convolution. Each convolution kernel corresponds to a different input frequency bandwidth. In the process of feature map convolution, it has a gradually increasing receptive field, increases the attention to low-frequency signals, and is used to enhance the feature representation capability of low-frequency signals in the feature map of the Neck network.

[0063] The SCSA fusion space and channel collaborative attention module first uses spatial attention on the basis of WTConv convolution kernel convolution processing feature map, enhances the semantic representation ability of feature map based on multi-scale spatial information, and then uses channel attention to calculate the similarity difference between channels, which is used to narrow the representation difference between different semantics of feature map. The SCSA fusion space and channel collaborative attention module pays attention to the feature information of space and channel at the same time, and enhances the feature representation ability of local small targets in feature map.

[0064] In this embodiment, the detailed implementation steps of step S140 include:

[0065] After steps S110-S130, an improved YOLOv8x model is obtained, and different epochs are set to 49, 99 and 199, respectively, and the improved YOLOv8x model is trained according to the training data set. The improved YOLOv8x model trained at different epochs is evaluated using the test data set images according to the four evaluation indicators of precision, recall, balance score (F1), and weighted average accuracy (mAP), and the model with the best performance is put into production. Among them, precision is used to evaluate the proportion of positive samples in the prediction results; recall is used to evaluate the recall rate in the prediction results; balance score is the harmonic mean of precision and recall, which is used to balance precision and recall to evaluate model performance; weighted average accuracy is the accuracy of the model evaluated under different intersection-over-union ratios between the detection box and the true box, which is used to evaluate the detection accuracy of the model and the detection stability in different scenarios.

[0066] Among them, accuracy is used to evaluate the proportion of positive samples in the prediction results, and the calculation formula is as follows:

[0067]

[0068] In the formula, TP means that the detected target matches the actual target, and FP means that the detected target does not match the actual target;

[0069] The recall rate is used to evaluate the recall rate in the prediction results. The calculation formula is as follows:

[0070]

[0071] In the formula, FN represents the actual target that cannot be detected;

[0072] The balance score is the harmonic mean of precision and recall, which is used to balance precision and recall to evaluate model performance. The calculation formula is as follows:

[0073]

[0074] The weighted average accuracy (mAP) is the accuracy of the model evaluated under different intersection-over-union ratios between the detection box and the true box. For example, mAP50 refers to the average accuracy when the IoU threshold is 0.5, where the IoU threshold calculation formula is as follows:

[0075]

[0076] This embodiment counts the average precision of mAP when the IoU threshold is [0.5, 0.95], which is used to evaluate the detection accuracy of the model and the detection stability in different scenarios.

[0077] See also Figure 6The present invention introduces SAconv convolution kernel and MLCA fusion hybrid local channel attention module in Backbone network to enhance the feature extraction capability of small target defects of PCB, and introduces WTConv convolution kernel and SCSA fusion space and channel collaborative attention module in Neck network to improve the feature map space and channel dimensions, reduce the representation difference between different semantics of feature maps, and enhance the feature representation capability of input feature maps. In addition, from the perspective of network structure improvement, SA_MLCA_Bottleneck module and WT_SCSA_Bottleneck module are designed. According to the residual network structure, when inputting feature maps, the number of feature map channels will be reduced to half. Therefore, the above-mentioned improved module only increases the number of model parameters by a small amount, so as to improve the model accuracy and reduce the false detection rate without affecting the calculation speed of the model.

[0078] The above disclosure is only the preferred embodiment of the present invention, but the present invention is not limited thereto. Based on the above content of the present invention, other embodiments obtained by those skilled in the art without departing from the principle of the present invention should all fall within the scope of protection of the present invention.

Claims

1. A PCB small target defect detection method based on improved YOLOv8x, characterized in that: The following steps are involved: Obtain an online open source dataset, wherein the online open source dataset contains real PCB defect images; Data enhancement is performed on the PCB defect images according to the category labels of the online open source data set, and the data-enhanced images are input into the improved YOLOv8x network for training; The improved YOLOv8x network is obtained by improving the Backbone network and the Neck network of the original YOLOv8x; the improved Backbone network of the original YOLOv8x is specifically: Design a C2f_SA_MLCA ​​module to replace the C2f module in the original YOLOv8x Backbone network; The network structure of the C2f_SA_MLCA ​​module includes a first CBS module, a segmentation module, three SA_MLCA_Bottleneck modules connected in series, and a second CBS module, which are connected according to the residual network structure; When the feature map is input into the C2f_SA_MLCA ​​module, after the first CBS module, the number of channels is divided into two branches for processing; the first branch passes through the splitting module and three SA_MLCA_Bottleneck modules in series, and the feature map processed by each module is saved at the same time; the second branch is combined and calculated together with the feature map processed by each module; the feature map after the two branches are combined and calculated is input into the second CBS module, and then output to the C2f_SA_MLCA ​​module; The SA_MLCA_Bottleneck module introduces the SAConv convolution kernel and the MLCA fusion hybrid local channel attention module to improve the feature extraction capability; the SAConv convolution kernel uses different hole rates to convolve the feature map to capture the contextual information of the feature map at multiple scales and improve the feature extraction capability; the MLCA fusion hybrid local channel attention module first uses local average pooling to extract the feature information of the local area, then uses global average pooling to extract the global feature information, then uses the Conv1d convolution kernel to compress the channel of the feature map for feature conversion, and finally uses the local feature vector after feature conversion and the global feature vector after feature conversion for feature fusion, thereby enhancing the interaction between the information expressed by the overall image and the local targets in the image during the feature extraction process, improving the ability to understand the targets in the image and the context around the targets, and improving the feature extraction capability; Improve the Neck network of the original YOLOv8x. Specifically, add a small target detection head that processes 160×160 pixel feature maps on the basis of the original three detection heads of YOLOv8x to increase the receptive field of the Neck network detection. Design a C2f_WT_SCSA module to replace the C2f module in the original Neck network; The network structure of the C2f_WT_SCSA module includes a first CBS module, a segmentation module, three WT_SCSA_Bottleneck modules connected in series, and a second CBS module, which are connected according to the residual network structure; When the feature map is input into the C2f_WT_SCSA module, the first CBS module divides the number of channels into two branches for processing; the first branch passes through the segmentation module and three WT_SCSA_Bottleneck modules connected in series, and saves the feature map processed by each module at the same time; the second branch is combined with the feature map processed by each module, and the feature map after the two branches are combined and calculated is input into the second CBS module, and then output to the C2f_WT_SCSA module; The WT_SCSA_Bottleneck module introduces the WTConv convolution kernel and the SCSA fusion space and channel collaborative attention module to enhance the feature representation capability of the feature map; The WTConv convolution kernel adds a cascade wavelet decomposition network layer in the process of convolution of the feature map, sets different frequency bandwidths from low to high, performs convolution in the frequency bandwidths respectively, and finally obtains the convolved feature map by inverse wavelet transform, so as to ensure that low-frequency information will not be lost in the convolution process, enhance the feature representation of low-frequency signals in the feature map, and improve the possibility of detecting local small targets; the SCSA fusion space and channel collaborative attention module first uses multi-scale Conv1d convolution inside to capture the spatial information of the feature map at different scales, and obtains multi-scale sub-feature vectors; normalizes the multi-scale sub-feature vectors to obtain an attention feature map containing spatial information, and then calculates the similarity between the information of each channel according to different channels of the attention feature map containing spatial information using a single-head self-attention mechanism; the SCSA fusion space and channel collaborative attention module considers both the spatial information and the channel information of the feature map during the feature fusion process, and enhances the feature representation capability of the feature map; The trained improved YOLOv8x model is used for PCB small target defect detection.

2. According to a PCB small target defect detection method based on improved YOLOv8x according to claim 1, it is characterized in that: The SA_MLCA_Bottleneck module includes a 3×3 CBS module, a 3×3 SA_B_S module and an MLCA fusion hybrid local channel attention module, which are connected according to the residual network structure; When the feature map is input into the SA_MLCA_Bottleneck module, the number of channels is divided into two branches for processing. The first branch is processed by the 3×3 CBS module, the 3×3 SA_B_S module, and the MLCA fusion hybrid local channel attention module in sequence. The first branch is processed by the MLCA fusion hybrid local channel attention module and then merged with the second branch. The CBS module includes a standard Conv2d convolution kernel, a standard BatchNorm2d batch normalization module and a standard SiLU activation function; The SA_B_S module replaces the standard Conv2d convolution kernel in the CBS module with the SAConv convolution kernel.

3. According to a PCB small target defect detection method based on improved YOLOv8x according to claim 2, it is characterized in that: The WT_SCSA_Bottleneck module includes a 3×3 CBS module, a 3×3 WT_B_S module, and an SCSA fusion space and channel collaborative attention module, which are connected according to the residual network structure; The CBS module has the same network structure as the CBS module in the Backbone network; The WT_B_S module replaces the standard Conv2d convolution kernel in the CBS module with the WTConv convolution kernel.

Citation Information

Patent Citations

  • Detection and identification method for electronic component

    CN118736303A

  • Power field operation specification detection method based on improved YOLOv8 algorithm

    CN118736307A

  • Defect detection method for vibration damper of power transmission line

    CN118918072A

  • Infrared weak and small target detection method based on improved YOLO v8

    CN118982658A

  • PCB defect detection method and system based on YOLOv8 network

    CN119130935A

Cited By

  • Shaving board surface multi-scale defect detection method, equipment, medium and product

    CN120013946A

  • Wafer defect detection method, wafer defect detection device, wafer defect detection equipment and storage medium

    CN120259243A

  • Underwater target identification method based on improved YOLOv8 algorithm

    CN120356084A

  • PCB welding spot detection method and system based on collaborative attention fusion

    CN120580512A

  • Wild animal intelligent monitoring device and method based on multi-modal fusion and ad hoc network

    CN120876978A