Surface defect detection method

By introducing the BDCA, WAMF, and BEDU modules into YOLOv1, the problem of insufficient robustness of the YOLO series in metal surface defect detection has been solved, improving detection accuracy and noise tolerance, making it suitable for metal surface defect detection under complex working conditions.

CN121582544APending Publication Date: 2026-02-27NANJING VOCATIONAL UNIV OF IND TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511672764.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-14
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing YOLO series single-stage detectors are not robust enough when deployed on edge computing devices, have high computational complexity, and need to improve detection accuracy. In particular, they face difficulties in detecting small-scale, low-contrast targets in metal surface defect detection, and are easily affected by insufficient light and dust interference.

Method used

Based on YOLOv1, the BDCA module is introduced to replace the splicing operation of the neck network, and the features of deep and shallow layers are fused through bidirectional cross attention; the WAMF module is used for image preprocessing to decouple low-frequency and high-frequency features; and the BEDU module is used to enhance feature fusion and improve the ability to fuse global and local information.

Benefits of technology

It significantly improves the detection accuracy and robustness of the model, especially its ability to capture low-contrast and small targets under complex working conditions, suppresses high-frequency noise interference, and is suitable for surface defect detection of metallic materials.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582544A_ABST
    Figure CN121582544A_ABST
Patent Text Reader

Abstract

The invention provides a surface defect detection method, which adopts a neural network improved based on YOLOv11 as a surface defect detection model, and adopts a WAMF module to pre-process an input original surface image on the basis of YOLOv11 to realize decoupling of low-frequency and high-frequency characteristics and adaptive multi-band fusion so as to suppress high-frequency noise interference; a BEDU module is adopted to enhance features of a fusion part of a backbone network shallow layer and a neck network, global and local information is effectively fused, and the capturing capability of low contrast and tiny targets is improved; a BDCA module is adopted to fuse deep and shallow features in a neck network, and cross-level semantic information complementation is realized through a bidirectional cross attention mechanism. Particularly in the aspect of metal surface defect detection, compared with other YOLO series models, the improved network model has higher detection precision and robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision technology, and specifically relates to a surface defect detection method. Background Technology

[0002] The complexity of manufacturing processes can lead to various defects in products, such as cracks, holes, and corrosion. These defects not only cause quality loss but can also trigger a chain reaction of failures. Traditional surface defect detection relies heavily on manual inspection, but due to differences in personnel experience, inconsistencies in results, such as false positives and false negatives, are easily caused. Therefore, developing robust, high-precision surface defect detection models that can be deployed on edge devices is crucial for ensuring production quality and improving operational efficiency.

[0003] With the rapid development of deep learning technology, convolutional neural networks are increasingly widely used in object detection tasks. Two-stage detection algorithms, represented by Faster R-CNN, excel in surface defect detection due to their high accuracy. Although these methods perform well in defect recognition accuracy, their relatively low detection speed makes it difficult to meet the real-time requirements of industrial scenarios. In contrast, single-stage detection algorithms, represented by the YOLO series, treat object detection as an end-to-end regression problem, improving detection speed by directly predicting the anchor point positions on the feature map.

[0004] While current single-stage detectors based on the YOLO series offer significant speed advantages, their deployment on edge computing devices still faces challenges such as insufficient robustness, high computational complexity, and room for improvement in detection accuracy. Furthermore, unlike object detection in general images, industrial scenarios often involve images of metal surfaces containing numerous small-scale, low-contrast, multi-class defects, and these defects are typically sparsely distributed spatially.

[0005] Furthermore, due to the prevalent insufficient lighting and dust interference in working conditions, images of metal surfaces often exhibit a coexistence of high-frequency noise components and spectral aliasing background textures. These characteristics not only increase the complexity of feature extraction but may also lead to the loss of fine-grained details and key features, ultimately limiting the model's detection performance and reducing detection accuracy. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention provides a surface defect detection method to improve the detection accuracy and robustness of the detection model under complex working conditions.

[0007] The present invention achieves the above-mentioned technical objectives through the following technical means.

[0008] A surface defect detection method: Surface defect detection is performed on an image of the object under test using the following detection model; the detection model is:

