PCB defect intelligent detection system and method based on image recognition
Through the method of multi-focus heterogeneous image fusion and structural gradient residual modeling, the problem of inaccurate identification of structural defects such as bridging tin and broken wires in PCB defect detection is solved, and high-precision PCB defect detection is achieved.
Patent Information
- Application Number
- CN202510779903.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-06-12
AI Technical Summary
Existing technologies have difficulty in accurately identifying structural defects such as solder joints and broken wires in PCB defect detection, resulting in missed detection of small defects and inaccurate identification.
A multi-focus, heterogeneous image fusion unit is used to obtain the original image data of the PCB image in multiple focal planes. Through image spatial alignment and layer fusion reconstruction, combined with the YOLOv8 backbone network and the BiFPN feature pyramid structure, the circuit structure template guidance mechanism and structural gradient residual modeling are introduced to construct the structural offset response feature map for defect location and classification.
It significantly improves the clarity and contrast of key defect areas in PCB images, enhances the perception of blurred areas and focus-shifted areas, achieves high-precision identification of structural defects such as PCB pads and circuit traces, and reduces the false detection and missed detection rates of structural anomalies such as bridging solder joints and broken wires.
Smart Images

Figure CN120689582A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PCB defect detection, and in particular to an intelligent PCB defect detection system and method based on image recognition. Background Art
[0002] In modern electronics manufacturing, printed circuit boards (PCBs) serve as a critical platform for electronic components. Their manufacturing quality directly determines the reliability and stability of electronic products. PCB surfaces are typically covered with numerous pads, circuit traces, and tiny components. During processes like etching, screen printing, SMT, and reflow soldering, these surfaces are prone to minor structural defects such as solder joints, cold solder joints, and open circuits. To ensure product quality, an increasing number of manufacturers are introducing intelligent detection technologies based on image recognition, using computer vision algorithms to rapidly identify, locate, and classify PCB defects. In recent years, with the widespread application of deep image learning models (especially the YOLO series of models) in target detection, these algorithms have gradually replaced traditional template comparison and image difference methods, becoming the mainstream PCB defect detection technology.
[0003] Currently, a variety of PCB defect detection technology solutions based on image recognition have been proposed, but there are still a series of technical defects and detection blind spots in actual applications; for example, although the existing technologies CN118261881B and CN116912237B both introduce a standard design drawing comparison mechanism, they do not establish an explicit structural offset modeling between image features and circuit structures, making it difficult to identify structural defects such as pad misalignment and tin bridging and broken wires; for another example, although the existing technologies CN118691577A and CN118691574A improve the small defect detection capability by optimizing the YOLO network structure, they ignore the problem of image imaging quality differences and find it difficult to deal with the phenomenon of missed detection of small defects and weakened structural edges caused by focus offset or local blur; the technical defects of the above four existing technologies will make it difficult to accurately identify structural defects such as bridging and broken wires, which in turn leads to the problems of missed detection of small defects and inaccurate identification of structural defects such as bridging and broken wires. Summary of the Invention
[0004] The purpose of the present invention is to provide an intelligent PCB defect detection system and method based on image recognition, so as to solve the problem raised in the above background technology that it is difficult to accurately identify structural defects such as bridging and broken wires, which leads to the omission of small defects and inaccurate identification of structural defects such as bridging and broken wires.
[0005] To achieve the above objectives, the present invention provides an intelligent PCB defect detection system based on image recognition, comprising:
[0006] Multi-focus and heterogeneous layer image fusion unit: The multi-focus and heterogeneous layer image fusion unit obtains the original image data of the PCB to be tested under multiple focal planes, and performs spatial alignment, focal area division and layer fusion reconstruction on the original image data under multiple focal planes to finally generate a multi-focus fused image;
[0007] Image feature extraction and fusion unit: Based on multi-focal fusion images, the image feature extraction and fusion unit 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 positioning and classification unit is based on the YOLOv8 multi-scale decoupling detection head structure. It performs spatial position regression and category classification judgment on the structural offset response feature map of the defect target to obtain a set of target defect prediction boxes.
[0009] The defect result output analysis unit screens, merges and sorts the target defect prediction frame 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 space alignment module;
[0011] The multi-focus image acquisition module is used to capture images of the same PCB circuit board at multiple focal planes to obtain the original image data at multiple focal planes.
[0012] The image space alignment module uses an image edge feature-based registration algorithm to perform translation, rotation and scale normalization correction on the original image data under multiple focal planes to obtain multi-focal plane images.
[0013] Preferably, the multi-focus different-layer image fusion unit includes a focal region division module, and the focal region division module is used to divide the multi-focus plane image into layers, specifically including:
[0014] An image clarity evaluation function is used to score the local clarity of each pixel area in the multi-focal plane image to obtain the focal area clarity score of the multi-focal plane image. The multi-focal plane image is then divided into the optimal focus layer and the suboptimal focus layer by region to construct the focal area layer.
[0015] The clarity evaluation function includes a Laplacian gradient function and a Tenengrad contrast function.
[0016] Preferably, the multi-focus heterogeneous layer image fusion unit further includes a layer fusion and reconstruction module, and the layer fusion and reconstruction module is used to perform weighted fusion on the focus area layers, specifically as follows:
[0017] Based on the focus area clarity scores of the multi-focal plane images, the maximum focus area clarity score is selected for each pixel position in the focus area layer for weighted fusion, and finally a multi-focal fusion image is obtained.
[0018] Preferably, the image feature extraction and fusion unit includes a backbone feature extraction and fusion module, which uses a YOLOv8 backbone network structure to perform convolution feature extraction on the multi-focus fusion image to obtain a multi-scale feature map, and uses a BiFPN feature pyramid structure to perform bidirectional fusion on the multi-scale feature map;
[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 the multi-focus fusion image and output multi-scale feature maps.
[0020] The BiFPN feature pyramid structure includes an upsampling path and a downsampling path, and uses a weighted fusion method to cross-feature 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 to construct a multi-scale structure template diagram that matches the resolution of the multi-scale feature diagram;
[0022] The structure template guiding mechanism performs image rasterization processing, 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, which uses a structural gradient residual modeling method based on the Scharr operator to perform image gradient calculation on the multi-scale feature map and the multi-scale structure template map, and extracts the image gradient maps of the multi-scale feature map and the multi-scale structure template map respectively; uses a pixel-by-pixel difference calculation method to calculate the structural gradient residual map at each scale; inputs the structural gradient residual map into the channel attention mechanism SE structure to generate a saliency response weight map of the channel dimension; performs channel-by-channel weighted fusion on the multi-scale feature map and the saliency response weight map to obtain a structurally enhanced multi-scale feature map; performs scale alignment and cascade operations on the structurally enhanced multi-scale feature map at each scale of the structurally enhanced multi-scale feature map, and finally generates a structural offset response feature map.
[0024] Preferably, the defect target positioning and classification unit is constructed based on the multi-scale decoupling detection Head structure of YOLOv8, including a position regression branch and a category classification branch, which respectively perform target bounding box prediction and defect type judgment on different scale feature areas in the structural offset response feature map, and output a target prediction box set containing position information, confidence and defect category labels.
[0025] Preferably, the defect result output analysis unit is used to receive a target prediction frame set, and perform confidence screening, overlapping redundant frame suppression and defect priority sorting on it to obtain the final PCB defect detection result.
[0026] On the other hand, the present invention provides a method for intelligent detection of PCB defects based on image recognition, which is used in the above-mentioned intelligent detection system for PCB defects based on image recognition, comprising the following steps:
[0027] S10.1. Obtaining raw image data of the PCB to be tested image at multiple focal planes, and performing spatial alignment, focal region division, and layer fusion reconstruction on the raw image data at the multiple focal planes to ultimately generate a multi-focus fused image;
[0028] S10.2. Based on multi-focus fusion images, we use the YOLOv8 backbone network for feature extraction, combined with the BiFPN feature pyramid structure for multi-scale semantic fusion, and introduce a circuit structure template guidance mechanism and a structural gradient residual modeling method to construct a structural offset response feature map.
[0029] S10.3. Based on the YOLOv8 multi-scale decoupling detection head structure, the spatial position regression and category classification of the defect target are performed on the structural offset response feature map to obtain a set of target defect prediction frames;
[0030] S10.4. Filter, merge, and sort the target defect prediction frame set to obtain the final PCB defect detection result.
[0031] Compared with the prior art, the above technical solution of the present invention has the following beneficial technical effects:
[0032] 1. In the present invention, spatial alignment and layer reconstruction of images of different focal planes are performed based on multi-focus heterogeneous image fusion, thereby improving the clarity and contrast of key defect areas in the image and enhancing the subsequent feature extraction module's ability to perceive blurred areas and focus offset areas;
[0033] 2. In the present invention, by introducing the circuit structure template guidance mechanism and the structural gradient residual modeling method to construct a structural offset response characteristic map, high-precision identification and offset detection of structural defects such as PCB pads and circuit traces can be achieved, significantly reducing the false detection and missed detection rates of structural anomalies such as bridging and broken wires. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A functional block diagram of an embodiment of the present invention;
[0035] Figure numerals: 1. Multi-focus and heterogeneous image fusion unit; 11. Multi-focus image acquisition module; 12. Image space alignment module; 13. Focal area division module; 14. Layer fusion and reconstruction module; 2. Image feature extraction and fusion unit; 21. Backbone feature extraction and fusion module; 22. Structural template guidance module; 23. Residual fusion module; 3. Defect target positioning and classification unit; 4. Defect result output and analysis unit. DETAILED DESCRIPTION
[0036] Example 1, as Figure 1 As shown, a PCB defect intelligent detection system based on image recognition is provided, comprising:
[0037] The multi-focus and heterogeneous layer image fusion unit 1 obtains the original image data of the PCB to be tested image under multiple focal planes, and performs spatial alignment, focal area division and layer fusion reconstruction processing on the original image data under the multiple focal planes, and finally generates a multi-focus fused image;
[0038] In this embodiment, the multi-focus heterogeneous image fusion unit 1 includes a multi-focus image acquisition module 11 and an image space alignment module 12;
[0039] The multi-focus image acquisition module 11 is used to capture images of the same PCB circuit board at multiple focal planes to obtain original image data at multiple focal planes.
[0040] The image space alignment module 12 uses an image edge feature-based registration algorithm to perform translation, rotation and scale normalization correction on the original image data under multiple focal planes to obtain multi-focal plane images.
[0041] In this embodiment, the multi-focal image acquisition module 11 and the image spatial alignment module 12 are used to acquire multiple images of the same PCB circuit board at different focal planes and perform spatial alignment processing on the multi-focal images to obtain a clear and aligned multi-focal plane image set.
[0042] Specifically, the multi-focus image acquisition module 11 uses an industrial camera assembly with automatic Z-axis focusing function to scan and image the surface of the same PCB layer by layer. This scanning process collects 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 it with 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 uniformly mapped to a 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., ensuring that each pixel in the subsequent layer fusion step corresponds to the same physical position.
[0045] In this embodiment, the multi-focus different-layer image fusion unit 1 includes a focal region division module 13, which is used to divide the multi-focus plane image into layers, specifically including:
[0046] An image clarity evaluation function is used to score the local clarity of each pixel area in the multi-focal plane image to obtain the focal area clarity score of the multi-focal plane image. The multi-focal plane image is then divided into the optimal focus layer and the suboptimal focus layer by region to construct the focal area layer.
[0047] The clarity evaluation function includes a Laplacian gradient function and a Tenengrad contrast function.
[0048] In this embodiment, the focus region division module 13 receives the multi-focus image sequence corrected by the image spatial alignment module 12 and performs clarity scoring on a local window area of 32×32 pixels in each image. The scoring method uses the Laplacian gradient function and the Tenengrad contrast function to jointly evaluate the edge sharpness and detail response intensity of each local area. The Laplacian function is used to calculate the second-order derivative response of the image, and a clear image produces a larger response value at the edge. The Tenengrad function is based on the Sobel gradient norm and calculates the mean or variance of the gradient modulus in each window as a regional clarity indicator. For all regional blocks at the same position in the image sequence, the focus region division module 13 compares their clarity scores and selects the image with the highest clarity score as the optimal focus layer for that area, the image with the second highest score as the suboptimal focus layer, and the remaining images as supplementary layers. Ultimately, each focus region layer is a spatial layer at the same resolution and has spatial consistency, forming a focus region layer structure.
[0049] In this embodiment, the multi-focus heterogeneous layer image fusion unit 1 further includes a layer fusion and reconstruction module 14, which is used to perform weighted fusion on the focus area layers, specifically as follows:
[0050] Based on the focus area clarity scores of the multi-focal plane images, the maximum focus area clarity score is selected for each pixel position in the focus area layer for weighted fusion, and finally a multi-focal fusion image is obtained.
[0051] In this embodiment, the layer fusion and reconstruction module 14 receives a set of focus layers constructed from multiple multi-focal plane images, where 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 focus clarity score of each layer in the previous step, at each pixel coordinate position, the clarity score values of the corresponding positions in all layers are traversed, and the layer pixel value with the largest clarity score is selected as the fusion result at that position. This process is equivalent to performing a maximum clarity-driven layer selection operation at each pixel. The multi-focus fusion image finally output retains the clearest imaging local area in each focal layer, and has high definition, high contrast and edge detail integrity of the entire image, providing a more discriminative image basis for the subsequent feature extraction module. The layer fusion and reconstruction module 14 improves the image perception quality of tiny defects, blurred boundaries and focus misalignment areas, overcoming the limitations of traditional single-focus plane images in spatial consistency and information integrity.
[0052] Image feature extraction and fusion unit 2: Based on multi-focus fusion images, image feature extraction and fusion unit 2 uses the YOLOv8 backbone network for feature extraction, combines the BiFPN feature pyramid structure for multi-scale semantic fusion, and introduces the circuit structure template guidance mechanism and the 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, which uses the YOLOv8 backbone network structure to perform convolution feature extraction on the multi-focus fusion image to obtain a multi-scale feature map, and uses the BiFPN feature pyramid structure to perform bidirectional fusion on the multi-scale feature map;
[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 the multi-focus fusion image and output multi-scale feature maps.
[0055] The BiFPN feature pyramid structure includes an upsampling path and a downsampling path, and uses a weighted fusion method to cross-feature multi-scale feature maps at different levels.
[0056] In this embodiment, the multi-focus fusion image is input into the YOLOv8 backbone network structure for hierarchical convolution processing. The backbone network is equipped with multiple residual connection convolution units and feature extraction channel blocks. The channel blocks integrate two types of core modules: CBS module and S-Bottleneck module:
[0057] The CBS module is composed of a convolutional layer Conv, batch normalization BatchNorm and SiLU activation function, and is used to quickly extract texture and local edge features; the S-Bottleneck module is used to compress channel information and enhance the nonlinear expression ability of the network. It is a lightweight bottleneck structure that can reduce parameters while maintaining accuracy; after the multi-level extraction process of the backbone network, a set of multi-scale feature maps is output, representing shallow texture features, mid-level structural features and deep semantic features respectively; the multi-scale feature map set is input into the BiFPN structure for feature fusion; BiFPN designs a top-down and bottom-up bidirectional fusion path, and uses a weighted feature fusion mechanism to cross information between different scales; BiFPN assigns trainable weights to each input feature map, and adopts 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: transfers detailed features to the deep layer to enhance semantic perception.
[0058] In this embodiment, the image feature extraction and fusion unit 2 includes a structure template guidance module 22, 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 diagram;
[0059] The structure template guiding mechanism performs image rasterization processing, 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, which contains information such as pads, traces, vias, and interlayer connections; since the structure diagram is in vector format, it is not suitable for direct pixel-level comparison with the convolutional neural network feature map, so the following steps of structure template diagram processing are required; the Gerber structure diagram of the PCB circuit design is processed using the structure template guidance mechanism: image rasterization processing is performed to convert the vector form of the Gerber structure diagram into a two-dimensional fixed resolution Pixel map, generate the original structure template map, the image maintains the same image aspect ratio and reference coordinate origin as the input image to ensure structural alignment; affine transformation, considering that the PCB image may have position drift, rotation or slight tilt during the actual detection process, the original structure template map is subjected to affine transformation including translation correction, rotation alignment, size scaling and tilt correction; scale matching and channel rearrangement, the transformed standard structure map is interpolated and scaled to generate a structure template atlas that matches the multi-scale feature map output by the YOLOv8 backbone network in size; at each scale, the standard structure map is downsampled using bilinear interpolation to ensure its spatial dimension and feature Figure 1 At the same time, in order to enhance the collaborative learning ability of convolutional features and structural information, the channel expansion and rearrangement operations are performed on the structure map, and the single-channel structure map is expanded into a pseudo RGB format consistent with the feature map channel, and finally the multi-scale structure template map is output.
[0061] In this embodiment, the image feature extraction and fusion unit 2 includes a residual fusion module 23, which uses a structural gradient residual modeling method based on the Scharr operator to perform image gradient calculation on the multi-scale feature map and the multi-scale structure template map, and extracts the image gradient maps of the multi-scale feature map and the multi-scale structure template map respectively; uses a pixel-by-pixel difference calculation method to calculate the structural gradient residual map at each scale; inputs the structural gradient residual map into the channel attention mechanism SE structure to generate a saliency response weight map of the channel dimension; performs channel-by-channel weighted fusion on the multi-scale feature map and the saliency response weight map to obtain a structurally enhanced multi-scale feature map; performs scale alignment and cascade operations on the structurally enhanced multi-scale feature map at each scale of the structurally 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 for multi-scale feature maps and multi-scale structural template maps respectively. In this embodiment, the Scharr operator is selected because it has stronger rotation invariance and better noise robustness in edge direction extraction than the traditional Sobel operator, and is suitable for high-precision defect edge positioning. For each scale, a structural gradient residual map is calculated. The structural gradient 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 small offset structural defects such as structural dislocation, solder joints, and fractures. Each structural gradient residual map is input into the SE channel attention mechanism structure to extract the response weights between feature channels. This includes performing global average pooling of the structural gradient residual map in the spatial dimension in the Squeeze stage to generate a channel description vector. In the Excitation stage, based on the channel description vector, a weight vector is generated through two fully connected layers and an activation function. The channel weights generated by the SE channel attention mechanism structure are applied to the corresponding scale feature map for channel-by-channel weighting. After the structural enhancement feature maps at all scales are spatially resized, they are concatenated in the channel dimension to obtain the final output structural offset response feature map.
[0063] Defect target positioning and classification unit 3, based on the YOLOv8 multi-scale decoupling detection head structure, performs spatial position regression and category classification judgment on the structural offset response feature map of the defect target to obtain a set of target defect prediction frames;
[0064] In this embodiment, the defect target positioning and classification unit 3 is constructed based on the multi-scale decoupling detection Head structure of YOLOv8, including a position regression branch and a category classification branch, which respectively perform target bounding box prediction and defect type judgment on different scale feature areas in the structural offset response feature map, and output a target prediction box set containing position information, confidence and defect category labels.
[0065] In this embodiment, the multi-scale decoupled detection Head structure based on YOLOv8 consists of three decoupled detection heads of different scales, corresponding to shallow texture features, mid-level structural features and deep semantic features respectively; the three different scales of decoupled detection are composed of two parts: position regression branch and category classification branch; each branch is composed of a stack of convolutional layers, BatchNorm and SiLU activation functions, and the convolution kernel sizes are alternately set to 1×1 and 3×3 to control the balance between receptive field and detection accuracy.
[0066] Defect result output analysis unit 4, which screens, merges and sorts the target defect prediction frame set to obtain the final PCB defect detection result;
[0067] In this embodiment, the defect result output analysis unit 4 is used to receive a target prediction frame set, and perform confidence screening, overlapping redundant frame suppression and defect priority sorting on it to obtain the final PCB defect detection result.
[0068] In this embodiment, confidence screening, overlapping redundant frame suppression and defect priority sorting operations are performed, specifically as follows: a confidence threshold is set, all target prediction frames with confidence greater than the confidence threshold are retained, and low-confidence detection results are removed; for redundant candidate frames of the same category, the IoU between them and the highest-scoring frame is calculated, and if IoU>0.5, they are suppressed, and the candidate frame with the highest confidence is retained; combined with the structural offset score extracted in the structural gradient residual modeling module, pixel-level cumulative calculation is performed inside each target frame area to quantify its structural offset strength, and finally priority sorting is performed based on the weighted comprehensive index of the score value and confidence.
[0069] In a second embodiment, the present invention proposes an intelligent PCB defect detection method based on image recognition, which is used in the intelligent PCB defect detection system based on image recognition in the first embodiment, and includes the following steps:
[0070] S10.1. Obtaining raw image data of the PCB to be tested image at multiple focal planes, and performing spatial alignment, focal region division, and layer fusion reconstruction on the raw image data at the multiple focal planes to ultimately generate a multi-focus fused image;
[0071] S10.2. Based on multi-focus fusion images, we use the YOLOv8 backbone network for feature extraction, combined with the BiFPN feature pyramid structure for multi-scale semantic fusion, and introduce a circuit structure template guidance mechanism and a structural gradient residual modeling method to construct a structural offset response feature map.
[0072] S10.3. Based on the YOLOv8 multi-scale decoupling detection head structure, the spatial position regression and category classification of the defect target are performed on the structural offset response feature map to obtain a set of target defect prediction frames;
[0073] S10.4. Filter, merge, and sort the target defect prediction frame set to obtain the final PCB defect detection result.
[0074] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but 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: A multi-focus heterogeneous layer image fusion unit (1) is configured to obtain original image data of a PCB to be tested image at multiple focal planes, and to perform spatial alignment, focal region division, and layer fusion reconstruction processing on the original image data at the multiple focal planes, thereby finally generating a multi-focus fused image; Image feature extraction and fusion unit (2): The image feature extraction and fusion unit (2) uses the YOLOv8 backbone network to extract features based on the multi-focus fusion image, combines the BiFPN feature pyramid structure to perform multi-scale semantic fusion, and introduces the circuit structure template guidance mechanism and the structure gradient residual modeling method to construct a structure offset response feature map; Defect target positioning and classification unit (3), based on the YOLOv8 multi-scale decoupling detection Head structure, performs spatial position regression and category classification judgment of the defect target on the structural offset response feature map to obtain a target defect prediction frame set; The defect result output analysis unit (4) screens, merges and sorts the target defect prediction frame set to obtain the final PCB defect detection result.
2. The PCB defect intelligent detection system based on image recognition according to claim 1 is characterized in that: The multi-focus heterogeneous layer image fusion unit (1) comprises a multi-focus image acquisition module (11) and an image space alignment module (12); The multi-focus image acquisition module (11) is used to acquire images of the same PCB circuit board at multiple different focal planes, and obtain original image data at the multiple focal planes; The image space alignment module (12) uses an image edge feature-based registration algorithm to perform translation, rotation and scale normalization correction on the original image data under multiple focal planes to obtain multi-focal plane images.
3. The PCB defect intelligent detection system based on image recognition according to claim 2 is characterized in that: The multi-focus heterogeneous layer image fusion unit (1) comprises a focal region division module (13), and the focal region division module (13) is used to divide the multi-focus plane image into layers, specifically comprising: An image clarity evaluation function is used to score the local clarity of each pixel area in the multi-focal plane image to obtain the focal area clarity score of the multi-focal plane image. The multi-focal plane image is then divided into the optimal focus layer and the suboptimal focus layer by region to construct the focal area layer. The clarity evaluation function includes a Laplacian gradient function and a Tenengrad contrast function.
4. The PCB defect intelligent detection system based on image recognition according to claim 3 is characterized in that: The multi-focus heterogeneous layer image fusion unit (1) further comprises a layer fusion and reconstruction module (14), wherein the layer fusion and reconstruction module (14) is used to perform weighted fusion on the focus region layers, specifically as follows: Based on the focus area clarity scores of the multi-focal plane images, the maximum focus area clarity score is selected for each pixel position in the focus area layer for weighted fusion, and finally a multi-focal fusion image is obtained.
5. The PCB defect intelligent detection system based on image recognition according to claim 4 is characterized in that: The image feature extraction and fusion unit (2) includes a backbone feature extraction and fusion module (21), wherein the backbone feature extraction and fusion module (21) uses a YOLOv8 backbone network structure to perform convolution feature extraction on the multi-focus fusion image to obtain a multi-scale feature map, and uses a BiFPN feature pyramid structure to perform bidirectional fusion on the multi-scale feature map; 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 the multi-focus fusion image and output multi-scale feature maps. The BiFPN feature pyramid structure includes an upsampling path and a downsampling path, and uses a weighted fusion method to cross-feature multi-scale feature maps at different levels.
6. The PCB defect intelligent detection system based on image recognition according to claim 5 is characterized in that: The image feature extraction and fusion unit (2) includes a structure template guidance module (22), which processes the Gerber structure diagram of the PCB circuit design using a structure template guidance mechanism to construct a multi-scale structure template diagram that matches the resolution of the multi-scale feature diagram; The structure template guiding mechanism performs image rasterization processing, affine transformation, interpolation scaling and channel rearrangement operations on the Gerber structure diagram.
7. The PCB defect intelligent detection system based on image recognition according to claim 6 is characterized in that: The image feature extraction and fusion unit (2) includes a residual fusion module (23), which uses a structural gradient residual modeling method based on a Scharr operator to perform image gradient calculation on a multi-scale feature map and a multi-scale structure template map, and respectively extracts image gradient maps of the multi-scale feature map and the multi-scale structure template map; The structural gradient residual map at each scale is calculated using a pixel-by-pixel difference calculation method. The structural gradient residual map is input into the channel attention mechanism SE structure to generate a channel-dimensional saliency response weight map. The multi-scale feature map and the saliency response weight map are weightedly fused channel by channel to obtain a structurally enhanced multi-scale feature map. The structure-enhanced multi-scale feature maps at each scale are scale-aligned and concatenated to finally generate a structure-shift response feature map.
8. The PCB defect intelligent detection system based on image recognition according to claim 7 is characterized in that: The defect target positioning and classification unit (3) is constructed based on the multi-scale decoupling detection head structure of YOLOv8, including a position regression branch and a category classification branch, which respectively perform target bounding box prediction and defect type judgment on different scale feature areas in the structural offset response feature map, and output a target prediction box set containing position information, confidence and defect category labels.
9. The PCB defect intelligent detection system based on image recognition according to claim 8, characterized in that: The defect result output analysis unit (4) is used to receive a target prediction frame set, and perform confidence screening, overlapping redundant frame suppression and defect priority sorting on the target prediction frame set to obtain a final PCB defect detection result.
10. A method for intelligent detection of PCB defects based on image recognition, used in the intelligent detection system for PCB defects based on image recognition according to any one of claims 1 to 9, characterized in that: The steps include: S10.
1. Obtaining raw image data of the PCB to be tested image at multiple focal planes, and performing spatial alignment, focal region division, and layer fusion reconstruction on the raw image data at the multiple focal planes to ultimately generate a multi-focus fused image; S10.
2. Based on multi-focus fusion images, we use the YOLOv8 backbone network for feature extraction, combined with the BiFPN feature pyramid structure for multi-scale semantic fusion, and introduce a circuit structure template guidance mechanism and a structural gradient residual modeling method to construct a structural offset response feature map. S10.
3. Based on the YOLOv8 multi-scale decoupling detection head structure, the spatial position regression and category classification of the defect target are performed on the structural offset response feature map to obtain a set of target defect prediction frames; S10.
4. Filter, merge, and sort the target defect prediction frame 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
Cited By
PCB component category identification method based on IPC file analysis
CN121033551A
PCB component category identification method based on parsing of IPC file
CN121033551B
Industrial part defect detection method based on multi-scale feature fusion
CN121616587A
An industrial part defect detection method based on multi-scale feature fusion
CN121616587B