A steel surface defect detection method, system, storage medium and product

Through the interaction of receptive field convolution and receptive field space convolution, combined with coordinate attention and display visual center module, the false alarm and missed alarm problems of steel surface defect detection in complex backgrounds are solved, and the detection accuracy and efficiency are improved.

CN118781107BActive Publication Date: 2025-01-03YUYUAN TECHNOLOGY (XIAMEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411258987.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-01-03
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

When facing scenes with complex backgrounds and high similarity between classes, existing steel surface defect detection methods are prone to false alarms or missed alarms, which reduces the accuracy and reliability of detection, and the pixels occupied by small defects in the image are relatively high. Fewer, easily overlooked, resulting in information loss.

Method used

The RAED-Encoder network is constructed using receptive field convolution and receptive field space convolution, combining the coordinate attention module and the display vision center module, eliminating feature interaction and environmental impact, and using the new decoding terminal CA-ResNeXt-Bottleneck for detection, improving Feature expression ability and target positioning accuracy.

Benefits of technology

It improves the accuracy of steel surface defect detection, enhances the detection ability of small defects, reduces false alarms and missed alarms, and improves the calculation efficiency and real-time performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118781107B_ABST
    Figure CN118781107B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of defect detection, and in particular to a steel surface defect detection method, system, storage medium and product, comprising the following steps: S1: acquiring image data, and preprocessing and dividing the image data; S2: inputting the training data set divided in step S1 into a backbone network to extract features; S3: constructing a RAED-Encoder network by using a receptive field convolution module, a receptive field space convolution module, a display visual center, a coordinate attention module and a fusion module, and training the RAED-Encoder network; S4: deleting the last 1*1 convolution and BN layer in a ResNeXt-Bottleneck structure, adding a CA attention module at the deleted position, obtaining a decoding head CA-ResNeXt-Bottleneck, using the decoding head to detect a first output image, and outputting a detection result; using a receptive field convolution and a receptive field space convolution to construct a RAED-Encoder network, using the two convolutions to interact features, increasing the expression ability of features, and thereby improving the accuracy of steel surface defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection, and in particular to a steel surface defect detection method, system, storage medium and product. Background Art

[0002] In order to improve detection accuracy, the model usually becomes complex and large, which increases the amount of calculation and inference time. In industrial applications, especially on high-speed production lines, detection methods need to respond within a limited time, so real-time performance and computational efficiency become constraints.

[0003] Steel surfaces often have complex textures and backgrounds, which can result in low contrast between defects and background, making it difficult for the detection model to distinguish and detect defects. When faced with scenes with complex backgrounds or high inter-class similarity, the model is prone to false positives or false negatives, reducing the accuracy and reliability of detection.

[0004] Small defects occupy fewer pixels in the image and are easily ignored by the feature extraction network, and information may be lost during the downsampling process. Summary of the invention

[0005] The object of the present invention is to provide a steel surface defect detection method, system, storage medium and product with improved detection accuracy.

[0006] In order to achieve the above object, the present invention adopts such technical solution:

[0007] A method for detecting surface defects of steel, comprising the following steps performed in sequence:

[0008] S1: Obtain image data of steel surface defects, and preprocess and divide the image data; the steps of dividing the image data are as follows:

[0009] The K-fold cross-validation algorithm is used on the preprocessed image data to divide the image data into K parts, of which K-1 parts are used as training data sets for training the model; the remaining 1 part of the data is used as a validation data set to verify the performance and accuracy of the model;

[0010] S2: Input the training data set divided in step S1 into the backbone network for feature extraction. The specific steps of feature extraction are as follows:

[0011] S2-1: The training data set is subjected to preliminary feature extraction through the Stem layer of the backbone network to obtain feature maps; the feature maps are then subjected to a second feature extraction through multiple hierarchical HG blocks to obtain features at different levels; the second feature extraction process is optimized through the activation function ReLU and the learnable affine block; the global average pooling and the final convolution and fully connected layers process the features in turn and map the processed features to the required output categories, thereby completing the entire feature extraction process. The backbone network outputs three feature maps, which are called feature maps S3, S4, and S5;

[0012] S2-2: Perform self-attention operation on feature image S5 to interact the features within the scale to obtain a new feature image F5, and perform ordinary convolution on feature image F5 to obtain a steel surface defect image with global features;

[0013] S3: A RAED-Encoder network is constructed using a receptive field convolution module, a receptive field spatial convolution module, a display visual center, a coordinate attention module and a fusion module. The receptive field convolution module includes a first receptive field convolution module and a second receptive field convolution module, the receptive field spatial convolution module includes a first receptive field spatial convolution module and a second receptive field spatial convolution module, the coordinate attention module includes a first coordinate attention module and a second coordinate attention module, the fusion module includes a first fusion module, a second fusion module, a third fusion module and a fourth fusion module. The training steps of the RAED-Encoder network are as follows:

[0014] S3-1: The first fusion module performs feature fusion on the steel surface defect image with global features and the feature map S4 to obtain a first fused image, and inputs the first fused image into the first receptive field convolution module for feature extraction to obtain a first feature map, and inputs the first feature map into the display visual center for processing to obtain an EVC feature map;

[0015] S3-2: Input the EVC feature map and the feature map S3 into the second fusion module for feature fusion to obtain a second fused image, input the second fused image into the second receptive field convolution module for feature extraction to obtain a second feature map, input the second feature map into the first coordinate attention module for feature extraction to obtain a first coordinate feature map, input the first coordinate feature map into the first receptive field spatial convolution module for feature extraction to obtain a first spatial feature map, input the first spatial feature map and the EVC feature map into the third fusion module for feature fusion to obtain a third fused image;

[0016] S3-3: input the third fused image into the second coordinate attention module for feature extraction to obtain a second coordinate feature map, input the second coordinate feature map into the second receptive field space convolution module for feature extraction to obtain a second space feature map, input the second space feature map and the steel surface defect image with global features into the fourth fusion module for feature fusion to obtain a fourth fused image;

[0017] S3-4: performing a Concat operation on the fourth fused image, the third fused image, and the second fused image, and sequentially linking the fourth fused image, the third fused image, and the second fused image to obtain a first output image;

[0018] S4: Delete the last 1*1 convolution and BN layer in the ResNeXt-Bottleneck structure, and add a CA attention module at the corresponding deleted position to obtain the decoding head CA-ResNeXt-Bottleneck, use the decoding head CA-ResNeXt-Bottleneck to detect the first output image, and output the detection result.

[0019] Preferably, the image data is obtained in step S1 as follows:

[0020] S1-1: Use high-resolution optical imaging equipment to obtain image data of steel surface defects. When collecting data, use light sources with corresponding wavelengths for different types of defects to detect different types of defects;

[0021] S1-2: Use image processing and analysis software to perform contrast enhancement or histogram equalization preprocessing on the collected image data to highlight the defect pattern of the steel surface defect image, reduce noise and enhance the contrast of defects, and mark the steel surface defect images with highlighted defect patterns according to different defects.

[0022] Preferably, in step S4, the structural unit of ResNeXt-bottleneck contains three convolution structures, each convolution structure includes a Conv module, a BN module and a ReLu module, the convolution kernel sizes of the convolution operations in the three convolution structures are 1*1, 3*3 and 1*1 respectively, and the convolution kernels are connected using residual links.

[0023] Preferably, the receptive field convolution module uses fast group convolution to extract features from the input fused image to obtain a first receptive field feature image; uses an average pooling block to extract features from the first receptive field feature image to obtain a second receptive field feature image with global features; uses grouping to perform convolution through three different convolution kernels to extract features from the second receptive field feature image, respectively, to obtain a third receptive field feature image, a fourth receptive field feature image and a fifth receptive field feature image in turn.

[0024] Preferably, the three different convolution kernels used in the receptive field convolution module are 1×1 convolution kernel, 3×3 convolution kernel and 5×5 convolution kernel, respectively. Softmax is used to judge the importance of feature information in the third receptive field feature image, the fourth receptive field feature image and the fifth receptive field feature image, and the corresponding weight coefficients are obtained by priority sorting according to the importance. The largest weight coefficient is weighted to the first receptive field feature image. The receptive field convolution module utilizes the interaction of feature information in different feature images to improve network performance.

[0025] Preferably, the display visual center is composed of two parallel connected modules, the parallel connected modules include a lightweight MLP and a learnable visual center intelligent LVC module. After receiving the first feature map output by the first receptive field convolution module, the display visual center smoothes the first feature map through the Stem module. The output of the Stem module is X in Then, a lightweight MLP is used to capture the global long-distance dependencies of the top-level features. At the same time, the local area features of the input image are aggregated through the LVC module. The lightweight MLP includes a depth-separable convolution module and a channel MLP module in sequence; the input of the depth-separable convolution module is the group-normalized X in The output of the depthwise separable convolutional module is group-normalized and used as the input of the channel MLP module. Both modules undergo channel scaling and DropPath. The feature map of the lightweight MLP output is MLP (X in The LVC module gathers local features in the layer and retains local information. The input of the LVC module is X in Specifically, a set of convolutional layers is used to encode the input features, and the Conv module, BN module and ReLu module are used for further processing. Then, the encoded features are combined with the intrinsic codebook through a set of learnable scale factors, and then a fully connected layer and a 1×1 convolutional layer are used. Finally, the input features and the local angular area features of the scale factor coefficients are channel multiplied and channel added. The feature map output by the LVC module is LVC (X in ), and finally the output feature maps of these two modules are MLP (X in ) and LVC (X in ) are connected in the channel dimension to form the EVC feature map.

[0026] Preferably, the coordinate attention module performs average pooling on the input second feature map or the third fused image in the H direction and the W direction respectively to obtain a spatial feature map and a coordinate feature map; performs a Concat operation on the generated spatial feature map and coordinate feature map, and performs dimensionality reduction and activation operations on the feature map after the Concat operation; the feature map after the dimensionality reduction and activation operations is again divided into a spatial feature map and a coordinate feature map, and then a dimensionality increase operation is performed using convolution, and then the spatial attention weight and the coordinate attention weight are obtained by using the Sigmoid activation function and finally multiplied by the original features to obtain the corresponding coordinate feature map.

[0027] A steel surface defect detection system comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, any of the methods described above is implemented.

[0028] A computer storage medium stores a computer program, which, when executed by a processor, implements any of the methods described above.

[0029] A computer product comprises a computer program, wherein when the computer program is executed by a processor, the method described in any one of the above items is implemented.

[0030] By adopting the aforementioned design scheme, the beneficial effects of the present invention are as follows: the present invention adopts receptive field convolution and receptive field space convolution to construct a RAED-Encoder network, utilizes these two convolutions to interact with features and increase the expressive power of features, and then introduces a coordinate attention module and a display visual center module to eliminate the negative impact of the environment, and utilizes a new decoding head CR-Decoder to help the model focus on locating the location of defects and accurately classify them, thereby improving the accuracy of steel surface defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is the algorithm framework diagram of the present invention;

[0032] Figure 2 It is a schematic diagram of the structure of the receptive field convolution of the present invention;

[0033] Figure 3 It is a structural schematic diagram of the display visual center ECV of the present invention;

[0034] Figure 4 It is a schematic diagram of the structure of the coordinate attention mechanism of the present invention;

[0035] Figure 5 It is a schematic diagram of the structure of the CR-Decoder of the present invention. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only partial embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] A method for detecting surface defects of steel, such as Figure 1 As shown, the steps include the following steps performed in sequence:

[0038] S1: Obtain image data of steel surface defects, and preprocess and divide the image data; the image acquisition method and preprocessing steps are as follows:

[0039] S1-1: Use high-resolution optical imaging equipment to obtain image data of steel surface defects. High-resolution optical imaging equipment refers to industrial cameras or high-resolution cameras;

[0040] In this embodiment, when collecting data, light sources with corresponding wavelengths are used for different types of defects to detect different types of defects, such as using ultraviolet light sources to detect invisible defects or using visible light to detect defects with uneven colors; lighting at different angles and directions is used to ensure clear and uniform lighting during image acquisition, reducing the impact of shadows and reflections on image quality;

[0041] S1-2: Use image processing and analysis software, such as OpenCV and Matlab, to pre-process the collected image data, mainly to perform contrast enhancement or histogram equalization on the image to highlight the defect pattern of the steel surface defect image, to reduce noise and enhance the contrast of the defect, and to mark the steel surface defect images with highlighted defect patterns according to different defects.

[0042] In this embodiment, due to the small number of defective images, the traditional machine learning algorithm K-fold cross-validation algorithm is used for the preprocessed image data, and the image data is divided into K parts of data, of which K-1 parts of data are used as training data sets for training models; and the remaining 1 part of data is used as a verification data set to verify the performance and accuracy of the model. This process needs to be carried out K times in total, and the evaluation indicators of each iteration are recorded. The evaluation indicators include accuracy, recall rate, F1 score, mean square error, etc., and the average value of these indicators is calculated as an overall evaluation of the model performance. It can make more full use of limited data sets, reduce the deviation caused by improper data division, and improve the generalization ability of the model.

[0043] S2: Input the training data set divided in step S1 into the backbone network for feature extraction. The specific steps of feature extraction are as follows:

[0044] S2-1: The training data set is subjected to preliminary feature extraction through the Stem layer of the backbone network to obtain feature maps; then, the feature maps are subjected to a second feature extraction through multiple hierarchical HG blocks to obtain features at different levels; the HG block mainly contains a large number of standard convolutions. Between each HG block, a learnable downsampling layer is used to downsample the feature map to reduce the spatial dimension and increase the receptive field; the second feature extraction process is further optimized through the activation function ReLU and the learnable affine block; finally, the global average pooling and the final convolution and fully connected layers process the features in turn and map the processed features to the required output categories, thereby completing the entire feature extraction process. The backbone network outputs three feature maps, which are called feature maps S3, S4, and S5;

[0045] S2-2: Attached Figure 1 The specific operation of the AIFI module in is to perform a self-attention operation on the feature image S5 to interact the features within the scale to obtain a new feature image F5, and perform a common convolution on the feature image F5 to obtain a steel surface defect image with global features;

[0046] S3: A RAED-Encoder network is constructed using a receptive field convolution module (RFConv), a receptive field spatial convolution module (RFCAConv), an displayed visual center (EVC), a coordinate attention module (CA) and a fusion module (Fusion). In this embodiment, the receptive field convolution module includes a first receptive field convolution module (RFConv1) and a second receptive field convolution module (RFConv2). The structures of the two receptive field convolution modules are as follows: Figure 2 As shown, the receptive field spatial convolution module includes a first receptive field spatial convolution module (RFCAConv1) and a second receptive field spatial convolution module (RFCAConv2), the coordinate attention module includes a first coordinate attention module (CA1) and a second coordinate attention module (CA2), the fusion module includes a first fusion module (Fusion1), a second fusion module (Fusion2), a third fusion module (Fusion3) and a fourth fusion module (Fusion4), and the training steps of the RAED-Encoder network are as follows:

[0047] S3-1: The first fusion module performs feature fusion on the steel surface defect image with global features and the feature map S4 to obtain a first fused image, and inputs the first fused image into the first receptive field convolution module for feature extraction to obtain a first feature map, and inputs the first feature map into the display visual center for processing to obtain an EVC feature map;

[0048] S3-2: Input the EVC feature map and the feature map S3 into the second fusion module for feature fusion to obtain a second fused image, input the second fused image into the second receptive field convolution module for feature extraction to obtain a second feature map, input the second feature map into the first coordinate attention module for feature extraction to obtain a first coordinate feature map, input the first coordinate feature map into the first receptive field spatial convolution module for feature extraction to obtain a first spatial feature map, input the first spatial feature map and the EVC feature map into the third fusion module for feature fusion to obtain a third fused image;

[0049] S3-3: input the third fused image into the second coordinate attention module for feature extraction to obtain a second coordinate feature map, input the second coordinate feature map into the second receptive field space convolution module for feature extraction to obtain a second space feature map, input the second space feature map and the steel surface defect image with global features into the fourth fusion module for feature fusion to obtain a fourth fused image;

[0050] S3-4: performing a Concat operation on the fourth fused image, the third fused image, and the second fused image, and sequentially linking the fourth fused image, the third fused image, and the second fused image to obtain a first output image;

[0051] In this embodiment, two different receptive field convolutions, a receptive field convolution module and a receptive field spatial convolution module, are used to obtain steel surface defect feature maps of different degrees, combine their global information with local feature information, and then combine them with the feature images of S3 and S4 output by the backbone network, so that the model will not lose some small defects in the process of feature extraction, thereby improving the model detection accuracy.

[0052] S4: Delete the last 1*1 convolution and BN layer in the ResNeXt-Bottleneck structure, and add a CA attention module at the corresponding deleted position to obtain the decoding head CA-ResNeXt-Bottleneck, as shown in Figure 5As shown. The first output image is detected using the decoding head CA-ResNeXt-Bottleneck, and the detection result is output. By introducing the CA attention module in the decoding head, the decoding head can better capture the defect features of the image, thereby improving the accuracy of target positioning. In addition, the grouped convolution method of ResNeXt-Bottleneck is used to enhance the model's ability to express the surface defect features of steel, thereby improving the ability to locate complex targets. In this embodiment, the structural unit of ResNeXt-bottleneck contains three convolution structures, each of which includes a Conv module, a BN module, and a ReLu module. The convolution kernel sizes of the convolution operations in the three convolution modules are 1*1, 3*3, and 1*1, respectively, and finally a residual link is used. CA attention can capture features in a finer granularity by processing the information between channels and spatial positions separately. Combined with the feature extraction mechanism of ResNeXt-Bottleneck, it enhances the network's ability to capture and utilize global information, which helps to improve network performance. CR-Decoder combines CA-ResNeXt-Bottleneck with traditional decoders to solve the problem that the decoder cannot accurately locate small defects on the surface of steel and some defects are difficult to detect.

[0053] In this embodiment, the receptive field convolution module uses fast group convolution (3×3Group Conv) to extract features from the input fusion image to obtain a first receptive field feature image; uses an average pooling block (AvgPool) to extract features from the first receptive field feature image to obtain a second receptive field feature image with global features; uses grouping to extract features from the second receptive field feature image through convolution of three different convolution kernels, and obtains the third receptive field feature image, the fourth receptive field feature image and the fifth receptive field feature image in turn; in this embodiment, the three different convolution kernels used are 1×1 convolution kernel, 3×3 convolution kernel and 5×5 convolution kernel, respectively, and Softmax is used to judge the importance of feature information in the third receptive field feature image, the fourth receptive field feature image and the fifth receptive field feature image, and the corresponding weight coefficient is obtained by priority sorting according to the importance, and the largest weight coefficient is weighted with the first receptive field feature image. The receptive field convolution module utilizes the interaction of feature information in different feature images to improve network performance.

[0054] The display visual center in this embodiment is composed of two parallel connected modules, which include a lightweight MLP and a learnable visual center mechanism LVC module. Figure 3 As shown. After receiving the first feature map output by the first receptive field convolution module, the visual center smoothes the first feature map through the Stem module. The output of the Stem module is Xin , and then use a lightweight MLP to capture the global long-distance dependencies of the top-level features. At the same time, the local area features of the input image are aggregated through the LVC module. The lightweight MLP is used to capture the global information of the top-level features. The lightweight MLP includes a depth-separable convolution module and a channel MLP module in sequence. The input of the depth-separable convolution module is the group-normalized X in The output of the depthwise separable convolution module is group normalized and then used as the input of the channel MLP module. Both modules are channel scaled and DropPath. The feature map of the lightweight MLP output is MLP (X in At the same time, the LVC module gathers local features in the layer and retains local information. The input of the LVC module is the output X of the Stem module. in Specifically, a set of convolutional layers is used to encode the input features, and the Conv module, BN module and ReLu module are used for further processing. Then, the encoded features are combined with the intrinsic codebook through a set of learnable scale factors, and then a fully connected layer and a 1×1 convolutional layer are used. Finally, the input features and the local angular area features of the scale factor coefficients are subjected to channel multiplication and channel addition. In this embodiment, the number of codewords in the intrinsic codebook is i, and the number of local angular area features corresponds to the number of codewords i. The value of the number of codewords i can be set according to actual needs. The feature map output by the LVC module is LVC (X in Finally, the output feature maps of these two modules are MLP (X in ) and LVC (X in ) are connected in the channel dimension to form the EVC feature map.

[0055] In steel defect images, defects such as cracks and concave surfaces are easily affected by background factors. Therefore, a coordinate attention module is introduced to suppress these effects. The coordinate attention module in this embodiment is as follows: Figure 4 As shown. The coordinate attention module performs average pooling on the second feature map or the third fused image in the H direction and the W direction to obtain the spatial feature map and the coordinate feature map; the generated spatial feature map and the coordinate feature map are concat-operated, and the feature map after the concat operation is reduced in dimension and activated; the feature map after the dimension reduction and activation operation is divided into the spatial feature map and the coordinate feature map again, and then the convolution is used to increase the dimension, and then the spatial attention weight and the coordinate attention weight are obtained by using the Sigmoid activation function, and finally multiplied by the original feature to obtain the corresponding coordinate feature map.

[0056] The use of the coordinate attention module can suppress the influence of some background information generated by different production environments, such as low light and excessive dust, which leads to insufficient camera shooting accuracy, on the model's recognition of defects. The application of the coordinate attention module improves the feature expression ability of the steel surface defect feature map and thus improves the defect recognition ability of the overall network.

[0057] This embodiment also provides a system for implementing the above method.

[0058] A steel surface defect detection system comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, any of the above-mentioned methods is implemented.

[0059] This embodiment also provides a storage medium storing a computer program that can implement the above method.

[0060] A computer storage medium stores a computer program, which, when executed by a processor, implements any of the methods described above.

[0061] This embodiment also provides a computer product that can implement the above method.

[0062] A computer product comprises a computer program, and when the computer program is executed by a processor, the method described in any one of the above items is implemented.

[0063] In summary, the present invention adopts receptive field convolution and receptive field space convolution to construct the RAED-Encoder network, uses these two convolutions to interact with features and increase the expressiveness of features, and then introduces the coordinate attention module and the display visual center module to eliminate the negative impact of the environment. The use of the new decoding head CR-Decoder helps the model focus on locating the location of defects and accurately classifying them, thereby improving the accuracy of steel surface defect detection.

[0064] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for detecting surface defects of steel, characterized in that: The process includes the following steps: S1: Obtain image data of steel surface defects, and preprocess and divide the image data; the steps of dividing the image data are as follows: The K-fold cross-validation algorithm is used on the preprocessed image data to divide the image data into K parts, of which K-1 parts are used as training data sets for training the model; the remaining 1 part of the data is used as a validation data set to verify the performance and accuracy of the model; S2: Input the training data set divided in step S1 into the backbone network for feature extraction. The specific steps of feature extraction are as follows: S2-1: The training data set is subjected to preliminary feature extraction through the Stem layer of the backbone network to obtain feature maps; the feature maps are then subjected to a second feature extraction through multiple hierarchical HG blocks to obtain features at different levels; the second feature extraction process is optimized through the activation function ReLU and the learnable affine block; the global average pooling and the final convolution and fully connected layers process the features in turn and map the processed features to the required output categories, thereby completing the entire feature extraction process. The backbone network outputs three feature maps, which are called feature maps S3, S4, and S5; S2-2: Perform self-attention operation on feature image S5 to interact the features within the scale to obtain a new feature image F5, and perform ordinary convolution on feature image F5 to obtain a steel surface defect image with global features; S3: A RAED-Encoder network is constructed using a receptive field convolution module, a receptive field spatial convolution module, a display visual center, a coordinate attention module and a fusion module. The receptive field convolution module includes a first receptive field convolution module and a second receptive field convolution module, the receptive field spatial convolution module includes a first receptive field spatial convolution module and a second receptive field spatial convolution module, the coordinate attention module includes a first coordinate attention module and a second coordinate attention module, the fusion module includes a first fusion module, a second fusion module, a third fusion module and a fourth fusion module. The training steps of the RAED-Encoder network are as follows: S3-1: The first fusion module performs feature fusion on the steel surface defect image with global features and the feature map S4 to obtain a first fused image, and inputs the first fused image into the first receptive field convolution module for feature extraction to obtain a first feature map, and inputs the first feature map into the display visual center for processing to obtain an EVC feature map; S3-2: Input the EVC feature map and the feature map S3 into the second fusion module for feature fusion to obtain a second fused image, input the second fused image into the second receptive field convolution module for feature extraction to obtain a second feature map, input the second feature map into the first coordinate attention module for feature extraction to obtain a first coordinate feature map, input the first coordinate feature map into the first receptive field spatial convolution module for feature extraction to obtain a first spatial feature map, input the first spatial feature map and the EVC feature map into the third fusion module for feature fusion to obtain a third fused image; S3-3: input the third fused image into the second coordinate attention module for feature extraction to obtain a second coordinate feature map, input the second coordinate feature map into the second receptive field space convolution module for feature extraction to obtain a second space feature map, input the second space feature map and the steel surface defect image with global features into the fourth fusion module for feature fusion to obtain a fourth fused image; S3-4: performing a Concat operation on the fourth fused image, the third fused image, and the second fused image, and sequentially linking the fourth fused image, the third fused image, and the second fused image to obtain a first output image; S4: Delete the last 1*1 convolution and BN layer in the ResNeXt-Bottleneck structure, and add a CA attention module at the corresponding deleted position to obtain the decoding head CA-ResNeXt-Bottleneck, use the decoding head CA-ResNeXt-Bottleneck to detect the first output image, and output the detection result.

2. The method for detecting surface defects of steel materials according to claim 1, characterized in that: The image data is obtained in step S1 as follows: S1-1: Use high-resolution optical imaging equipment to obtain image data of steel surface defects. When collecting data, use light sources with corresponding wavelengths for different types of defects to detect different types of defects; S1-2: Use image processing and analysis software to perform contrast enhancement or histogram equalization preprocessing on the collected image data to highlight the defect pattern of the steel surface defect image, reduce noise and enhance the contrast of defects, and mark the steel surface defect images with highlighted defect patterns according to different defects.

3. The method for detecting surface defects of steel materials according to claim 1, characterized in that: In step S4, the structural unit of ResNeXt-bottleneck contains three convolution structures, each of which includes a Conv module, a BN module and a ReLu module. The convolution kernel sizes of the convolution operations in the three convolution structures are 1*1, 3*3 and 1*1 respectively, and residual links are used between the convolution kernels.

4. The method for detecting surface defects of steel materials according to claim 1, wherein: The receptive field convolution module uses fast group convolution to extract features from the input fusion image to obtain the first receptive field feature image; uses the average pooling block to extract features from the first receptive field feature image to obtain the second receptive field feature image with global features; uses grouping to extract features from the second receptive field feature image through convolution of three different convolution kernels, and obtains the third receptive field feature image, the fourth receptive field feature image and the fifth receptive field feature image in turn.

5. The method for detecting surface defects of steel materials according to claim 4, characterized in that: The three different convolution kernels used in the receptive field convolution module are 1×1 convolution kernel, 3×3 convolution kernel and 5×5 convolution kernel. Softmax is used to judge the importance of feature information in the third receptive field feature image, the fourth receptive field feature image and the fifth receptive field feature image. The corresponding weight coefficients are obtained by prioritizing them according to the importance, and the largest weight coefficient is weighted with the first receptive field feature image. The receptive field convolution module utilizes the interaction of feature information in different feature images to improve network performance.

6. The method for detecting surface defects of steel materials according to claim 1, characterized in that: The display visual center includes a lightweight MLP and a learnable visual center mechanism LVC module connected in parallel. After receiving the first feature map output by the first receptive field convolution module, the display visual center smoothes the first feature map through the Stem module. The output of the Stem module is X in Then, a lightweight MLP is used to capture the global long-distance dependencies of the top-level features. At the same time, the local area features of the input image are aggregated through the LVC module. The lightweight MLP includes a depth-separable convolution module and a channel MLP module in sequence; the input of the depth-separable convolution module is the group-normalized X in The output of the depthwise separable convolutional module is group-normalized and used as the input of the channel MLP module. Both modules undergo channel scaling and DropPath. The feature map of the lightweight MLP output is MLP (X in The LVC module is used to aggregate local features within the layer and retain local information. The input of the LVC module is X in , use a set of convolutional layers to encode the input features, and use Conv module, BN module and ReLu module for processing, then combine the encoded features with the intrinsic codebook through a set of learnable scale factors, and use a fully connected layer and a 1×1 convolutional layer, and finally perform channel multiplication and channel addition on the input features and the local angular area features of the scale factor coefficients. The feature map output by the LVC module is LVC (X in ), and finally the output feature maps of these two modules are MLP (X in ) and LVC (X in ) are connected in the channel dimension to form the EVC feature map.

7. The method for detecting surface defects of steel materials according to claim 1, characterized in that: The coordinate attention module performs average pooling on the input second feature map or the third fused image in the H direction and the W direction respectively to obtain a spatial feature map and a coordinate feature map; the generated spatial feature map and coordinate feature map are concat-operated, and the feature map after the concat operation is reduced in dimension and activated; the feature map after the dimension reduction and activation operation is again divided into a spatial feature map and a coordinate feature map, and then a dimension increase operation is performed using convolution, and then the spatial attention weight and the coordinate attention weight are obtained by using the Sigmoid activation function, and finally multiplied by the original feature to obtain the corresponding coordinate feature map.

8. A steel surface defect detection system, comprising a processor and a memory, wherein a computer program is stored in the memory, characterized in that: When the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Defect detection method based on joint optimization and mixed attention feature fusion

    CN115294038A

  • Industrial part surface defect detection method and device based on YOLOv8

    CN118333940A