[0009] Based on YOLOv11, the BDCA module is used to replace the splicing operation in the original neck network; in the BDCA module, the shallow and deep features of the input are fused through bidirectional cross attention.

[0010] Furthermore, the BDCA module is as follows:

[0011] For the two input feature maps and The depthwise separable convolution and tensor block mapping are applied sequentially to obtain the following results: , , and , , ;

[0012] Perform bidirectional cross-attention calculation to obtain two fused features. and :

[0013]

[0014]

[0015] In the formula, This indicates Softmax normalization. The number of channels in the feature map;

[0016] The two fused features are then concatenated:

[0017]

[0018] Income As the output of the module.

[0019] Furthermore, in the backbone network, a WAMF module is used to preprocess the input image. The WAMF module is as follows:

[0020] For the input image Perform a two-dimensional discrete wavelet transform to decompose it into low-frequency components. Horizontal high-frequency components Vertical high frequency components Diagonal high frequency components ;

[0021] The four components are concatenated to obtain the concatenated feature map. ;

[0022] Multi-head attention mechanism is used to stitch feature maps Adaptive fusion is performed, and the result is used as the module's output.

[0023] Furthermore, the adaptive fusion step is as follows:

[0024] splicing feature map After performing average pooling, normalization, and flattening in sequence, subband feature maps are obtained through three 1×1 two-dimensional convolutions. , , ;

[0025] Subband Feature Mapping , , The weights of the four components are obtained through the following processing. , , , :

[0026]

[0027] In the formula, Indicates Sigmoid activation. This indicates Softmax normalization. The number of channels in the feature map;

[0028] Weight With splicing feature map After multiplication, a fused feature map is obtained through a 1×1 two-dimensional convolution. As the output of the module.

[0029] Furthermore, feature enhancement is performed using a BEDU module, which is:

[0030] Input image The feature map is obtained by bottleneck convolution. :

[0031] Feature map The feature map is obtained through variable convolution. :

[0032] Feature map The feature map is obtained by sequentially performing variable convolution and bottleneck convolution. ;

[0033] Feature map With feature map By splicing the images together, we obtain the feature map. ;

[0034] Feature map The feature map is obtained through variable convolution. ;

[0035] Feature map With feature map The concatenation is performed, and the resulting image is then subjected to bottleneck convolution to output the enhanced feature map. .

[0036] Furthermore, the variable convolution, from front to back, is as follows: two-dimensional dilated convolution → BatchNorm normalization → ReLU activation;

[0037] For feature maps In the variable convolution, the dilation rate is 2, which is applied to the feature map. The dilation rate in the variable convolution is 4, targeting the feature map. The dilation rate in the variable convolution is 2.

[0038] Furthermore, the bottleneck convolutions are arranged from front to back as follows: 1×1 point convolution for dimensionality reduction → depthwise convolution → 1×1 point convolution for dimensionality increase → BatchNorm normalization → ReLU activation;

[0039] The compression ratio of the 1×1 point convolution is 4.

[0040] Furthermore, in the backbone network, the input image passes through WAMF→WAMF→BEDU→WAMF sequentially to obtain a feature map with a scale of 256×80×80, which is then output to the C3k2 module.

[0041] Furthermore, in the neck network:

[0042] The feature map with a scale of 1024×20×20 output by the backbone network is upsampled and then resized to 512×40×40 through convolution. It is then fused with the feature map with a scale of 512×40×40 output by the backbone network. The fused feature map is then enhanced by the BEDU module.

[0043] The feature map with a scale of 512×40×40 extracted from the neck network is scaled and then enhanced by the BEDU module. After that, it is fused with the feature map with a scale of 1024×20×20 output from the backbone network.

[0044] Furthermore, it is used for surface defect detection in metallic materials.

[0045] The beneficial effects of this invention are as follows:

[0046] (1) This invention provides a surface defect detection method. Based on YOLOv11, by adding three modules, WAMF, BEDU and BDCA, the detection accuracy and robustness of the model are effectively improved. In particular, the BDCA module replaces the original simple splicing operation to fuse the deep and shallow features in the neck network. Through the bidirectional cross attention mechanism, cross-level semantic information complementarity is achieved, which significantly improves the detection accuracy of the model.

