SOP defect detection method based on lightweight multi-scale feature fusion
By improving the YOLO-DBS model and combining it with the DCFB, BiFPN, and SENetV2 modules, the problems of high model complexity and low accuracy in SOP surface defect detection are solved, achieving efficient and lightweight detection and meeting the real-time requirements of industry.
Patent Information
- Application Number
- CN202511000688.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-11-14
AI Technical Summary
Existing surface defect detection methods for SOPs (Surface Openings) struggle to balance detection accuracy and model complexity. In particular, under the demands of industrial real-time requirements and edge deployment, deep learning models suffer from large parameter counts, high computational complexity, and low detection accuracy, making it difficult to meet the synergistic requirements of high accuracy and low complexity.
Using the YOLO-DBS model, we designed an efficient multi-scale feature fusion pyramid network BiFPN by replacing the C2f module in the backbone network with the DCFB module. We also added a SENetV2 module after the input layer of the detection head to enhance feature extraction and fusion capabilities and reduce computational costs.
It significantly improves the detection capability of small target defects, reduces computational costs, optimizes the feature extraction and fusion process, enhances the lightweight nature and detection efficiency of the model, and meets the real-time requirements of industry.
Smart Images

Figure CN120953184A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision technology, and in particular relates to a method for SOP defect detection based on lightweight multi-scale feature fusion. Background Technology
[0002] With the rapid development of semiconductor manufacturing processes, Small Outline Packages (SOPs) have become one of the mainstream packaging technologies due to their ease of handling and high reliability. However, due to factors such as material quality, manufacturing equipment, and operating environment, various defects such as bending, missing parts, and pits can occur on the surface of SOPs during the manufacturing process. These microscopic defects can significantly reduce the reliability of SOPs and even lead to the failure of integrated circuit functions. Therefore, surface defect detection has become a core step in ensuring product yield.
[0003] SOP (Surface Mount Technology) surface defect detection methods can be categorized into traditional defect detection methods, machine learning-based methods, and deep learning-based methods. Early SOP chip defect detection primarily relied on manual visual inspection, which was simple and easy to implement, but suffered from numerous drawbacks such as low accuracy and efficiency, and a lack of standardized procedures. Because traditional defect detection methods could not meet the needs of industrial production line inspection, machine learning-based methods have gradually been applied to the field of defect detection.
[0004] Machine learning methods, combining feature engineering with classification algorithms, offer a high-precision, low-cost solution for SOP defect detection. However, this approach still has significant limitations. For instance, existing image processing algorithms struggle to handle multi-scale and dense defects, rely on manual feature engineering, and have limited generalization capabilities. Furthermore, complex algorithm combinations consume substantial computational resources, resulting in single-image detection times of several minutes, which cannot meet the real-time detection requirements of production lines. Therefore, deep learning-based defect detection methods are increasingly being applied to the quality inspection of electronic information products.
[0005] Currently, deep learning-based object detection models are mainly divided into two categories: two-stage and single-stage. Two-stage models primarily include Faster R-CNN (Faster Region-based Convolutional Neural Network) and Mask R-CNN (Mask Region-based Convolutional Neural Network). Due to their strong feature extraction capabilities for small objects and stable model training, two-stage detectors are widely used in industrial detection. However, these detectors require first generating candidate regions and then classifying them, resulting in extremely high computational costs, making it difficult to meet real-time requirements. Furthermore, the large number of model parameters and high memory consumption lead to high deployment costs for the detection models.
[0006] With the increasing demand for real-time performance in industrial inspection, more and more research is focusing on the development and application of single-stage detectors. Classic single-stage detection models include SSD (Single Shot MultiBox Detector) and the YOLO (You Only Look Once) series of network models. These detectors abandon the region proposal step in two-stage models such as Faster R-CNN, directly regressing the target location and category on the feature map, greatly accelerating the target detection speed. YOLOv1, as the first proposed single-stage detector, far surpasses two-stage detectors in detection speed while maintaining similar detection accuracy. The subsequent SSD model implemented multi-scale feature map fusion, further improving the performance of single-stage detectors. YOLOv8, released in 2023, adopts a decoupled head design and uses an anchor-free mechanism, effectively improving the detection capability of small target defects. In the detection of surface defects of packaged chips in industrial scenarios, YOLOv8 has shown great application potential. However, despite YOLOv8's outstanding performance, it still faces some challenges, such as poor robustness in the complex environment of production lines, insufficient ability to capture features of small target defects, and limited model generalization ability, requiring frequent parameter adjustments. Therefore, how to effectively improve the model's feature extraction capability while ensuring real-time performance and low latency has gradually become a key issue for deep learning object detection algorithms to overcome bottlenecks in practical industrial applications.
[0007] Overall, existing surface defect detection methods for SOPs have achieved significant improvements in detection accuracy and model complexity, but they still fail to meet the synergistic requirements of high accuracy and model complexity in practical industrial applications. Therefore, to address the challenge of balancing accuracy and model complexity, a surface defect detection solution for SOPs that balances lightweight design with high accuracy is urgently needed. Summary of the Invention
[0008] To address the challenges of large parameter count, high computational complexity, low detection accuracy, and difficulty in meeting the real-time and edge deployment requirements of deep learning models in SOP packaged chip surface defect detection, this invention provides an SOP defect detection method based on lightweight multi-scale feature fusion.
[0009] The present invention provides a SOP defect detection method based on lightweight multi-scale feature fusion, comprising the following steps:
[0010] Step 1: Obtain the SOP defect image and annotate the defect image.
[0011] Step 2: Based on YOLOv8n, propose the YOLO-DBS (YOLO-DCFB-BiFPN-SENetV2) model; replace the C2f (Convolutional Block with Two Feature Maps) module in the backbone network with the DCFB (Dual-CoordAtt Fusion Bottleneck) module, design an efficient multi-scale feature fusion pyramid network BiFPN (Bidirectional Feature Pyramid Network), and add the SENetV2 (SqueezeAggregated Excitation Networks V2) module after the input layer of the detector head.
[0012] Step 3: Train the improved algorithm model using the training set of surface defect images of SOP packaged chips.
[0013] Step 4: Input the defect image test set into the trained model, record the detection results and evaluate the model performance.
[0014] Further, step 1 specifically involves: obtaining a dataset of surface defects on SOP packaged chips, using the Labelimg tool to annotate the dataset images, and generating a TXT format label file.
[0015] Furthermore, the YOLO-DBS model is as follows:
[0016] The dataset is input into the backbone network, passes through a 5-level Conv downsampling module, and a DCFB module is added after layers P2, P3, P4, and P5. The DCFB module solves the problem of diverse defect shapes through channel attention mechanism and multi-layer residual connections, and enhances the feature capture capability of small defects. Then, after the spatial pyramid pooling SPPF operation, the output result is transmitted to the neck network.
[0017] In the neck network, a lightweight multi-scale feature fusion network with a BiFPN (Bidirectional Feature Pyramid Network) core is designed. Furthermore, an SENetV2 module is added after the output layer of the feature network. First, the input P3, P4, and P5 layer feature maps are convolved with 1×1 to unify the number of channels to 256, eliminating redundant information. Then, multi-scale dual-path fusion is performed: P5 layer features are upsampled and concatenated with P4 layer features, then fused with the DCFB module. Further upsampling and concatenation with P3 layer features are performed and optimized through DCFB fusion to generate high-resolution features, preserving details of minor defects. P2 layer features are convolved with 3×3 to unify the number of channels to 256, and the feature map is downsampled to 80×80, then fused with P3 layer features and other network features. The features of the first layer are concatenated and then fused using the DCFB module. Further downsampling to 40×40, this feature is concatenated with the features of layer P4 and the previous layer in the network structure, and then fused using the DCFB module. Next, downsampling to 20×20, this feature is concatenated and fused with the features of layer P5. Then, the feature maps of layers P3, P4, and P5 are output to the SENetV2 module. Through the squeezing and excitation operations of the multi-branch fully connected layers, the model's ability to capture small defects in similar backgrounds is enhanced, and the interference of external noise is reduced, further improving the model's ability to identify small defects. Finally, the feature maps of the three different scales are input to the detection head, which outputs the defect classification and location information in the detected image.
[0018] Furthermore, the DCFB module specifically includes:
[0019] First, a 1×1 convolutional kernel is used for channel separation. One part is directly passed to the final dynamic gating (Concat) module, while the other part is passed to the subsequent Bottleneck and Coordinate Attention (CA) modules. This reduces the input feature map to half its original size, thereby reducing computational and memory consumption. Then, the segmented feature map is processed by multiple Bottleneck and CA (Coordinate Attention) modules to extract deeper feature information. Next, residual connections are used to concatenate the outputs of all Bottleneck modules and the previously segmented, unprocessed feature maps, enhancing feature extraction capabilities. Finally, a 1×1 convolutional kernel is used to restore the number of channels in the concatenated feature map.
[0020] Furthermore, the BiFPN network structure achieves efficient interaction of multi-scale features through top-down and bottom-up dual-path fusion. The input feature maps of layers P3, P4, and P5 are first uniformly processed to 256 channels via 1×1 convolution, and then enter dual-path fusion: the P5 layer features are upsampled to 40×40, concatenated with the compressed P4 layer features through a Bi-Concat (Bidirectional-Concat) module, fused by the C2f module, and then upsampled again to 80×80, concatenated with the P3 layer features, and then... Feature fusion is performed through the C2f module; the features of layer P2 are first convolved with 3×3 to unify the channels to 256, and the feature map is downsampled to 80×80, concatenated with the features of layer P3 and the features of the previous layer in the network structure, and then fused with the features of the C2f module to generate a small-scale feature map; it is further downsampled to 40×40, concatenated with the features of layer P4 and the features of the previous layer in the network structure, and fused through the C2f module to generate a medium-scale feature map; finally, it is downsampled to 20×20, concatenated and fused with the features of layer P5 to generate a large-scale feature map.
[0021] Furthermore, in the SENetV2 module, firstly, global average pooling is performed on the input feature map to capture global information between channels, providing a foundation for subsequent feature concatenation and weighting. Next, dimensionality reduction and full connectivity are used to compress the feature data into a one-dimensional fully connected layer, and a multi-branch structure enhances the network's learning ability. Then, the fully connected layers on different branches are concatenated, fusing the different feature representations learned by the branches to form a more comprehensive and accurate feature description, thereby suppressing noise interference and enhancing the ability to capture minor defects in similar backgrounds. Finally, dimensionality increase and full connectivity are used to transform the one-dimensional concatenated features into weight coefficients with the same number of channels as the input feature map. The weight coefficients are then multiplied element-wise with the input feature map, thereby enhancing important features, suppressing unimportant features, and improving the model's adaptability to different noise interference.
[0022] Furthermore, step 3 specifically involves: after improving the YOLOv8 model, training the YOLO-DBS model: the input image size is set to 640×640 pixels, the initial learning rate and the final learning rate are both set to 0.01, the number of iterations is 500 cycles, and the batch size is set to 8.
[0023] Furthermore, the model performance metrics in step 4 are:
[0024] Regarding detection accuracy, the Mean Average Precision (mAP) is used as the evaluation metric, and its specific definition is as follows:
[0025]
[0026] Where Precision refers to the proportion of actual samples among all targets detected as positive; Recall refers to the proportion of targets detected as positive among all actual positive samples; TP (TruePositive) represents the number of correctly detected defects, i.e., defects that actually exist and are correctly predicted by the model; FP (FalsePositive) represents the number of falsely detected defects, i.e., regions that are actually without defects but are incorrectly predicted as defects by the model; FN (FalseNegative) represents the number of missed defects, i.e., defects that actually exist but are not detected by the model; n is the number of defect categories; AP i This represents the average classification accuracy of the i-th class.
[0027] In terms of overall performance, the F1 score (F1_Score) is used as the overall evaluation metric. The F1 score represents the harmonic mean of precision and recall, reflecting the overall performance of the model. The specific definition is as follows:
[0028]
[0029] In terms of computational efficiency, parameters, GFLOPs (Global Floor Operations), and inference time are used as evaluation metrics. Parameters represent the total number of trainable parameters of the model, measuring the model's storage and transmission costs. GFLOPs represent the number of floating-point operations required for forward inference, reflecting the model's computational complexity. Inference time represents the time required for the model to process a single image, determining the real-time performance of production line detection. The specific definitions are as follows:
[0030] FLOPs = 2 × H out ×W out ×K 2 ×C in ×C out
[0031] GFLOPs = 10 9 FLOPs
[0032] Among them, H out W out These represent the height and width of the output feature map, respectively; K represents the size of the convolution kernel; C in and C out These represent the number of input and output channels, respectively; pre is the model's preprocessing time, including the time consumed by image scaling, padding, and channel conversion; inference is the model's inference time, i.e., the model's forward computation time.
[0033] The beneficial technical effects of this invention compared to the prior art are as follows:
[0034] The proposed SOP surface defect detection algorithm, YOLO-DBS, significantly reduces computational costs while enhancing small-target defect detection capabilities through the design of a feature extraction module (DCFB), a lightweight multi-scale feature fusion pyramid network (BiFPN), and a squeezing and excitation module (SENetV2). The optimized feature extraction and fusion process further improves the model's lightweight nature and detection efficiency. Comparison with mainstream target detection algorithms on a self-built SOP defect dataset verifies the superiority and effectiveness of the YOLO-DBS model in SOP defect detection. This invention provides a novel lightweight solution for SOP surface defect detection, demonstrating a significant advantage in model efficiency. Attached Figure Description
[0035] Figure 1 This is a diagram of the YOLO-DBS model framework proposed in this invention.
[0036] Figure 2 This is a structural diagram of the DCFB module.
[0037] Figure 3 This is a structural diagram of the BiFPN multi-scale feature fusion module.
[0038] Figure 4 This is a diagram of the Bi-Concat structure.
[0039] Figure 5 This is a diagram of the SENetV2 architecture.
[0040] Figure 6 The detection results for the experimental SOP defect dataset are shown in the image ((a) pits; (b) scratches; (c) bends; (d) missing parts; (e) oil stains). Detailed Implementation
[0041] The present invention will be further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0042] The present invention provides a SOP defect detection method based on lightweight multi-scale feature fusion, comprising the following steps:
[0043] Step 1: Obtain the SOP defect image and annotate the defect image.
[0044] Obtain the SOP surface defect dataset, use the Labelimg tool to annotate the dataset images, and generate a TXT format label file.
[0045] Step 2: Propose the YOLO-DBS model based on YOLOv8n; replace the C2f module in the backbone network with the DCFB module, design an efficient multi-scale feature fusion pyramid network BiFPN, and add the SENetV2 module after the input layer of the detection head.
[0046] The YOLO-DBS model framework is as follows: Figure 1 As shown, specifically:
[0047] The dataset is input into the backbone network, passes through a 5-level Conv downsampling module, and a DCFB module is added after layers P2, P3, P4, and P5. The DCFB module solves the problem of diverse defect shapes through channel attention mechanism and multi-layer residual connections, and enhances the feature capture capability of small defects. Then, after the spatial pyramid pooling SPPF operation, the output result is transmitted to the neck network.
[0048] In the neck network, a lightweight multi-scale feature fusion network based on the BiFPN bidirectional feature pyramid structure is designed. Furthermore, an SENetV2 module is added after the output layer of the feature network. First, the input P3, P4, and P5 layer feature maps are convolved with 1×1 to unify the number of channels to 256, eliminating redundant information. Then, multi-scale dual-path fusion is performed: the P5 layer features are upsampled and concatenated with the P4 layer features before being fused with the DCFB module; further upsampling is performed, concatenating with the P3 layer features and optimizing through fusion with the DCFB module to generate high-resolution features while preserving details of minor defects; the P2 layer features are convolved with 3×3 to unify the number of channels to 256, and the feature map is downsampled to 80×80, then fused with the P3 layer features and the network structure. The features of the first layer are concatenated and then fused using the DCFB module. Further downsampling to 40×40, this feature is concatenated with the features of layer P4 and the previous layer in the network structure, and then fused using the DCFB module. Next, downsampling to 20×20, this feature is concatenated and fused with the features of layer P5. Then, the feature maps of layers P3, P4, and P5 are output to the SENetV2 module. Through the squeezing and excitation operations of the multi-branch fully connected layers, the model's ability to capture small defects in similar backgrounds is enhanced, and the interference of external noise is reduced, further improving the model's ability to identify small defects. Finally, the feature maps of the three different scales are input to the detection head, which outputs the defect classification and location information in the detected image.
[0049] Furthermore, the DCFB module structure is as follows: Figure 2 As shown, specifically:
[0050] First, a 1×1 convolutional kernel is used for channel separation. One part is directly passed to the final Concat module, while the other part is passed to the subsequent Bottleneck and CA modules, reducing the input feature map to half of its original size to reduce computation and memory consumption. Then, the segmented feature map is processed by multiple Bottleneck and CA modules to extract deeper feature information. Next, residual connections are used to concatenate the outputs of all Bottleneck modules and the previously segmented, unprocessed feature maps to enhance feature extraction capabilities. Finally, a 1×1 convolutional kernel is used to restore the number of channels in the concatenated feature map.
[0051] Furthermore, the BiFPN structure is as follows: Figure 3 As shown, the BiFPN network structure achieves efficient interaction of multi-scale features through top-down and bottom-up dual-path fusion. The input feature maps of layers P3, P4, and P5 are first unified to 256 through a 1×1 convolution, and then enter the dual-path fusion: the P5 layer features are upsampled to 40×40, concatenated with the compressed P4 layer features through the Bi-Concat (Bidirectional-Concat) module, fused by the C2f module, and then upsampled to 80×80, concatenated with the P3 layer features, and then fused by the C2f module. The 2f module performs feature fusion; the features from layer P2 are first convolved with 3×3 to unify the channels to 256, and then downsampled to 80×80. This is then concatenated with the features from layer P3 and the previous layer in the network structure, followed by feature fusion with the C2f module to generate a small-scale feature map. This is further downsampled to 40×40, concatenated with the features from layer P4 and the previous layer in the network structure, and fused again with the C2f module to generate a medium-scale feature map. Finally, it is downsampled to 20×20, concatenated and fused with the features from layer P5 to generate a large-scale feature map. The Bi-Concat module structure is as follows: Figure 4 As shown.
[0052] Furthermore, the squeezing and excitation modules SENetV2, such as Figure 5As shown, this is applied to the input layer of the detection head. Global average pooling is performed on the input feature map to capture global information between channels, providing a foundation for subsequent feature concatenation and weighting. Next, the feature data is compressed into a one-dimensional fully connected layer using the dimensionality reduction and fully connected RDFC (Reduced-dimensional full connection) module, and the learning ability of the network is enhanced through a multi-branch structure. Then, the fully connected layers on different branches are concatenated, fusing the different feature representations learned by the branches to form a more comprehensive and accurate feature description, thereby suppressing noise interference and enhancing the ability to capture small defects in similar backgrounds. Finally, the one-dimensional concatenated features are transformed into weight coefficients with the same number of channels as the input feature map using the up-dimensional and fully connected UDFC (Up-dimensional full connection) module. The weight coefficients are then multiplied element-wise with the input feature map, thereby enhancing important features, suppressing unimportant features, and improving the model's adaptability to different noise interference.
[0053] Step 3: Train the improved algorithm model using the SOP surface defect image training set.
[0054] After improving the YOLOv8 model, the YOLO-DBS model was trained: the input image size was set to 640×640 pixels, the initial and final learning rates were both set to 0.01, the number of iterations was 500 cycles, and the batch size was set to 8.
[0055] Step 4: Input the defect image test set into the trained model, record the detection results and evaluate the model performance.
[0056] The model performance metrics are:
[0057] Regarding detection accuracy, the Mean Average Precision (mAP) is used as the evaluation metric, and its specific definition is as follows:
[0058]
[0059] Where Precision refers to the proportion of actual samples among all targets detected as positive; Recall refers to the proportion of targets detected as positive among all actual positive samples; TP (TruePositive) represents the number of correctly detected defects, i.e., defects that actually exist and are correctly predicted by the model; FP (FalsePositive) represents the number of falsely detected defects, i.e., regions that are actually without defects but are incorrectly predicted as defects by the model; FN (FalseNegative) represents the number of missed defects, i.e., defects that actually exist but are not detected by the model; n is the number of defect categories; AP i This represents the average classification accuracy of the i-th class.
[0060] In terms of overall performance, the F1 score (F1_Score) is used as the overall evaluation metric. The F1 score represents the harmonic mean of precision and recall, reflecting the overall performance of the model. The specific definition is as follows:
[0061]
[0062] In terms of computational efficiency, parameters, GFLOPs (Global Floor Operations), and inference time are used as evaluation metrics. Parameters represent the total number of trainable parameters of the model, measuring the model's storage and transmission costs. GFLOPs represent the number of floating-point operations required for forward inference, reflecting the model's computational complexity. Inference time represents the time required for the model to process a single image, determining the real-time performance of production line detection. The specific definitions are as follows:
[0063] FLOPs = 2 × H out ×W out ×K 2 ×C in ×C out
[0064] GFLOPs = 10 9 FLOPs
[0065] Among them, H out W out These represent the height and width of the output feature map, respectively; K represents the size of the convolution kernel; C in and C out These represent the number of input and output channels, respectively; pre is the model's preprocessing time, including the time consumed by image scaling, padding, and channel conversion; inference is the model's inference time, i.e., the model's forward computation time.
[0066] Experimental verification:
[0067] The proposed method was compared with mainstream target detection algorithms by testing on a self-built SOP defect dataset and a publicly available PCB dataset. The comparison results on the SOP dataset are shown in Table 1, and the comparison results on the PCB dataset are shown in Table 2. The detection performance of this method is as follows: Figure 6 As shown.
[0068] Table 1 shows the performance comparison experiments on the SOP dataset.
[0069]
[0070] Table 2 shows the performance comparison experiments on the PCB dataset.
[0071]
[0072]
[0073] Combining the experimental data from Table 1 (SOP dataset) and Table 2 (PCB dataset), the method of this invention outperforms the comparative algorithms in both accuracy and model complexity balance. The model achieves optimal performance in mAP@0.5, mAP@0.5-0.95, F1 score, and parameters, reaching 99.4% at mAP@0.5. The number of parameters is 2.5M, a reduction of 0.5M compared to the YOLOv8 baseline model, and the lowest among all models, indicating that redundant structures have been removed through structural optimization. Although the method of this invention does not have the lowest GFLOPs, it still effectively reduces computational complexity compared to the original YOLOv8n model. In terms of overall performance, YOLO-DBS significantly outperforms the YOLO series and RT-DETR models. Furthermore, the method of this invention demonstrates superior performance compared to the GCC-YOLO model, fully demonstrating its comprehensive advantages in detection accuracy and efficiency. It demonstrated excellent transfer performance on the public PCB defect dataset, with an mAP@0.5 of 99.1%, which is still at the highest detection accuracy level, indicating that the model achieves a better balance between accuracy and model complexity while maintaining high detection accuracy.
Claims
1. A method for detecting SOP defects based on lightweight multi-scale feature fusion, characterized in that, Includes the following steps: Step 1: Obtain SOP defect images and annotate the defect images; Step 2: Propose the YOLO-DBS model based on YOLOv8n; replace the C2f module in the backbone network with the DCFB module, design an efficient multi-scale feature fusion pyramid network BiFPN, and add the SENetV2 module after the input layer of the detection head; Step 3: Train the improved algorithm model using a training set of surface defect images of SOP packaged chips; Step 4: Input the defect image test set into the trained model, record the detection results, and evaluate the model performance.
2. The SOP defect detection method based on lightweight multi-scale feature fusion according to claim 1, characterized in that, Step 1 specifically involves: obtaining a dataset of surface defects on SOP packaged chips, using the Labelimg tool to annotate the dataset images, and generating a TXT format label file.
3. The SOP defect detection method based on lightweight multi-scale feature fusion according to claim 1, characterized in that, The YOLO-DBS model is specifically as follows: The dataset is input into the backbone network, passes through a 5-level Conv downsampling module, and a DCFB module is added after layers P2, P3, P4, and P5; then, after a spatial pyramid pooling SPPF operation, the output is transmitted to the neck network. In the neck network, a lightweight multi-scale feature fusion network with a bidirectional feature pyramid network structure BiFPN as its core is designed. Furthermore, a SENetV2 module is added after the output layer of the feature network; firstly, 1×1 convolutions are performed on the input P3, P4 and P5 layer feature maps, with a unified channel number of 256, to eliminate redundant information; The process then proceeds to multi-scale dual-path fusion: P5 layer features are upsampled and concatenated with P4 layer features before being fused with the DCFB module; upsampling continues, concatenating with P3 layer features and optimizing through the DCFB module to generate high-resolution features while preserving minute defect details; P2 layer features are unified to 256 channels through a 3×3 convolution and downsampled to 80×80, concatenated with P3 layer features and features from the previous layer in the network structure, and then fused through the DCFB module; further downsampling to 40×40, concatenating with P4 layer features and features from the previous layer in the network structure, and then fused through the DCFB module; finally, downsampling to 20×20, concatenating and fusing with P5 layer features; Then, the feature maps of layers P3, P4, and P5 are output to the SENetV2 module respectively; finally, the feature maps of three different scales are input to the detection head, and the defect classification and location information in the detection image are output from the detection head.
4. The SOP defect detection method based on lightweight multi-scale feature fusion according to claim 3, characterized in that, The DCFB module is specifically: First, a 1×1 convolutional kernel is used for channel separation. One part is directly passed to the final dynamic gating concat module, while the other part is passed to the subsequent Bottleneck and CA modules. The input feature map is reduced to half of its original size to reduce computation and memory consumption. Then, the segmented feature map is processed by multiple Bottleneck and CA modules. The segmented feature map is processed in multiple Bottleneck and spaced-add CA modules, and deeper feature information is extracted through multiple 3×3 convolutional kernels and channel attention mechanism. Next, residual connections are used to concatenate the outputs of all Bottleneck modules and the previously segmented unprocessed feature map to enhance feature extraction capabilities. Finally, a 1×1 convolutional kernel is used to restore the number of channels in the concatenated feature map.
5. The SOP defect detection method based on lightweight multi-scale feature fusion according to claim 3, characterized in that, The BiFPN network structure achieves efficient interaction of multi-scale features through top-down and bottom-up dual-path fusion; The input feature maps of layers P3, P4, and P5 are first uniformly scaled to 256 through a 1×1 convolution, and then undergo dual-path fusion: the P5 layer features are upsampled to 40×40, concatenated with the compressed P4 layer features through a Bi-Concat module, fused through a C2f module, and then upsampled to 80×80, concatenated with the P3 layer features, and then fused through a C2f module; the P2 layer features are first uniformly scaled to 256 through a 3×3 convolution, and then downsampled to 80×80, concatenated with the P3 layer features and the features of the previous layer in the network structure, and then fused through a C2f module to generate a small-scale feature map; further downsampled to 40×40, concatenated with the P4 layer features and the features of the previous layer in the network structure, and fused through a C2f module to generate a medium-scale feature map; finally, downsampled to 20×20, concatenated and fused with the P5 layer features to generate a large-scale feature map.
6. The SOP defect detection method based on lightweight multi-scale feature fusion according to claim 3, characterized in that, In the SENetV2 module, firstly, global average pooling is performed on the input feature map to capture global information between channels, providing a foundation for subsequent feature concatenation and weighting. Next, dimensionality reduction and full connectivity are used to compress the feature data into a one-dimensional fully connected layer, and a multi-branch structure enhances the network's learning ability. Then, the fully connected layers on different branches are concatenated, fusing the different feature representations learned by the branches to form a more comprehensive and accurate feature description, thereby suppressing noise interference and enhancing the ability to capture minor defects in similar backgrounds. Finally, dimensionality increase and full connectivity are used to transform the one-dimensional concatenated features into weight coefficients with the same number of channels as the input feature map. The weight coefficients are then multiplied element-wise with the input feature map, thereby enhancing important features, suppressing unimportant features, and improving the model's adaptability to different noise interference.
7. The SOP defect detection method based on lightweight multi-scale feature fusion according to claim 1, characterized in that, Step 3 specifically involves: after improving the YOLOv8 model, training the YOLO-DBS model: the input image size is set to 640×640 pixels, the initial learning rate and the final learning rate are both set to 0.01, the number of iterations is 500 cycles, and the batch size is set to 8.
8. The SOP defect detection method based on lightweight multi-scale feature fusion according to claim 1, characterized in that, The model performance metrics in step 4 are: Regarding detection accuracy, the mean accuracy (mAP) is used as the evaluation index, and its specific definition is as follows: Where Precision refers to the proportion of actual samples among all targets detected as positive; Recall refers to the proportion of targets detected as positive among all actual positive samples; TP represents the number of correctly detected defects, i.e., defects that actually exist and are correctly predicted by the model; FP represents the number of falsely detected defects, i.e., areas that are actually without defects are incorrectly predicted as defects by the model; FN represents the number of missed defects, i.e., defects that actually exist but are not detected by the model; n is the number of defect categories; AP i This represents the average classification accuracy of the i-th class; In terms of overall performance, the F1 score (F1_Score) is used as the overall evaluation metric. The F1 score represents the harmonic mean of precision and recall, reflecting the overall performance of the model. The specific definition is as follows: In terms of computational efficiency, parameters, GFLOPs (Global Floor Operations), and inference time are used as evaluation metrics. Parameters represent the total number of trainable parameters in the model, measuring the model's storage and transmission costs. GFLOPs represent the number of floating-point operations required for forward inference, reflecting the model's computational complexity. Inference time represents the time required for the model to process a single image, determining the real-time performance of production line detection. The specific definitions are as follows: FLOPs=2×H out ×W out ×K 2 ×C in ×C out GFLOPs=10 9 FLOPs Among them, H out W out These represent the height and width of the output feature map, respectively; K represents the size of the convolution kernel; C in and C out These represent the number of input and output channels, respectively; pre is the model's preprocessing time, including the time consumed by image scaling, padding, and channel conversion; inference is the model's inference time, i.e., the model's forward computation time.
Citation Information
Cited By
Defect detection method and system for single-terminal wire
CN121366155A
Wind power generation blade surface defect detection method and system based on TFPN-YOLO model
CN121544619A
A wind power generation blade surface defect detection method and system based on a TFPN-YOLO model
CN121544619B
Dynamic multi-scale fusion fabric defect detection method and related device
CN121563995A
