An Optimized Defect Detection Method for Small Targets Based on Capacitive Screen Printing
By improving the neck network structure and optimizing the subpixel-level bounding box of the GD-YOLOv8 model, the problems of feature fusion and inaccurate localization in small target defect detection in capacitive screen printing were solved, achieving higher detection accuracy and precision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGGUAN UNIV OF TECH
- Filing Date
- 2026-01-19
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies for detecting small target defects in capacitive screen printing suffer from insufficient feature fusion and inaccurate labeling and positioning, resulting in inadequate detection accuracy.
The neck network structure of the GD-YOLOv8 model is improved by introducing low-level and high-level aggregation-distribution layers, as well as information injection and lightweight neighbor layer fusion modules to optimize feature extraction and localization accuracy. The training data quality is also optimized by sub-pixel level bounding boxes.
It significantly improves the detection accuracy and positioning accuracy of small target defects in capacitive screen printing, and solves the problems of feature information loss and annotation error.
Smart Images

Figure CN122135066A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of capacitor defect detection technology, specifically relating to an optimized detection method for small target defects based on capacitor screen printing. Background Technology
[0002] As a key electronic component, the quality of capacitors directly affects the performance and reliability of electronic devices. During capacitor manufacturing, the screen printing process is prone to introducing minute defects such as black and white spots, as well as other noticeable and larger defects, due to material impurities and process fluctuations. These defects are typically extremely small (e.g., a pixel area of about 3*3), making them typical small targets in a high-resolution image, posing a significant challenge to automated optical inspection (AOI). Currently, single-stage target detection algorithms based on the YOLO series are widely used in industrial defect detection due to their efficiency. However, standard models such as YOLOv8 have inherent limitations when handling small target defects: Insufficient feature fusion: Their neck networks often use structures such as path aggregation networks (PANet), requiring information to be passed through intermediate layers during cross-layer feature fusion, leading to the loss of detailed features of small targets during propagation. Inaccurate annotation and localization: Subjective errors exist when manually annotating bounding boxes, and for small targets, even slight deviations in the box position can significantly affect model learning. Traditional annotation methods struggle to achieve pixel-level precise localization.
[0003] While existing technologies have attempted to improve small target detection performance by modifying feature pyramids or introducing attention mechanisms, they often overlook the fundamental information loss problem in the feature fusion path and lack fine-grained optimization of the training data's annotation quality. Therefore, a method that can synergistically optimize model structure and training data quality is urgently needed to significantly improve the detection accuracy of small target defects in capacitive screen printing. Summary of the Invention To address the shortcomings of existing technologies, this invention provides a method for detecting small target defects in capacitive screen printing. By improving the neck network structure of the detection model and introducing sub-pixel level bounding box optimization technology, the method synergistically enhances the model's feature extraction capability and localization accuracy for small target defects.
[0004] In a first aspect, this invention proposes an optimized detection method for small target defects based on capacitive screen printing, comprising: Acquire images of the capacitor under test, input the preprocessed images of the capacitor under test into the improved GD-YOLOv8 model for defect detection, output the actual location of the defect on the capacitor surface, and generate a detection report. The improved GD-YOLOv8 model uses the YOLOv8 model as a baseline. It extracts B2-B5 features from the target capacitance image through the backbone network layer, gathers detail features through a low-level aggregation-distribution layer, gathers semantic features through a high-level aggregation-distribution layer, and obtains enhanced features through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
[0005] Preferably, the lower-level aggregation-distribution layer specifically includes: The Low-FAM module downsamples all B2, B3, and B4 outputs from the backbone network layers to the same minimum scale as B5. Channel summation is then performed on all aligned feature maps to generate globally aligned features. ; Global alignment features are processed using RepBlock reparameterized convolutional blocks. Generate fusion features Along the channel dimension Decomposed into and Two feature components are used for subsequent injection into P3 and P4 layers.
[0006] Preferably, the higher-level aggregation-distribution layer specifically includes: The High-FAM advanced feature alignment module is used to uniformly reduce the spatial resolution of P3, P4, and P5 to the target scale using average pooling. Channel summation is then performed on all size-aligned feature maps to generate global semantic alignment features. ; Global semantic alignment features are processed using multiple sets of Transformer blocks. Capture global spatial relationships and generate high-order semantic features. ' ; Through Conv1×1 and split operations ' Further processing is performed to obtain a more dimensionality-reduced result. and .
[0007] Preferably, the neck network further includes: an information injection and lightweight neighboring layer fusion module, used to connect the low-level aggregation-distribution module and the high-level aggregation-distribution module with the features of each layer of the neck network; the information injection and lightweight neighboring layer fusion module includes: Lightweight neighbor-to-neighbor fusion processing is applied to the backbone network feature map or neck network feature map to output aligned local features. ; The global injection features are processed in two branches: one branch generates aligned global features through 1×1 convolution and scale adjustment. The other branch generates spatial attention weights through 1×1 convolution and the Sigmoid function. This is used to highlight key areas; For the local features global features and spatial attention weights Perform attention-weighted fusion operations to obtain preliminary fusion features.
[0008] Preferably, the information injection and lightweight adjacent layer fusion module further includes: The preliminary fused features are input into a RepBlock reparameterized convolutional block for feature depth extraction and refinement, outputting enhanced features. As the output feature of the corresponding layer of the neck network.
[0009] Preferably, the method further includes training the improved GD-YOLOv8 model, specifically including: The size of the bounding boxes for all black and white defects in the training dataset is uniformly adjusted. For each bounding box, the center point coordinates of the defect are calculated using a distance transformation combined with subpixel interpolation. The annotation box is repositioned based on the coordinates of the center point; The repositioned dataset is input into the improved GD-YOLOv8 model for training to obtain the final improved GD-YOLOv8 model.
[0010] Preferably, for each bounding box, the method of calculating the center point coordinates of the defect using distance transformation combined with sub-pixel interpolation specifically includes: Extract the image region within the labeled box; A binarization threshold is set according to the defect type, and a distance transformation is performed; the position of the maximum value point in the distance transformation map is initially determined as the defect center (cX, cY); the defect type includes black dots or white dots; Based on the initial center point (cX, cY) and a 16x16 bounding box, a fine grid with a step size of 0.1 pixels is created within the bounding box. Bicubic spline interpolation is then used to interpolate the grayscale image, generating a high-resolution grayscale field and establishing a continuous grayscale surface function. I(x,y); For white dots, find the point with the maximum gray value in the interpolated grid; for black dots, find the point with the minimum gray value. The coordinates of this point are the precise center point position at the sub-pixel level.
[0011] In a second aspect, the present invention also provides an optimized detection model for small target defects in capacitive screen printing, wherein the detection model is the improved GD-YOLOv8 model in the optimized detection method for small target defects in capacitive screen printing as described in the first aspect. The improved GD-YOLOv8 model uses the YOLOv8 model as a baseline. When performing optimized detection of small target defects in capacitor screen printing, the B2-B5 features are first extracted from the image of the capacitor to be tested through the backbone network layer. Detail features are then gathered through a low-level aggregation-distribution layer, and semantic features are gathered through a high-level aggregation-distribution layer. Enhanced features are obtained through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
[0012] Thirdly, the present invention also provides a defect detection system, the system comprising: A computer host, through software running therein, controls an illumination source controller, an illumination source, a one-line scanning camera and a lens electrically connected to the computer host, wherein a processor in the computer host executes a small target defect optimization detection method based on capacitive screen printing as described in the first aspect.
[0013] Preferably, the defect detection system further includes: controlling the illumination source controller to drive the illumination source to illuminate one or more printed circuit boards disposed on a printed circuit board production line, and controlling the line scan camera to capture a surface image of the printed circuit board through the lens, so as to acquire a surface image of the printed circuit board; A defect image dataset is generated by annotating the defects in each surface image. By improving the GD-YOLOv8 model, B2-B5 features are extracted from the defective image dataset through the backbone network layer. Detail features are then gathered through a low-level aggregation-distribution layer, and semantic features are gathered through a high-level aggregation-distribution layer. Enhanced features are obtained through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Model structure advantages: By introducing the GD mechanism, the feature fusion path of the neck network is improved, realizing the global aggregation and lossless distribution of cross-level features, effectively mitigating the information loss of small target features during the propagation process, and enhancing the model's ability to perceive small targets.
[0015] 2. Data quality advantages: By using subpixel-level bounding box optimization technology, small target bounding boxes are unified to an appropriate size and pixel-level accurate positioning is achieved, providing the model with higher quality and more consistent supervision signals, directly improving the model's learning ceiling from the data level.
[0016] 3. Synergistic Effect: This invention combines model structure improvement with data preprocessing optimization, with the two complementing each other. The improved model can better utilize the fine location information in high-quality labeled data, while the high-quality data can fully realize the performance potential of the improved model, thereby achieving a significant improvement in detection accuracy for small target defects in capacitive screen printing. Attached Figure Description
[0017] Figure 1 This is a diagram of a low-level aggregation-distribution layer structure shown in an embodiment of the present invention.
[0018] Figure 2 This is a high-level aggregation-distribution layer structure diagram shown in an embodiment of the present invention.
[0019] Figure 3 This is the Inject-LAF configuration shown in the embodiment of the present invention, which features information injection and lightweight neighboring layer fusion.
[0020] Figure 4 This is a diagram showing the size variation of the annotation box in an embodiment of the present invention.
[0021] Figure 5 This is an image showing the effect of the subpixel adjustment method as illustrated in an embodiment of the present invention.
[0022] Figure 6 This is a comparison chart of detection results from multiple models as shown in an embodiment of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0024] Example 1: This invention proposes an optimized detection method for small target defects based on capacitive screen printing, comprising: Acquire images of the capacitor under test, input the preprocessed images of the capacitor under test into the improved GD-YOLOv8 model for defect detection, output the actual location of the defect on the capacitor surface, and generate a detection report. This invention uses the YOLOv8 model as a baseline and reconstructs its neck network by introducing a Gather-and-Distribute (GD) mechanism to form an improved GD-YOLOv8 model. This mechanism aims to solve the information loss problem in traditional Feature Pyramid Networks (FPNs).
[0025] In this embodiment, the improved GD-YOLOv8 model is used for defect detection. First, B2-B5 features are extracted from the image of the capacitor to be tested through the backbone network layer. Then, detailed features are gathered through a low-level aggregation-distribution layer, and semantic features are gathered through a high-level aggregation-distribution layer. Finally, enhanced features are obtained by feature fusion through information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
[0026] Preferred, such as Figure 1 As shown, the low-level aggregation-distribution layer specifically includes: The Low-FAM module downsamples all B2, B3, and B4 outputs from the backbone network layers to the same minimum scale as B5. Channel summation is then performed on all aligned feature maps to generate globally aligned features. ; Global alignment features are processed using RepBlock reparameterized convolutional blocks. Generate fusion features Along the channel dimension Decomposed into and Two feature components are used for subsequent injection into P3 and P4 layers.
[0027] The specific parameters of the B2-B5 feature maps extracted by the backbone network are as follows: B2 feature map: 64 channels, 320×320 resolution (corresponding to 1 / 2 downsampling scale of input image), core carrying capacitor screen printing small target (black dots, white dots) fine texture details features; B3 feature map: 128 channels, 160×160 resolution (corresponding to 1 / 4 downsampling scale of the input image), carrying medium-granularity local features; B4 feature map: 256 channels, 80×80 resolution (corresponding to 1 / 8 downsampling scale of the input image), balancing local details and preliminary semantic information; B5 feature map: 512 channels, 40×40 resolution (corresponding to a 1 / 16 downsampling scale of the input image), is the smallest scale feature map output by the backbone network, and is rich in high-level semantic information.
[0028] In this embodiment, the core function of the Low-FAM low-level feature alignment module is to downsample the feature maps B2, B3, and B4 to a scale of 40×40 consistent with B5. The specific configuration is as follows: Downsampling operator: Downsampling is implemented using a standard 3×3 convolutional layer. The number of convolutional kernels is consistent with the number of channels in the input feature map (64 convolutional kernels for B2, 128 for B3, and 256 for B4). The convolutional stride is set to 2, and the padding is set to 1 to ensure that the edge information of the feature map is not lost during downsampling. Specifically, the B2 feature map needs to be downsampled twice (320×320→160×160→40×40), the B3 feature map needs to be downsampled once (160×160→40×40), and the B4 feature map needs to be downsampled once (80×80→40×40). Finally, B2, B3, and B4 are all aligned to the 40×40 scale of B5, and the number of channels remains unchanged (still 64, 128, and 256).
[0029] In this embodiment, RepBlock is used for deep processing of the global alignment feature Falign, and is specifically configured as follows: Branching structure: It contains three parallel convolutional branches: a 1×1 convolutional branch, a 3×3 convolutional branch, and an identity mapping branch (enabled only when the number of input and output channels is the same); the number of convolutional kernels in the 1×1 convolutional branch is set to 256, and the number of convolutional kernels in the 3×3 convolutional branch is also set to 256. The convolutional stride of both branches is 1, and the padding is set to 1. Each convolutional branch is followed by a BN layer (with parameters the same as Low-FAM) and a SiLU activation function; the output feature maps of the three branches are fused by channel summation, and the final output is a fused feature Ffuse with 256 channels and a resolution of 40×40.
[0030] The fusion feature Ffuse has 256 channels, which are split into two feature components along the channel dimension: Finj_P3 (128 channels, 40×40 resolution) and Finj_P4 (128 channels, 40×40 resolution). After splitting, the scale of the two feature components remains unchanged, only the number of channels is halved to adapt to the channel dimension requirements of the subsequent neck network P3 and P4 layers.
[0031] In this embodiment, the specific working process of the low-level aggregation-distribution layer is as follows: ; 1. Feature Input: Receive four sets of feature maps output from the backbone network: B2 (64×320×320), B3 (128×160×160), B4 (256×80×80), and B5 (512×40×40). Among them, B5 is used as the baseline feature map for scale alignment and does not participate in downsampling processing. 2. Low-FAM Scale Alignment: Activate the Low-FAM module and perform preset downsampling operations on B2, B3, and B4 respectively: 3. Global Alignment Feature Generation: Perform channel summation on the B2 alignment features (64×40×40), B3 alignment features (128×40×40), B4 alignment features (256×40×40), and the baseline B5 feature (512×40×40) output by Low-FAM. Specifically, add the values at corresponding positions for each pixel to generate a global alignment feature Falign with 64+128+256+512=960 channels and a resolution of 40×40. 4. RepBlock Deep Processing: Falign (960×40×40) is input into the RepBlock module. After convolution, BN normalization and SiLU activation in three parallel branches, the channel summation and fusion are performed to output a fusion feature Ffuse of 256×40×40. This feature has deeply integrated the low-level detail features of B2-B5 and the preliminary semantic features of B5. 5. Feature splitting and distribution: Ffuse (256×40×40) is split into two feature components, Finj_P3 (128×40×40) and Finj_P4 (128×40×40), along the channel dimension. Finj_P3 is used to inject into the P3 layer of the neck network, and Finj_P4 is used to inject into the P4 layer of the neck network, providing global detail enhancement features for subsequent information injection and lightweight neighboring layer fusion modules.
[0032] This embodiment avoids the loss of details of low-level features (B2-B4) during cross-scale fusion by using precise scale alignment of Low-FAM, ensuring that minor defects in capacitive screen printing (such as black dots of 2-5 pixels) are not submerged; through the reparameterization design of RepBlock, the feature fusion effect is improved while ensuring the model inference speed.
[0033] Preferred, such as Figure 2 As shown, the high-level aggregation-distribution layer specifically includes: ; ; ; Using the High-FAM advanced feature alignment module, average pooling is employed. Combining semantic feature processing efficiency with global information coverage, the target scale is set to 40×40. The spatial resolutions of P3, P4, and P5 are uniformly reduced to the target scale: P3 uses a 4×4 average pooling kernel (stride 4), P4 uses a 2×2 average pooling kernel (stride 2), and P5 uses a 1×1 average pooling kernel. After average pooling alignment, P3, P4, and P5 all have a resolution of 40×40, and the number of channels remains unchanged at 256, forming a uniformly sized feature map to be fused.
[0034] Perform channel summation on all size-aligned feature maps to generate global semantic alignment features. ; Global semantic alignment features are processed using multiple sets of Transformer blocks. Capture global spatial relationships and generate high-order semantic features. ' Preferably, to match the self-attention calculation dimension of the Transformer block, a 1×1 convolutional layer is added before the Transformer block to adjust the number of channels of the aligned feature map from 256 to 1024, the number of convolutional kernels is set to 1024, the stride is 1, the padding is 0, and the activation function is GELU; each Transformer block includes a multi-head attention mechanism (MHA), a feedforward network (FFN), and residual connection components; the MHA is set to 8 attention heads, each attention head has a dimension of 128 (1024÷8), the attention calculation adopts the scaled dot product mode, and the dropout probability is set to 0.1; the FFN adopts a linear layer + GELU activation + linear layer structure, the intermediate hidden layer dimension is set to 4096, the output dimension is regressed to 1024, and the dropout probability is set to 0.1. LayerNorm layers are added before both the MHA and FFN inputs, with the normalization dimension set to the channel dimension and the epsilon parameter set to 1e-5 to ensure the stability of the training process; the four Transformer blocks are stacked sequentially, and adjacent Transformer blocks are directly connected through residual connections.
[0035] Through Conv1×1 and split operations ' Further processing is performed to obtain a more dimensionality-reduced result. and Preferably, the Conv1×1 convolution parameters are: 256 kernels, stride 1, padding 0, no activation function, and only channel dimensionality reduction is implemented; the splitting strategy is to split the dimensionality-reduced Ffuse' (256×40×40) into two feature components along the channel dimension, namely Finj_P4 (128×40×40) and Finj_P5 (128×40×40). The number of channels of the split feature components is consistent with the Finj_P3 and Finj_P4 output by the lower-level aggregation-distribution layer, which is suitable for the information injection requirements of the P4 and P5 layers of the neck network.
[0036] Based on the above parameter configuration, the specific working process of the high-level aggregation-distribution layer is as follows: 1. Feature Input: The three initial fused feature maps P3 (256×160×160), P4 (256×80×80), and P5 (256×40×40) output from the neck network FPN path are received as the raw input for high-level semantic enhancement; 2. High-FAM Scale Alignment: Activate the High-FAM module and perform preset average pooling operations on the three sets of feature maps respectively: 3. The P3 feature map is shrunk from 160×160 to 40×40 by 4×4 average pooling (stride 4), and the output is an aligned feature of 256×40×40. 4. The P4 feature map is shrunk from 80×80 to 40×40 by 2×2 average pooling (step 2), and the output is an aligned feature of 256×40×40. 5. The P5 feature map is subjected to 1×1 average pooling (step 1), keeping the scale unchanged at 40×40, and outputting an aligned feature of 256×40×40. 6. Global semantic alignment feature generation: Perform channel summation operation on the three sets of alignment feature maps (all 256×40×40) output by High-FAM, that is, add the values of corresponding positions of each pixel to generate a global semantic alignment feature Falign' with 256 channels and a resolution of 40×40. This feature has initially integrated the global semantic association information of P3-P5. 7. Global semantic processing of Transformer blocks: Falign' (256×40×40) is input into a dimension-adaptive 1×1 convolutional layer. After the number of channels is increased from 256 to 1024, it is fed into 4 sets of serially stacked Transformer blocks. The long-distance dependencies between pixels in the feature map are captured through the self-attention mechanism to distinguish the semantic differences between the capacitor defect area and the background texture area. Finally, a high-order semantic feature Ffuse' of 1024×40×40 is output. 8. Dimensionality Reduction and Splitting Distribution: Inputting Ffuse' into a Conv1×1 convolutional layer reduces the number of channels from 1024 to 256, resulting in a simplified high-order semantic feature of 256×40×40. It is then split into two feature components, Finj_P4 (128×40×40) and Finj_P5 (128×40×40), along the channel dimension. Finj_P4 is used to inject into the P4 layer of the neck network, and Finj_P5 is used to inject into the P5 layer of the neck network, providing global semantic enhancement features for subsequent information injection and lightweight neighboring layer fusion modules.
[0037] This embodiment uses the High-FAM average pooling alignment strategy to achieve scale uniformity while preserving the global distribution information of high-level semantic features, avoiding semantic information distortion caused by traditional convolution downsampling. Through the stacking design of 4 sets of Transformer blocks, the global spatial relationship between capacitor defects and the overall capacitor surface is effectively captured, significantly improving the model's semantic discrimination ability for small target defects in complex texture backgrounds.
[0038] Preferably, the neck network further includes: Figure 3 As shown, the information injection and lightweight neighboring layer fusion module is used to connect the low-level aggregation-distribution module and the high-level aggregation-distribution module with the features of each layer of the neck network. Three independent LAF sub-modules (LAF-P3, LAF-P4, LAF-P5) are configured for the P3, P4, and P5 layers of the neck network, respectively. The hardware and software operating environment is completely consistent with the aforementioned low-level and high-level aggregation-distribution layers. The input local features are derived from the feature maps of the corresponding layers of the backbone network or the neck network, and the global injected features are derived from Finj_P3 and Finj_P4 output by the low-level aggregation-distribution layer and Finj_P4 and Finj_P5 output by the high-level aggregation-distribution layer.
[0039] The information injection and lightweight adjacent layer fusion module includes: Lightweight neighbor-to-neighbor fusion processing is applied to the backbone network feature map or neck network feature map to output aligned local features. Specifically, this includes: selecting neighboring layers of the P4 layer in the neck network (P3 downsampled features and P5 upsampled features) as neighboring layer features, with P3 downsampled feature parameters of 256×80×80 and P5 upsampled feature parameters of 256×80×80; adopting a lightweight design of average pooling alignment + 1×1 convolution dimensionality reduction, first aligning the P3 features to the 80×80 scale through 2×2 average pooling (stride 2), and upsampling the P5 features to the 80×80 scale through bilinear interpolation; then performing dimensionality reduction and fusion of the P3, P4, and P5 neighboring layer features through a 1×1 convolutional layer (256 convolutional kernels, stride 1, padding 0), using SiLU activation function, and outputting aligned local features Flocal_align with 256 channels and a resolution of 80×80, preserving local neighboring layer context information while avoiding computational redundancy.
[0040] The globally injected features are processed using a dual-branch approach to achieve global feature alignment and attention weight generation. Specifically, one branch generates aligned global features through 1×1 convolution and scale adjustment. The other branch generates spatial attention weights through 1×1 convolution and the Sigmoid function. This is used to highlight key areas; Branch 1 (Global Feature Alignment): A 1×1 convolutional layer is used to perform channel normalization on the globally injected features, and then the scale is upsampled to 80×80 through bilinear interpolation to generate aligned global features. No activation function is used, ensuring the integrity of global features; Branch 2 (Spatial Attention Weight Generation): First, the global injected features are reduced in dimensionality through a 1×1 convolutional layer (128 kernels, stride 1, padding 0), with SiLU as the activation function; then, spatial correlation features are extracted through a 3×3 convolutional layer; finally, the channels are compressed to 1 through a 1×1 convolutional layer, and spatial attention weights Fglobal_att are generated through the Sigmoid function to achieve focus on key regions.
[0041] For the local features global features and spatial attention weights Perform attention-weighted fusion operation. Preferably, use the weighted fusion logic of local features + (global features × attention weight), where × is pixel-wise multiplication (attention weight) and + is channel-wise addition (feature fusion) to obtain preliminary fused features.
[0042] Preferably, the information injection and lightweight adjacent layer fusion module further includes: The preliminary fused features are input into a RepBlock reparameterized convolutional block for feature depth extraction and refinement, outputting enhanced features. As the output feature of the corresponding layer of the neck network.
[0043] Preferably, the RepBlock reparameterized convolutional block includes a 1×1 convolutional branch, a 3×3 convolutional branch, and an identity mapping branch, and outputs an enhanced feature Ni as the output feature of the P4 layer of the neck network.
[0044] Preferred, such as Figure 4-5 As shown, it also includes training the improved GD-YOLOv8 model, specifically including: The size of the bounding boxes for all black and white defects in the training dataset is uniformly adjusted. For each bounding box, the center point coordinates of the defect are calculated using a distance transformation combined with subpixel interpolation. The annotation box is repositioned based on the coordinates of the center point; The repositioned dataset is input into the improved GD-YOLOv8 model for training to obtain the final improved GD-YOLOv8 model.
[0045] like Figure 6 As shown, the improved GD-YOLOv8 model of this application was used for testing. The experimental data above demonstrates that training the improved GD-YOLOv8 model with a dataset optimized by sub-pixel level bounding boxes can significantly improve the high-precision detection and localization capability of small target defects (black dots and white dots) in capacitance images. It has obvious technical advantages over existing mainstream models and can meet the actual detection needs of industrial production.
[0046] Preferably, for each bounding box, the method of calculating the center point coordinates of the defect using distance transformation combined with sub-pixel interpolation specifically includes: Extract the image region within the labeled box; Binarization thresholds are set according to defect type. Defect regions in each labeled image are binarized. An Euclidean distance transform algorithm is used to calculate the shortest distance from each pixel in the image to the defect region boundary, generating a distance transform map. The pixel value at the defect center point is the largest in the distance transform map. The location of the maximum value point in the distance transform map is initially determined as the defect center (cX, cY). The defect type includes black or white points. Based on the initial center point (cX, cY) and a 16x16 bounding box, a fine grid with a step size of 0.1 pixels is created within the bounding box. Bicubic spline interpolation is used to interpolate the grayscale image, generating a high-resolution grayscale field and establishing a continuous grayscale surface function I(x, y). For white points, the maximum grayscale value point is found in the interpolated grid; for black points, the minimum grayscale value point is found. The coordinates of this point are the precise center point location at the sub-pixel level.
[0047] Using the calculated subpixel-level center point coordinates as a reference, the uniformly resized bounding box is repositioned to ensure that the center of the bounding box completely coincides with the actual center of the defect: the subpixel-level center point coordinates are mapped back to the original image scale to obtain the center point coordinates at the original scale; based on the width and height of the bounding box, the coordinates of the upper left and lower right corners of the bounding box are recalculated with the center point coordinates as the center, and the repositioned bounding box coordinates are updated to the XML annotation file. At the same time, the VOC format is converted to YOLO format to facilitate model reading and training, and the converted coordinates are normalized to the 0-1 interval.
[0048] Example 2: The present invention also provides an optimized detection model for small target defects in capacitive screen printing, wherein the detection model is the improved GD-YOLOv8 model in the optimized detection method for small target defects in capacitive screen printing as described above. The improved GD-YOLOv8 model uses the YOLOv8 model as a baseline. When performing optimized detection of small target defects in capacitor screen printing, the B2-B5 features are first extracted from the image of the capacitor to be tested through the backbone network layer. Detail features are then gathered through a low-level aggregation-distribution layer, and semantic features are gathered through a high-level aggregation-distribution layer. Enhanced features are obtained through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
[0049] Preferably, the low-level aggregation-distribution layer is deployed between the backbone network and the neck network, and its core consists of Low-FAM and RepBlock. Low-FAM aligns B2-B4 features to the B5 scale, avoiding the loss of details in cross-scale fusion; RepBlock performs in-depth processing on the aligned global features, and through reparameterization design, it balances fusion effect and inference speed, finally outputting detail enhancement features Finj_P3 and Finj_P4 adapted to the neck P3 and P4 layers.
[0050] High-level aggregation-distribution layer: Deployed between the initial fusion stage in the neck and the LAF module, it consists of High-FAM and multiple Transformer blocks. High-FAM aligns P3-P5 features to a uniform scale through average pooling. Transformer blocks capture long-distance dependencies between pixels, enhance the semantic distinction between defects and background, and output semantically enhanced features Finj_P4 and Finj_P5 adapted to the neck P4 and P5 layers.
[0051] To bridge the gap between the two-layer enhancement features and the neck network, three independent LAF sub-modules are configured corresponding to the P3, P4, and P5 layers of the neck network. Each sub-module includes a lightweight neighbor-layer fusion unit, a global feature dual-branch processing unit, an attention-weighted fusion unit, and a RepBlock refinement unit. This module first performs neighbor-layer fusion on the local features of the neck network, then injects global enhancement features into the local features as needed through an attention mechanism, and finally refines them through RepBlock to generate enhancement features Ni. This achieves accurate fusion of local details and global semantics, improving the feature representation capability of small target defects.
[0052] Example 3: The present invention also provides a defect detection system, the system comprising: A computer host, through software running therein, controls an illumination source controller, an illumination source, a one-line scanning camera and a lens electrically connected to the computer host, wherein a processor in the computer host executes the above-described method for optimizing the detection of small target defects based on capacitive screen printing.
[0053] Preferably, the defect detection system further includes: controlling the illumination source controller to drive the illumination source to illuminate one or more printed circuit boards disposed on a printed circuit board production line, and controlling the line scan camera to capture a surface image of the printed circuit board through the lens, so as to acquire a surface image of the printed circuit board; A defect image dataset is generated by annotating the defects in each surface image. By improving the GD-YOLOv8 model, B2-B5 features are extracted from the defective image dataset through the backbone network layer. Detail features are then gathered through a low-level aggregation-distribution layer, and semantic features are gathered through a high-level aggregation-distribution layer. Enhanced features are obtained through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
[0054] Although exemplary embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above exemplary embodiments are merely illustrative and are not intended to limit the scope of the invention. Various changes and modifications can be made therein by those skilled in the art without departing from the scope and spirit of the invention. All such changes and modifications are intended to be included within the scope of the invention as claimed in the appended claims.
[0055] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the statement "comprising a…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0056] Although the description of the invention has been given in conjunction with the specific embodiments described above, it will be apparent to those skilled in the art that many substitutions, modifications, and variations can be made based on the foregoing. Therefore, all such substitutions, modifications, and variations are included within the spirit and scope of the appended claims.
Claims
1. An optimized detection method for small target defects based on capacitive screen printing, characterized in that, include: Acquire images of the capacitor under test, input the preprocessed images of the capacitor under test into the improved GD-YOLOv8 model for defect detection, output the actual location of the defect on the capacitor surface, and generate a detection report. The improved GD-YOLOv8 model uses the YOLOv8 model as a baseline. It extracts B2-B5 features from the target capacitance image through the backbone network layer, gathers detail features through a low-level aggregation-distribution layer, gathers semantic features through a high-level aggregation-distribution layer, and obtains enhanced features through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
2. The method for optimizing the detection of small target defects based on capacitive screen printing according to claim 1, characterized in that, The lower-level aggregation-distribution layer specifically includes: The Low-FAM module downsamples all B2, B3, and B4 outputs from the backbone network layers to the same minimum scale as B5. Channel summation is then performed on all aligned feature maps to generate globally aligned features. ; Global alignment features are processed using RepBlock reparameterized convolutional blocks. Generate fusion features Along the channel dimension Decomposed into and Two feature components are used for subsequent injection into P3 and P4 layers.
3. The method for optimizing the detection of small target defects based on capacitive screen printing according to claim 2, characterized in that, The higher-level aggregation-distribution layer specifically includes: The High-FAM advanced feature alignment module is used to uniformly reduce the spatial resolution of P3, P4, and P5 to the target scale using average pooling. Channel summation is then performed on all size-aligned feature maps to generate global semantic alignment features. ; Global semantic alignment features are processed using multiple sets of Transformer blocks. Capture global spatial relationships and generate high-order semantic features. ' ; Through Conv1×1 and split operations ' Further processing is performed to obtain a more dimensionality-reduced result. and .
4. The method for optimizing the detection of small target defects based on capacitive screen printing according to claim 3, characterized in that, The neck network further includes: an information injection and lightweight neighboring layer fusion module, used to connect the low-level aggregation-distribution module and the high-level aggregation-distribution module with the features of each layer of the neck network; the information injection and lightweight neighboring layer fusion module includes: Lightweight neighbor-to-neighbor fusion processing is applied to the backbone network feature map or neck network feature map to output aligned local features. ; The global injection features are processed in two branches: one branch generates aligned global features through 1×1 convolution and scale adjustment. The other branch generates spatial attention weights through 1×1 convolution and the Sigmoid function. This is used to highlight key areas; For the local features global features and spatial attention weights Perform attention-weighted fusion operations to obtain preliminary fusion features.
5. The method for optimizing the detection of small target defects based on capacitive screen printing according to claim 4, characterized in that, The information injection and lightweight adjacent layer fusion module also includes: The preliminary fused features are input into a RepBlock reparameterized convolutional block for feature depth extraction and refinement, outputting enhanced features. As the output feature of the corresponding layer of the neck network.
6. A method for optimizing the detection of small target defects based on capacitive screen printing according to any one of claims 1-5, characterized in that, It also includes training the improved GD-YOLOv8 model, specifically including: The size of the bounding boxes for all black and white defects in the training dataset is uniformly adjusted. For each bounding box, the center point coordinates of the defect are calculated using a distance transformation combined with subpixel interpolation. The annotation box is repositioned based on the coordinates of the center point; The repositioned dataset is input into the improved GD-YOLOv8 model for training to obtain the final improved GD-YOLOv8 model.
7. The method for optimizing the detection of small target defects based on capacitive screen printing according to claim 6, characterized in that, For each bounding box, the method of calculating the center point coordinates of the defect using distance transformation combined with sub-pixel interpolation specifically includes: Extract the image region within the labeled box; A binarization threshold is set according to the defect type, and a distance transformation is performed; the position of the maximum value point in the distance transformation map is initially determined as the defect center (cX, cY); the defect type includes black dots or white dots; Based on the initial center point (cX, cY) and a 16x16 bounding box, a fine grid with a step size of 0.1 pixels is created within the bounding box. Bicubic spline interpolation is then used to interpolate the grayscale image, generating a high-resolution grayscale field and establishing a continuous grayscale surface function. I(x,y); For white dots, find the point with the maximum gray value in the interpolated grid; for black dots, find the point with the minimum gray value. The coordinates of this point are the precise center point position at the sub-pixel level.
8. An optimized detection model for small target defects in capacitor screen printing, characterized in that, The detection model is the improved GD-YOLOv8 model in the small target defect optimization detection method based on capacitive screen printing as described in any one of claims 1-7; The improved GD-YOLOv8 model uses the YOLOv8 model as a baseline. When performing optimized detection of small target defects in capacitor screen printing, the B2-B5 features are first extracted from the image of the capacitor to be tested through the backbone network layer. Detail features are then gathered through a low-level aggregation-distribution layer, and semantic features are gathered through a high-level aggregation-distribution layer. Enhanced features are obtained through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.
9. A defect detection system, characterized in that, The system includes: A computer host, through software running therein, controls an illumination source controller, an illumination source, a one-line scanning camera and a lens electrically connected to the computer host, wherein the computer host executes a small target defect optimization detection method based on capacitive screen printing as described in any one of claims 1-7 via a processor.
10. A defect detection system according to claim 9, characterized in that, include: The controller controls the lighting source to drive the lighting source to illuminate one or more printed circuit boards set on a printed circuit board production line, and controls the line scan camera to capture the surface image of the printed circuit board through the lens, so as to acquire the surface image of the printed circuit board; A defect image dataset is generated by annotating the defects in each surface image. By improving the GD-YOLOv8 model, B2-B5 features are extracted from the defective image dataset through the backbone network layer. Detail features are then gathered through a low-level aggregation-distribution layer, and semantic features are gathered through a high-level aggregation-distribution layer. Enhanced features are obtained through feature fusion via information injection and a lightweight neighboring layer fusion module. The result is then output to the neck network for fusion processing. The fusion processing result is then used for detection and post-processing by the decoupled detection head to obtain the final defect result.