[0047] (2) The present invention preprocesses the input original image through the WAMF module to achieve decoupling of low-frequency and high-frequency features and adaptive multi-band fusion, thereby suppressing high-frequency noise interference.

[0048] (3) The present invention enhances the features of the shallow layer of the backbone network and the fusion part of the neck network through the BEDU module, effectively integrates global and local information, and improves the ability to capture low-contrast and small targets.

[0049] (4) The detection model proposed in this invention is particularly suitable for the detection of surface defects in metallic materials; actual testing has verified that it exhibits superior performance compared to other YOLO models. Attached Figure Description

[0050] Figure 1 This is a diagram of the network structure improved by YOLOv11 in this invention;

[0051] Figure 2 Diagram of the existing YOLOv11 network structure;

[0052] Figure 3 This is a network structure diagram of the wavelet attention multi-band fusion (WAMF) module in this invention;

[0053] Figure 4 This is a network structure diagram of the bottleneck-enhanced dilated U-shaped convolution (BEDU) module in this invention;

[0054] Figure 5 This is a network structure diagram of the bidirectional deep cross-attention (BDCA) module in this invention;

[0055] Figure 6 The graph shows the training loss and evaluation metrics of the model of this invention and the baseline model (YOLOv11n) on the GC10-DET dataset.

[0056] Figure 7 The graph shows the training loss and evaluation metrics of the model of this invention and the baseline model (YOLOv11n) on the NEU-DET dataset;

[0057] Figure 8 Comparison samples of heatmap visualization of detection results on the NEU-DET dataset;

[0058] Figure 9 Comparison samples of heatmap visualization of detection results on the GC10-DET dataset;

[0059] Figure 10 Comparison samples of defect detection on the NEU-DET dataset under different noise intensities;

[0060] Figure 11 Comparison samples of defect detection on the GC10-DET dataset under different noise intensities. Detailed Implementation

[0061] Embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein similar or identical reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0062] I. Technical Solution

[0063] For the task of surface defect detection, this invention uses a neural network based on YOLOv11 as the surface defect detection model; Figure 2 The image shows the original YOLOv11 network structure. Figure 1 The diagram shows the improved network structure of this invention. Compared to the original YOLOv11, the improved network of this invention adds ① a wavelet attention multi-band fusion (WAMF) module, ② a bottleneck enhancement dilated U-shaped convolution (BEDU) module, and ③ a bidirectional deep cross-attention (BDCA) module. Specifically, based on the original YOLOv11:

[0064] (1) In the backbone network: For the input image, it is passed through WAMF→WAMF→BEDU→WAMF in sequence to obtain a feature map with a scale of 256×80×80, which is then output to the C3k2 module of the 4th layer of the original backbone network.

[0065] (2) In the Neck network: the BDCA module is used to replace the original YOLOv11 Concat module for feature fusion.

[0066] (3) In the Neck Network: For the feature map (1024×20×20) output by the C2PSA module of the 10th layer of the backbone network, after upsampling (the scale becomes 1024×40×40), a convolution process is added to adjust the scale of the feature map to 512×40×40; then, through the BDCA module, the feature map (512×40×40) output by the C3k2 module of the 6th layer of the backbone network is fused; finally, for the fused feature map, a feature enhancement process is added through the BEDU module before it is output to the subsequent C3k2 module.

[0067] (4) In the Neck Network: For the mid-scale feature map (512×40×40) extracted by the Neck Network (i.e., output to the Head), after convolution (conv) processing (the scale becomes 1024×20×20), a BEDU module is added to enhance the features; then, through the BDCA module, it is fused with the feature map (1024×20×20) output by the C2PSA module of the 10th layer of the backbone network.

[0068] The improved neural network described above extracts feature maps of three different scales from the original input image and feeds them to the detection head. Finally, it obtains the confidence level of the surface defect category and its corresponding bounding box coordinates in the image, thereby realizing the identification and acquisition of the surface defect category and region.

[0069] 1. Wavelet Attention Multi-Band Fusion (WAMF) Module

[0070] like Figure 3 The diagram shows the network structure of the WAMF module, which is used to preprocess the input raw surface image to decouple low-frequency and high-frequency features and perform adaptive multi-band fusion to suppress high-frequency noise interference.

