PCB defect intelligent detection system and method based on image recognition
By using multifocal heterogeneous image fusion and structural gradient residual modeling, the problem of inaccurate PCB defect identification in existing technologies is solved, and high-precision defect detection is achieved.
Patent Information
- Application Number
- CN202510779903.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-06-12
AI Technical Summary
Existing technologies struggle to accurately identify structural defects on PCB surfaces, such as solder bridging and broken wires, leading to missed detections and inaccurate identification of minor defects.
A multi-focal, heterogeneous layer image fusion unit is used to spatially align and fuse layers of PCB images. Combining the YOLOv8 backbone network and BiFPN feature pyramid structure, a circuit structure template guidance mechanism and a structural gradient residual modeling method are introduced to construct a structural offset response feature map for defect target localization and classification.
It significantly improves the accuracy of identifying structural defects such as PCB pads and circuit traces, and reduces the false detection and false negative rates of structural anomalies such as solder bridging and broken wires.
Smart Images

Figure CN120689582B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of PCB defect detection technology, and specifically to an intelligent PCB defect detection system and method based on image recognition. Background Technology
[0002] In the modern electronics manufacturing industry, printed circuit boards (PCBs) serve as a key platform for electronic components, and their manufacturing quality directly determines the reliability and stability of electronic products. PCB surfaces typically contain numerous pads, circuit traces, and tiny components. During processes such as etching, silkscreening, surface mount technology (SMT), and reflow soldering, PCBs are highly susceptible to microstructural defects such as solder bridging, cold solder joints, and open circuits. To ensure product quality, more and more manufacturers are introducing intelligent detection technologies based on image recognition, using computer vision algorithms to quickly identify, locate, and classify PCB defects. In recent years, with the widespread application of deep image learning models (especially the YOLO series models) in the field of target detection, related algorithms have gradually replaced traditional template matching and image differencing methods, becoming the mainstream PCB defect detection technology.
[0003] While various image recognition-based PCB defect detection technologies have been proposed, a series of technical shortcomings and detection blind spots still exist in practical applications. For example, although existing technologies CN118261881B and CN116912237B both introduce standard design drawing comparison mechanisms, they fail to establish explicit structural offset modeling between image features and circuit structure, making it difficult to identify structural defects such as pad misalignment and solder bridging. Furthermore, while existing technologies CN118691577A and CN118691574A improve small defect detection capabilities by optimizing the YOLO network structure, they neglect the issue of image quality differences, making it difficult to address the issues of missed small defects and weakened structural edges caused by focus shift or local blurring. These technical shortcomings of the four existing technologies lead to difficulties in accurately identifying structural defects such as solder bridging and broken wires, resulting in missed small defects and inaccurate identification of solder bridging and broken structural defects. Summary of the Invention
[0004] The purpose of this invention is to provide an intelligent PCB defect detection system and method based on image recognition, so as to solve the problem mentioned in the background art that it is difficult to accurately identify structural defects such as solder bridging and broken wires, which leads to missed detection of small defects and inaccurate identification of structural defects such as solder bridging and broken wires.
[0005] To achieve the above objectives, the present invention aims to provide an intelligent PCB defect detection system based on image recognition, comprising:
[0006] The multi-focal image fusion unit acquires the original image data of the PCB under test under multiple focal planes, and performs spatial alignment, focal domain division and layer fusion reconstruction processing on the original image data under multiple focal planes to finally generate a multi-focal fused image.
[0007] The image feature extraction and fusion unit is based on multi-focal fused images. It uses the YOLOv8 backbone network for feature extraction, combines the BiFPN feature pyramid structure for multi-scale semantic fusion, and introduces a circuit structure template guidance mechanism and a structural gradient residual modeling method to construct a structural offset response feature map.
[0008] The defect target localization and classification unit is based on the YOLOv8 multi-scale decoupled detection head structure. It performs spatial location regression and category classification judgment of the defect target on the structural offset response feature map to obtain a set of target defect prediction boxes.
[0009] The defect result output analysis unit filters, merges, and sorts the target defect prediction box set to obtain the final PCB defect detection result.
[0010] Preferably, the multi-focus heterogeneous image fusion unit includes a multi-focus image acquisition module and an image spatial alignment module;
[0011] Among them, the multi-focal image acquisition module is used to acquire images of the same PCB circuit board under multiple different focal planes and obtain the original image data under multiple focal planes;
[0012] The image spatial alignment module uses an image edge feature registration algorithm to perform translation, rotation, and scale normalization correction on the original image data under multiple focal planes to obtain a multi-focal plane image.
[0013] Preferably, the multi-focal heterogeneous layer image fusion unit includes a focal domain division module, which is used to divide the multi-focal plane image into layers, specifically including:
[0014] An image sharpness evaluation function is used to score the local sharpness of each pixel region in a multifocal plane image to obtain the focal sharpness score of the multifocal plane image. The multifocal plane image is then divided into an optimal focus layer and a suboptimal focus layer according to the region to construct a focal layer.
[0015] The sharpness evaluation function includes the Laplacian gradient function and the Tenengrad contrast function.
[0016] Preferably, the multi-focal, heterogeneous-layer image fusion unit further includes a layer fusion and reconstruction module, which is used to perform weighted fusion of the focal zone layers, as follows:
[0017] Based on the focal sharpness score of the multi-focal plane image, the maximum focal sharpness score is selected for each pixel position in the focal plane layer and weighted and fused to finally obtain the multi-focal fused image.
[0018] Preferably, the image feature extraction and fusion unit includes a backbone feature extraction and fusion module. The backbone feature extraction and fusion module uses the YOLOv8 backbone network structure to perform convolutional feature extraction on the multi-focal fused image to obtain multi-scale feature maps, and uses the BiFPN feature pyramid structure to perform bidirectional fusion of the multi-scale feature maps.
[0019] The YOLOv8 backbone network structure includes multiple residual connection convolutional units and feature extraction channel blocks. The feature extraction channel blocks include CBS modules and S-Bottleneck modules, which sequentially extract shallow texture features, mid-level structural features and deep semantic features of multi-focal fusion images, and output multi-scale feature maps.
[0020] The BiFPN feature pyramid structure includes upsampling and downsampling paths, and uses a weighted fusion method to perform feature crossing of multi-scale feature maps at different levels.
[0021] Preferably, the image feature extraction and fusion unit includes a structure template guidance module, which uses a structure template guidance mechanism to process the Gerber structure diagram of the PCB circuit design and construct a multi-scale structure template diagram that matches the resolution of the multi-scale feature map.
[0022] The structure template guidance mechanism performs image rasterization, affine transformation, interpolation scaling, and channel rearrangement operations on the Gerber structure diagram.
[0023] Preferably, the image feature extraction and fusion unit includes a residual fusion module. This module uses the Scharr operator and a structural gradient residual modeling method to calculate image gradients on the multi-scale feature map and the multi-scale structural template map, extracting image gradient maps from both. It then calculates the structural gradient residual maps at each scale using a pixel-by-pixel interpolation method. The structural gradient residual maps are input into the channel attention mechanism (SE) structure to generate saliency response weight maps for each channel dimension. The multi-scale feature map and the saliency response weight maps are then fused channel-by-channel to obtain a structure-enhanced multi-scale feature map. Finally, scale alignment and concatenation operations are performed on the structure-enhanced multi-scale feature maps at each scale to generate a structural offset response feature map.
[0024] Preferably, the defect target localization and classification unit is constructed based on the YOLOv8 multi-scale decoupled detection head structure, including a location regression branch and a category classification branch, which respectively predict the target bounding box and determine the defect type for different scale feature regions in the structural offset response feature map, and output a set of target prediction boxes containing location information, confidence level and defect category label.
[0025] Preferably, the defect result output analysis unit is used to receive the target prediction box set, and to perform confidence filtering, overlapping redundant box suppression and defect priority sorting on it to obtain the final PCB defect detection result.
[0026] On the other hand, the present invention provides an image recognition-based intelligent PCB defect detection method for use in the image recognition-based intelligent PCB defect detection system described above, comprising the following steps:
[0027] S10.1 Obtain the original image data of the PCB image under test under multiple focal planes, and perform spatial alignment, focal domain division and layer fusion reconstruction on the original image data under multiple focal planes to finally generate a multi-focal fused image.
[0028] S10.2 Based on multi-focal fusion images, YOLOv8 backbone network is used for feature extraction, combined with BiFPN feature pyramid structure for multi-scale semantic fusion, and circuit structure template guidance mechanism and structural gradient residual modeling method are introduced to construct structural offset response feature map.
[0029] S10.3 Based on the YOLOv8 multi-scale decoupled detection head structure, the spatial location regression and category classification of the defect target are performed on the structural offset response feature map to obtain the target defect prediction box set;
[0030] S10.4 Filter, merge and sort the target defect prediction box set to obtain the final PCB defect detection result.
[0031] Compared with the prior art, the above-mentioned technical solution of the present invention has the following beneficial technical effects:
[0032] 1. In this invention, spatial alignment and layer reconstruction processing are performed on images of different focal planes based on multi-focal heterogeneous layer image fusion, which improves the clarity and contrast of key defect areas in the image and enhances the ability of the subsequent feature extraction module to perceive blurred areas and focus offset areas.
[0033] 2. In this invention, by introducing a circuit structure template guidance mechanism and a structural gradient residual modeling method to construct a structural offset response feature map, high-precision identification and offset detection of structural defects such as PCB pads and circuit traces are achieved, significantly reducing the false detection and false negative rates of structural anomalies such as solder bridging and broken wires. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of one embodiment of the present invention;
[0035] Figure labels: 1. Multifocal image fusion unit; 11. Multifocal image acquisition module; 12. Image spatial alignment module; 13. Focal domain division module; 14. Layer fusion and reconstruction module; 2. Image feature extraction and fusion unit; 21. Main feature extraction and fusion module; 22. Structural template guidance module; 23. Residual fusion module; 3. Defect target localization and classification unit; 4. Defect result output and analysis unit. Detailed Implementation
[0036] Example 1, as Figure 1 As shown, an image recognition-based intelligent PCB defect detection system is provided, comprising:
[0037] Multi-focal image fusion unit 1 acquires the original image data of the PCB image under test under multiple focal planes, and performs spatial alignment, focal domain division and layer fusion reconstruction processing on the original image data under multiple focal planes to finally generate a multi-focal fused image.
[0038] In this embodiment, the multifocal heterogeneous image fusion unit 1 includes a multifocal image acquisition module 11 and an image spatial alignment module 12;
[0039] Among them, the multi-focal image acquisition module 11 is used to acquire images of the same PCB circuit board under multiple different focal planes and obtain the original image data under multiple focal planes;
[0040] The image spatial alignment module 12 performs translation, rotation, and scale normalization correction on the original image data under multiple focal planes using an image edge feature registration algorithm to obtain a multi-focal plane image.
[0041] In this embodiment, the multifocal image acquisition module 11 and the image spatial alignment module 12 are used to acquire multiple images of the same PCB circuit board under different focal planes, and to perform spatial alignment processing on the multifocal images to obtain a clear and consistent set of multifocal plane images.
[0042] Specifically, the multi-focal image acquisition module 11 uses an industrial camera component with automatic Z-axis focusing function to perform layer-by-layer scanning imaging on the same PCB circuit board surface; the scanning process acquires original images layer by layer along the optical axis at a certain focal length interval Δz = 50μm to construct a focal length sequence; each image corresponds to a specific focal depth layer on the PCB surface, and the size of each image is uniformly set to 600×600 pixels.
[0043] After acquiring all focal plane images, the image spatial alignment module 12 performs spatial registration and correction on the original images. It uses the SURF algorithm based on image edge feature points to extract key edge points of the images, and combines the RANSAC robust estimation method to perform image pairing and matching, correcting spatial deviations such as translation, rotation, and affine distortion between multiple images. The spatially aligned images are all uniformly mapped to the standard reference coordinate system to complete scale normalization.
[0044] The above image registration process can significantly reduce the problem of image overlap area offset caused by PCB component thickness differences, board warping, camera posture errors, etc., and ensure that each pixel corresponds to the same physical position in the subsequent layer fusion steps.
[0045] In this embodiment, the multi-focal heterogeneous layer image fusion unit 1 includes a focal domain division module 13, which is used to divide the multi-focal plane image into layers, specifically including:
[0046] An image sharpness evaluation function is used to score the local sharpness of each pixel region in a multifocal plane image to obtain the focal sharpness score of the multifocal plane image. The multifocal plane image is then divided into an optimal focus layer and a suboptimal focus layer according to the region to construct a focal layer.
[0047] The sharpness evaluation function includes the Laplacian gradient function and the Tenengrad contrast function.
[0048] In this embodiment, the focal domain segmentation module 13 receives a multi-focal image sequence that has been corrected by the image spatial alignment module 12. It scores the sharpness of local window regions in each image, using 32×32 pixels as units. The scoring method uses a combination of the Laplacian gradient function and the Tenengrad contrast function to evaluate the edge sharpness and detail response intensity of each local region. The Laplacian function is used to calculate the second derivative response of the image; sharp images produce larger response values at the edges. The Tenengrad function, based on the Sobel gradient norm, calculates the mean or variance of the gradient magnitude in each window as a region sharpness index. For regions at the same location in all image sequences, the focal domain segmentation module 13 compares their sharpness scores, selecting the image with the highest sharpness score as the optimal focus layer for that region, the image with the second highest score as the second-best focus layer, and the rest as supplementary layers. Finally, each focal domain layer is a spatial layer at the same resolution, possessing spatial consistency, thus forming a focal domain layer structure.
[0049] In this embodiment, the multi-focal layer image fusion unit 1 further includes a layer fusion and reconstruction module 14, which is used to perform weighted fusion of the focal zone layers, as follows:
[0050] Based on the focal sharpness score of the multi-focal plane image, the maximum focal sharpness score is selected for each pixel position in the focal plane layer and weighted and fused to finally obtain the multi-focal fused image.
[0051] In this embodiment, the layer fusion and reconstruction module 14 receives a set of focal plane layers constructed from multiple multi-focal plane images. Each layer records the local focus quality of the image on a certain focal plane and has completed pixel alignment in space. Based on the focal sharpness score of each layer in the previous step, at each pixel coordinate position, the sharpness score value of the corresponding position in all layers is traversed, and the pixel value of the layer with the highest sharpness score is selected as the fusion result at that position. This process is equivalent to performing a maximum sharpness-driven layer selection operation at each pixel. The final output multi-focal fusion image retains the sharpest local area in each focal layer, and has high overall image sharpness, high contrast and edge detail integrity, providing a more discriminative image foundation for the subsequent feature extraction module. The layer fusion and reconstruction module 14 improves the image perception quality of small defects, blurred boundaries and focus misalignment areas, and overcomes the limitations of traditional single-focal plane images in terms of spatial consistency and information integrity.
[0052] Image feature extraction and fusion unit 2 is based on multi-focal fused images. It uses the YOLOv8 backbone network for feature extraction, combines the BiFPN feature pyramid structure for multi-scale semantic fusion, and introduces a circuit structure template guidance mechanism and a structural gradient residual modeling method to construct a structural offset response feature map.
[0053] In this embodiment, the image feature extraction and fusion unit 2 includes a backbone feature extraction and fusion module 21. The backbone feature extraction and fusion module 21 uses the YOLOv8 backbone network structure to perform convolutional feature extraction on the multi-focal fused image to obtain multi-scale feature maps, and uses the BiFPN feature pyramid structure to perform bidirectional fusion on the multi-scale feature maps.
[0054] The YOLOv8 backbone network structure includes multiple residual connection convolutional units and feature extraction channel blocks. The feature extraction channel blocks include CBS modules and S-Bottleneck modules, which sequentially extract shallow texture features, mid-level structural features and deep semantic features of multi-focal fusion images, and output multi-scale feature maps.
[0055] The BiFPN feature pyramid structure includes upsampling and downsampling paths, and uses a weighted fusion method to perform feature crossing of multi-scale feature maps at different levels.
[0056] In this embodiment, the multifocal fused image is input into the YOLOv8 backbone network structure for hierarchical convolutional processing. The backbone network is configured with multiple residual connection convolutional units and feature extraction channel blocks. The channel blocks integrate two types of core modules: CBS modules and S-Bottleneck modules.
[0057] The CBS module, composed of convolutional layers (Conv), batch normalization (BatchNorm), and the SiLU activation function, is used for rapid extraction of texture and local edge features. The S-Bottleneck module, used to compress channel information and enhance the network's nonlinear expressive power, is a lightweight bottleneck structure that maintains accuracy while reducing parameters. After multi-level extraction by the backbone network, a multi-scale feature map set is output, representing shallow texture features, mid-level structural features, and deep semantic features. This multi-scale feature map set is then input into the BiFPN structure for feature fusion. BiFPN employs a bidirectional fusion path, both top-down and bottom-up, utilizing a weighted feature fusion mechanism to cross information across different scales. BiFPN assigns trainable weights to each input feature map and uses a normalization strategy to ensure fusion stability. The top-down path of the BiFPN structure guides deep semantics to complete the shallow structure. The bottom-up path of the BiFPN structure passes detailed features to deeper layers to enhance semantic perception.
[0058] In this embodiment, the image feature extraction and fusion unit 2 includes a structure template guidance module 22. The structure template guidance module 22 uses a structure template guidance mechanism to process the Gerber structure diagram of the PCB circuit design and construct a multi-scale structure template diagram that matches the resolution of the multi-scale feature map.
[0059] The structure template guidance mechanism performs image rasterization, affine transformation, interpolation scaling, and channel rearrangement operations on the Gerber structure diagram.
[0060] In this embodiment, the Gerber structure diagram of the PCB circuit design is obtained and processed as follows: First, the circuit structure diagram is extracted from the Gerber file of the PCB circuit. The Gerber file is a standard PCB circuit manufacturing drawing format, containing information such as pads, traces, vias, and inter-layer connections. Since this structure diagram is in vector format, it is not suitable for direct pixel-level comparison with convolutional neural network feature maps. Therefore, the following steps of structure template processing are required: The Gerber structure diagram of the PCB circuit design is processed using a structure template guidance mechanism: image rasterization processing converts the vector form Gerber structure diagram into a fixed-resolution two-dimensional image. The process involves several steps: First, a pixel-based image is generated to create an original structural template image. This image maintains the same aspect ratio and reference coordinate origin as the input image to ensure structural alignment. Second, an affine transformation is performed on the original structural template image, considering potential positional drift, rotation, or slight tilting in PCB images during actual inspection. This transformation includes translation correction, rotation alignment, size scaling, and tilt correction. Third, scale matching and channel rearrangement are applied to the transformed standard structural image using interpolation scaling to generate a structural template image set that matches the size of the multi-scale feature maps output by the YOLOv8 backbone network. Finally, at each scale, bilinear interpolation is used to downsample the standard structural image to ensure its spatial dimensions and features are aligned. Figure 1 To enhance the collaborative learning ability of convolutional features and structural information, channel expansion and rearrangement operations are performed on the structure map to expand the single-channel structure map into a pseudo-RGB format consistent with the feature map channels, and finally output a multi-scale structure template map.
[0061] In this embodiment, the image feature extraction and fusion unit 2 includes a residual fusion module 23. The residual fusion module 23 uses the Scharr operator and a structural gradient residual modeling method to calculate image gradients on the multi-scale feature map and the multi-scale structural template map, and extracts the image gradient maps of the multi-scale feature map and the multi-scale structural template map respectively; it calculates the structural gradient residual map at each scale using a pixel-by-pixel difference calculation method; it inputs the structural gradient residual map into the channel attention mechanism (SE) structure to generate a saliency response weight map of the channel dimension; it performs channel-by-channel weighted fusion of the multi-scale feature map and the saliency response weight map to obtain a structure-enhanced multi-scale feature map; it performs scale alignment and concatenation operations on the structure-enhanced multi-scale feature maps at each scale of the structure-enhanced multi-scale feature map, and finally generates a structural offset response feature map.
[0062] In this embodiment, the Scharr operator is used to extract image gradients from both multi-scale feature maps and multi-scale structural template maps. Compared to the traditional Sobel operator, the Scharr operator exhibits stronger rotation invariance and better noise robustness in edge direction extraction, making it suitable for high-precision defect edge localization. For each scale, a structural gradient residual map is calculated. This residual map reflects the edge offset and intensity difference between the actual circuit features and the design template at the current scale, thereby focusing on minor structural defects such as structural misalignment, bridging, and breakage. Each structural gradient residual map is input into the SE channel attention mechanism structure to extract response weights between feature channels. This includes a Squeeze stage that performs global average pooling on the structural gradient residual map in the spatial dimension to generate channel description vectors; an Excitation stage that generates weight vectors based on the channel description vectors through two fully connected layers and an activation function; and the channel weights generated by the SE channel attention mechanism structure are applied to the corresponding scale feature maps for channel-by-channel weighting. After unifying the spatial dimensions of the structural enhancement feature maps at all scales, a concatenation operation is performed in the channel dimension to obtain the final output structural offset response feature map.
[0063] Defect target localization and classification unit 3 is based on the YOLOv8 multi-scale decoupled detection head structure. It performs spatial location regression and category classification judgment of defect targets on the structural offset response feature map to obtain a set of target defect prediction boxes.
[0064] In this embodiment, the defect target localization and classification unit 3 is constructed based on the multi-scale decoupled detection head structure of YOLOv8, including a location regression branch and a category classification branch. It performs target bounding box prediction and defect type judgment on feature regions of different scales in the structural offset response feature map, and outputs a set of target prediction boxes containing location information, confidence level and defect category label.
[0065] In this embodiment, the YOLOv8-based multi-scale decoupled detection head structure consists of three decoupled detection heads at different scales, corresponding to shallow texture features, mid-level structural features, and deep semantic features, respectively. Each of the three decoupled detections consists of two parts: a location regression branch and a category classification branch. Each branch is constructed by stacking convolutional layers, BatchNorm, and SiLU activation functions. The convolutional kernel sizes are alternately set at 1×1 and 3×3 to control the balance between receptive field and detection accuracy.
[0066] Defect Result Output Analysis Unit 4 filters, merges, and sorts the target defect prediction box set to obtain the final PCB defect detection result.
[0067] In this embodiment, the defect result output analysis unit 4 is used to receive the target prediction box set, and to perform confidence filtering, overlapping redundant box suppression and defect priority sorting on it to obtain the final PCB defect detection result.
[0068] In this embodiment, confidence screening, overlapping redundant boxes suppression, and defect priority ranking are performed as follows: A confidence threshold is set, and all target prediction boxes with a confidence level greater than the threshold are retained, while low-confidence detection results are removed; For redundant candidate boxes of the same category, the IoU between them and the highest-scoring box is calculated, and if the IoU > 0.5, it is suppressed, retaining the candidate box with the highest confidence; Combining the structural offset score extracted from the structural gradient residual modeling module, pixel-level accumulation calculations are performed within each target box region to quantify its structural offset intensity, and finally, priority ranking is performed based on a weighted comprehensive index of score value and confidence level.
[0069] Example 2: This invention proposes an intelligent PCB defect detection method based on image recognition, used in the intelligent PCB defect detection system based on image recognition described in Example 1 above, comprising the following steps:
[0070] S10.1 Obtain the original image data of the PCB image under test under multiple focal planes, and perform spatial alignment, focal domain division and layer fusion reconstruction on the original image data under multiple focal planes to finally generate a multi-focal fused image.
[0071] S10.2 Based on multi-focal fusion images, YOLOv8 backbone network is used for feature extraction, combined with BiFPN feature pyramid structure for multi-scale semantic fusion, and circuit structure template guidance mechanism and structural gradient residual modeling method are introduced to construct structural offset response feature map.
[0072] S10.3 Based on the YOLOv8 multi-scale decoupled detection head structure, the spatial location regression and category classification of the defect target are performed on the structural offset response feature map to obtain the target defect prediction box set;
[0073] S10.4 Filter, merge and sort the target defect prediction box set to obtain the final PCB defect detection result.
[0074] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited thereto. Various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention.
Claims
1. A PCB defect intelligent detection system based on image recognition, characterized in that, include: Multi-focal image fusion unit (1) acquires the original image data of the PCB image under test under multiple focal planes, and performs spatial alignment, focal domain division and layer fusion reconstruction processing on the original image data under multiple focal planes to finally generate a multi-focal fused image. Image feature extraction and fusion unit (2) is based on multi-focus fused image, uses YOLOv8 backbone network for feature extraction, combines BiFPN feature pyramid structure for multi-scale semantic fusion, and introduces circuit structure template guidance mechanism and structural gradient residual modeling method to construct structural offset response feature map; The defect target localization and classification unit (3) is based on the YOLOv8 multi-scale decoupled detection Head structure. It performs spatial location regression and category classification judgment on the structural offset response feature map to obtain the target defect prediction box set. The defect result output analysis unit (4) filters, merges and sorts the target defect prediction box set to obtain the final PCB defect detection result.
2. The intelligent PCB defect detection system based on image recognition according to claim 1, characterized in that, The multi-focus heterogeneous image fusion unit (1) includes a multi-focus image acquisition module (11) and an image space alignment module (12); Among them, the multi-focal image acquisition module (11) is used to acquire images of the same PCB circuit board under multiple different focal planes and obtain the original image data under multiple focal planes; The image spatial alignment module (12) performs translation, rotation and scale normalization correction on the original image data under multiple focal planes using an image edge feature registration algorithm to obtain a multi-focal plane image.
3. The intelligent PCB defect detection system based on image recognition according to claim 2, characterized in that, The multi-focal heterogeneous layer image fusion unit (1) includes a focal domain division module (13), which is used to divide the multi-focal plane image into layers, specifically including: An image sharpness evaluation function is used to score the local sharpness of each pixel region in a multifocal plane image to obtain the focal sharpness score of the multifocal plane image. The multifocal plane image is then divided into an optimal focus layer and a suboptimal focus layer according to the region to construct a focal layer. The sharpness evaluation function includes the Laplacian gradient function and the Tenengrad contrast function.
4. The intelligent PCB defect detection system based on image recognition according to claim 3, characterized in that, The multi-focal, heterogeneous layer image fusion unit (1) further includes a layer fusion and reconstruction module (14), which is used to perform weighted fusion of the focal zone layers, as follows: Based on the focal sharpness score of the multi-focal plane image, the maximum focal sharpness score is selected for each pixel position in the focal plane layer and weighted and fused to finally obtain the multi-focal fused image.
5. The intelligent PCB defect detection system based on image recognition according to claim 4, characterized in that, The image feature extraction and fusion unit (2) includes a backbone feature extraction and fusion module (21). The backbone feature extraction and fusion module (21) uses the YOLOv8 backbone network structure to perform convolutional feature extraction on the multi-focus fused image to obtain multi-scale feature maps, and uses the BiFPN feature pyramid structure to perform bidirectional fusion on the multi-scale feature maps. The YOLOv8 backbone network structure includes multiple residual connection convolutional units and feature extraction channel blocks. The feature extraction channel blocks include CBS modules and S-Bottleneck modules, which sequentially extract shallow texture features, mid-level structural features and deep semantic features of multi-focal fusion images, and output multi-scale feature maps. The BiFPN feature pyramid structure includes upsampling and downsampling paths, and uses a weighted fusion method to perform feature crossing of multi-scale feature maps at different levels.
6. The intelligent PCB defect detection system based on image recognition according to claim 5, characterized in that, The image feature extraction and fusion unit (2) includes a structure template guidance module (22). The structure template guidance module (22) uses a structure template guidance mechanism to process the Gerber structure diagram of the PCB circuit design and construct a multi-scale structure template diagram that matches the resolution of the multi-scale feature diagram. The structure template guidance mechanism performs image rasterization, affine transformation, interpolation scaling, and channel rearrangement operations on the Gerber structure diagram.
7. The intelligent PCB defect detection system based on image recognition according to claim 6, characterized in that, The image feature extraction and fusion unit (2) includes a residual fusion module (23). The residual fusion module (23) uses the Scharr operator to perform image gradient calculation on the multi-scale feature map and the multi-scale structural template map, and extracts the image gradient maps of the multi-scale feature map and the multi-scale structural template map respectively. The structural gradient residual map at each scale is calculated using a pixel-by-pixel interpolation method; the structural gradient residual map is input into the channel attention mechanism (SE) structure to generate a saliency response weight map in the channel dimension; the multi-scale feature map and the saliency response weight map are then fused through a channel-by-channel weighted fusion to obtain a structure-enhanced multi-scale feature map. Scale alignment and concatenation operations are performed on the structural augmentation multi-scale feature maps at each scale to finally generate the structural offset response feature map.
8. The intelligent PCB defect detection system based on image recognition according to claim 7, characterized in that, The defect target localization and classification unit (3) is constructed based on the multi-scale decoupled detection head structure of YOLOv8, including the location regression branch and the category classification branch. It performs target bounding box prediction and defect type judgment on different scale feature regions in the structural offset response feature map, and outputs a set of target prediction boxes containing location information, confidence and defect category labels.
9. The intelligent PCB defect detection system based on image recognition according to claim 8, characterized in that, The defect result output analysis unit (4) is used to receive the target prediction box set, and to perform confidence screening, overlapping redundant box suppression and defect priority sorting on it to obtain the final PCB defect detection result.
10. A method for intelligent PCB defect detection based on image recognition, used in the intelligent PCB defect detection system based on image recognition as described in any one of claims 1-9, characterized in that: Includes the following steps: S10.1 Obtain the original image data of the PCB image under test under multiple focal planes, and perform spatial alignment, focal domain division and layer fusion reconstruction on the original image data under multiple focal planes to finally generate a multi-focal fused image. S10.2 Based on multi-focal fusion images, YOLOv8 backbone network is used for feature extraction, combined with BiFPN feature pyramid structure for multi-scale semantic fusion, and circuit structure template guidance mechanism and structural gradient residual modeling method are introduced to construct structural offset response feature map. S10.3 Based on the YOLOv8 multi-scale decoupled detection head structure, the spatial location regression and category classification of the defect target are performed on the structural offset response feature map to obtain the target defect prediction box set; S10.4 Filter, merge and sort the target defect prediction box set to obtain the final PCB defect detection result.
Citation Information
Patent Citations
A method and system for detecting defects in printed circuit boards based on image recognition
CN116912237B
PCB circuit board defect detection method and system
CN118261881B
PCB small target defect detection method and system
CN118691574A
PCB small target defect detection optimization method based on YOLOv8s
CN118691577A
PCB defect detection method based on improved YOLOv5 and storage medium
CN116245817A