[0071] 1) For the input image (Assume the scale is B×C×H×W, representing the batch dimension, channel dimension, height, and width respectively.) Perform a two-dimensional discrete wavelet transform (DWT) to decompose it into: ① low-frequency components. ② Horizontal high-frequency components ③ Vertical high-frequency components ④ Diagonal high-frequency components :

[0072]

[0073] In the formula, and These represent low-pass filters in the horizontal (i.e., image width) and vertical (i.e., image height) directions, respectively. and These represent high-pass filters in the horizontal and vertical directions, respectively. " indicates that the image is filtered using the appropriate filter;

[0074] 2) Concatenate the feature maps of the above four components (by channel dimension) to obtain the concatenated feature map. (Scale is B×4C×H / 2×W / 2):

[0075]

[0076] In the formula, This indicates a splicing operation, corresponding to "Cat" in the diagram.

[0077] 3) A lightweight multi-head attention mechanism is used to stitch together the feature maps. Perform adaptive fusion:

[0078] 3.1) After performing average pooling (AvgPool), normalization (Norm), and flattening (Reshape) sequentially, subband feature maps are obtained by performing three 1×1 two-dimensional convolutions (Conv2d). , , .

[0079] 3.2) Subband Feature Mapping and After matrix multiplication (MatMul), the results are successively normalized by scaling and Softmax (normalization exponential function); the final result is then mapped to the sub-band features. The weights of the four components are obtained by matrix multiplication (MatMul) and then activated by Sigmoid. , , , :

[0080]

[0081] In the formula, Indicates Sigmoid activation. This indicates Softmax normalization. for transpose, This represents the number of channels in the feature map (corresponding to the scaling operation).

[0082] 3.3) Weight With splicing feature map After multiplication, a 1×1 2D convolution (Conv2d) is performed to dynamically suppress noise and enhance defect features, outputting a fused feature map. (The scale is B×2C×H / 2×W / 2).

[0083] 2. Bottleneck Enhancement Dilated U-Shaped Convolution (BEDU) Module

[0084] like Figure 4 The diagram shows the network structure of the BEDU module, which enhances the features of the shallow layers of the backbone network and the fusion part of the neck network, effectively fusing global and local information and improving the ability to capture low-contrast and small targets.

[0085] Variable convolution (DConv) is used to expand the receptive field, lightweight bottleneck convolution (BottConv) is used to enhance local details, and a U-shaped skip connection structure is used to fuse features from different levels; specifically:

[0086] 1) Input image (Assuming the scale is B×C×H×W) After processing through the first layer of bottleneck convolution (BottConv), the feature map is obtained. (Dimensions are B×C×H×W):

[0087]

[0088] 2) Feature Map The feature map is obtained by processing through a second layer of variable convolution (Dconv, where the dilation rate r=2). (Scale is B×C / 2×H×W):

[0089]

[0090] 3) Feature Map The feature map is obtained by sequentially processing the data through a third variable convolutional layer (Dconv, where the dilation rate r=4) and a fourth bottleneck convolutional layer (BottConv). (Scale is B×C / 2×H×W):

[0091]

[0092] 4) Feature Map With feature map The feature map is obtained by concatenating the features along the channel dimension. (Dimensions are B×C×H×W):

[0093]

[0094] 5) Feature Map The feature map is obtained after processing through a 6th layer of variable convolution (Dconv, where the dilation rate r=2). (Dimensions are B×C×H×W):

[0095]

[0096] 6) Feature Map With feature map The concatenation is performed (by channel dimension) (corresponding to a scale of B×2C×H×W), and the result is finally processed by the 8th layer bottleneck convolution (BottConv) to output the enhanced feature map. (The dimensions are B×C×H×W).

[0097]

[0098] In the formula, Represents bottleneck convolution. This represents variable convolution.

[0099] 2.1 The variable convolution (DConv) is performed from front to back as follows: 2D dilated convolution (DialtedConv2d) → BatchNorm normalization → ReLU activation.

[0100] 2.2 The bottleneck convolution (BottConv) is performed from front to back as follows: 1×1 point convolution (PointConv) dimensionality reduction → depth convolution (DepthConv) → 1×1 point convolution (PointConv) dimensionality increase → BatchNorm normalization → ReLU activation.

[0101] 3. Bidirectional Deep Cross-Attention (BDCA) Module

[0102] like Figure 5 The diagram shows the network structure of the BDCA module, which is used to fuse deep and shallow features in the neck network. It achieves cross-level semantic information complementarity through a bidirectional cross-attention mechanism, replacing the simple splicing operation in the original YOLOv11.

[0103] Specifically, for any two input shallow feature maps With deep feature maps (Assume both have dimensions of B×C×H×W):

[0104] 1) For both, depthwise separable convolution (DepthwiseConv) and tensor chunking are applied sequentially, mapping them to a shared query (Q), key (K), and value (V) embedding space; where the shallow features correspond to... , , The deep features correspond to obtain , , .

[0105] 2) Perform bidirectional cross-attention calculation, fusing the layers in both the "shallow → deep" and "deep → shallow" directions to obtain two fused features. and :

[0106]

[0107]

[0108] In the formula, This represents the number of channels in the feature map.

[0109] 3) The fusion features from the two directions are concatenated and used as the module output. :

[0110]

[0111] 4. For the neural network improved based on YOLOv11, the training process uses the Adam optimizer, with an initial learning rate of 0.001. It combines a learning rate warm-up and exponential decay strategy, with a batch size of 32 and a training epoch of 200.

[0112] II. Testing and Verification

[0113] 1. Data preparation and partitioning

[0114] Taking metal surface defect detection as an example, the NEU-DET dataset and the GC10-DET dataset are used, where:

[0115] The NEU-DET dataset is an open-source metal surface defect dataset released by Northeastern University. It contains 1800 images of hot-rolled steel strip surfaces, covering six types of defects: indented scale (RS), plaques (Pa), cracks (Cr), pitting (PS), inclusions (In), and scratches (Sc). The images are randomly divided into a training set (1440 images), a validation set (180 images), and a test set (180 images) in an 8:1:1 ratio.

[0116] The GC10-DET dataset is an open-source metal surface defect dataset released by the Institute of Automation, Chinese Academy of Sciences. It contains 2294 images of steel plate surface defects from real industrial scenarios, covering 10 types of defects: punching (Pu), weld (Wl), crescent gap (Cg), water stains (Ws), oil spots (Os), wire spots (Ss), inclusions (In), rolling pits (Rp), creases (Cr), and waist creases (Wf). It is also randomly divided into a training set (1836 images), a validation set (229 images), and a test set (229 images) in an 8:1:1 ratio.

[0117] 2. Model Construction and Initialization

[0118] The improved neural network based on YOLOv11 described above is used as the metal surface defect detection model, wherein:

[0119] The WAMF module uses the Haar wavelet basis, with four times the number of output channels and half the spatial size.

[0120] In the BEDU module, the compression ratio of the 1×1 point convolution within the bottleneck convolution is set to 4;

[0121] All model weights were randomly initialized using the Kaiming initialization method, without using pre-trained weights.

[0122] 3. Model Training

[0123] The model is trained using the training and validation sets defined above. The training parameters are set as follows:

[0124] Optimizer: Adam; Initial learning rate: 0.001; Learning rate strategy: Warm-up followed by exponential decay (gamma=0.97); Batch size: 32; Number of training epochs: 200; Data augmentation: Mosaic augmentation only.

[0125] During training, the training loss (box loss, classification loss, DFL loss) and evaluation metrics (precision, recall) curves of the model on the NEU-DET and GC10-DET datasets are shown in the attached figures. Figure 6 and attached Figure 7 As shown, this indicates that the model has fully converged after 200 training cycles.

[0126] 4. Testing and Performance Analysis

[0127] 4.1 Accuracy Test

[0128] The trained model is evaluated on a test set and compared with existing mainstream models, where:

[0129] YOLOv5n, YOLOv7_tiny, YOLOv8n, YOLOv11n, and YOLOv11s were selected for a horizontal comparison with the present invention;

[0130] The mAP metric, which is the median of the average precision (AP) across all categories, was used as the evaluation standard of COCO. The mAP calculated when the IoU threshold is 0.5 is denoted as mAP@0.5. In addition, precision, recall, parameters, and floating-point operations per second (FLOPs) were selected as auxiliary references.

[0131] The corresponding results are shown in Table 1 and Table 2, respectively:

[0132] Table 1: Comparison on the NEU-DET dataset

[0133]

[0134] Table 2: Comparison on the GC10-DET dataset

[0135]

[0136] Test results show that the present invention achieves mAP@0.5 of 89.1% and 72.4% on the NEU-DET and GC10-DET datasets, respectively. Compared with YOLOv5n, YOLOv7_tiny, YOLOv8n and YOLOv11n, the present invention has a significant advantage in accuracy. Compared with YOLOv11s, which has a larger model capacity and higher algorithm complexity, the present invention has slightly higher accuracy on the NEU-DET dataset and almost the same accuracy on the GC10-DET dataset.

[0137] To visually demonstrate the differences in the regions of interest of the models, HiResCAM was used to generate heatmaps for visualization and comparison. The results are shown in the attached figures. Figure 8 and 9 As shown, the heat map of the present invention fits more closely with the target edge, focusing more on the defect itself, indicating that it has stronger feature identification ability and detection stability.

[0138] In summary, for metal surface defect detection scenarios, compared with other commonly used YOLO series models, this invention, thanks to its effective feature representation and semantic mining capabilities, can more accurately capture the unique features of defects in complex backgrounds, and better achieve a balance between accuracy and model complexity.

[0139] 4.2 Noise Robustness Test

[0140] To evaluate the defect detection performance of this invention under different noise intensities, the signal-to-noise ratio (SNR) is used to quantify the noise intensity; a lower SNR value indicates stronger noise. Generally, the SNR value corresponding to low-intensity noise is greater than 30 dB; the SNR range corresponding to medium-intensity noise is 15~30 dB; and the SNR range corresponding to high-intensity noise is less than 15 dB.

[0141] Actual working conditions were simulated by adding Gaussian noise of different intensities (SNR=30dB, 20dB, 10dB) to the original image. Figure 10 and 11 The results show a comparison of the detection results of YOLOv11n, YOLOv11s and the present invention on the NEU-DET dataset and the GC10-DET dataset, respectively, after adding noise of different intensities to the same sample.

[0142] From the appendix Figure 10 and 11 As can be seen, although different levels of noise were added to the metal surface detection images, none of them significantly altered the characteristics of the original image. For example: (See attached image) Figure 10The samples in the image still exhibited noticeable cracking characteristics before and after the addition of noise of varying intensities; (Attached) Figure 11 In the samples, the crescent gap feature remains prominent. However, all three models exhibit varying degrees of noise tolerance. For example, under low-intensity noise, all three models can correctly locate and identify the crack and crescent gap; under medium-intensity noise, YOLOv11n misses some features. Figure 10 A crack defect and attachment Figure 11 In the case of a crescent-shaped defect, YOLOv11s, with its wider and deeper network architecture, also exhibits missed detections and decreased confidence in true targets. However, the improved neural network model of this invention can still detect all defects normally. Under high-intensity noise, YOLOv11n and YOLOv11s basically lose their defect detection capabilities. Although the detection model of this invention also exhibits missed detections and decreased confidence in correct targets, it still has a higher recognition rate compared to others.

[0143] Table 3 shows a comparison of the false negative rates among the various models:

[0144] Table 3: Comparison of false negative rates under noisy environments

[0145]

[0146] Experimental results show that the present invention maintains a low false negative rate under different noise intensities, and in particular, it can still maintain a high defect detection capability under medium noise (SNR=20dB), which proves its excellent noise robustness.

[0147] In summary, the experimental results show that the detection model proposed in this invention, compared with YOLOv11n and YOLOv11s, demonstrates stronger noise tolerance thanks to its improved three core modules, and can still maintain a high defect detection capability in moderate noise environments.

[0148] 4.3 Ablation Test

[0149] To verify the effectiveness of the three improved modules of this invention, systematic ablation experiments were conducted on the NEU-DET and GC10-DET datasets. The results are shown in Tables 4 and 5.

[0150] Table 4: Ablation experimental results of the model on the NEU-DET dataset

[0151]

[0152] Table 5: Ablation experimental results of the model on the GC10-DET dataset

[0153]

[0154] Experiments show that the introduction of any module can improve performance, with the BDCA module contributing the most significant improvement in accuracy. The model achieves optimal performance when all three modules are introduced simultaneously, demonstrating the synergistic enhancement effect among the modules.

[0155] This invention is not limited to the above-described embodiments. Any obvious improvements, substitutions, or modifications that can be made by those skilled in the art without departing from the essence of this invention are within the scope of protection of this invention.

Claims

1. A surface defect detection method characterized by: A detection model is used to implement surface defect detection on the image of the to-be-detected object, and the detection model is as follows: On the basis of YOLOv11, a BDCA module is used to replace the splicing operation in the original neck network; in the BDCA module, the input shallow features and deep features are fused through bidirectional cross attention.

2. The surface defect detection method according to claim 1, characterized by: The BDCA module is as follows: For the input two feature maps and , depthwise separable convolution and tensor blocking are used in turn, respectively, to map to , , and , , ; performing bidirectional cross-attention computation to obtain two fused features and : In the formula, denotes Softmax normalization, is the channel number of the feature map; The obtained two respective fused features are spliced: The resulting As output of the module.

3. The surface defect detection method according to claim 1, characterized by: In the backbone network, a WAMF module is used to pre-process the input image, and the WAMF module is as follows: performing a two-dimensional discrete wavelet transform on the input image to decompose into a low frequency component , a horizontal high frequency component , a vertical high frequency component , a diagonal high frequency component ; The four components are spliced to obtain a spliced feature map ; Concatenating feature maps by multi-head attention mechanism Adaptive fusion is performed, and the obtained result is taken as the output of the module.

4. The surface defect detection method according to claim 3, characterized by: The adaptive fusion step is as follows: To splice feature map , after average pooling, normalization and flattening, respectively through three 1x1 two-dimensional convolution to get sub-band feature mapping 、 、 ; Subband feature mapping , , The four components are weighted by processing as follows , , , : wherein, denotes a Sigmoid activation, denotes a Softmax normalization, is the number of channels of the feature map; The weights are multiplied with the concatenated feature maps and via a 1x1 two-dimensional convolution a fused feature map is obtained as output of the module.

5. The surface defect detection method according to claim 3, characterized by: A BEDU module is used for feature enhancement, and the BEDU module is as follows: Input image Bottleneck convolution, to get feature map : feature map variable convolution, a feature map is obtained : feature map obtaining a feature map through variable convolution and bottleneck convolution in sequence ; feature map with the feature map stitching, to obtain a feature map ; feature map variable convolution, a feature map is obtained ; feature map with the feature map perform stitching, and the resulting feature map is output after bottleneck convolution .

6. The surface defect detection method according to claim 5, characterized by: The variable convolution comprises, from front to back, a two-dimensional dilated convolution, BatchNorm normalization and ReLU activation. Variable convolution with dilation rate 2 for feature map Variable convolution with dilation rate 4 for feature map Variable convolution with dilation rate 2 for feature map Variable convolution with dilation rate 2 for feature map 7. The surface defect detection method according to claim 5, characterized by: The bottleneck convolution comprises, from front to back, a 1x1 point convolution dimension reduction, a depth convolution, a 1x1 point convolution dimension increase, BatchNorm normalization and ReLU activation. The compression ratio of the 1x1 point convolution is 4.

8. The surface defect detection method according to claim 5, characterized by: In the backbone network, the input image sequentially passes through WAMF, WAMF, BEDU and WAMF to obtain a feature map with a scale of 256x80x80, which is output to the C3k2 module.

9. The surface defect detection method of claim 5, wherein: In the neck network: The feature map with a scale of 1024x20x20 output by the backbone network is up-sampled, and then the scale is adjusted to 512x40x40 through convolution, and then the feature map is fused with the feature map with a scale of 512x40x40 output by the backbone network; After fusion, the feature is enhanced by the BEDU module; The feature map with a scale of 512x40x40 extracted by the neck network is adjusted in scale, and then the feature is enhanced by the BEDU module, and then the feature map is fused with the feature map with a scale of 1024x20x20 output by the backbone network.

10. The surface defect inspection method of claim 1, wherein: The surface defect detection is used for metal materials.