A strip defect detection method based on redundant feature reuse and enhanced receptive field
By introducing redundant feature reuse and receptive field enhancement, the YOLOv5s model solves the problems of low efficiency and poor accuracy in strip steel defect detection, achieving efficient and accurate strip steel defect identification and enhancing the model's robustness and detection capability.
Patent Information
- Application Number
- CN202410047456.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-11
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2044-01-11
AI Technical Summary
Existing methods for detecting defects in strip steel rely on manual inspection, which is inefficient and inaccurate. Furthermore, machine vision-based methods lack generalization and robustness in complex environments, making it difficult to efficiently and accurately identify defects in strip steel.
A YOLOv5s model based on redundant feature reuse and receptive field enhancement is adopted. By introducing the redundant feature reuse module RFR, the attention module SCBAM, and the receptive field enhancement module RFE, combined with image enhancement processing and label clustering, a strip steel defect detection model is constructed to achieve efficient and accurate identification of strip steel defects.
It improves the accuracy and localization capability of strip steel defect detection, enhances the ability to detect fuzzy defects, improves the robustness and generalization of the model, and can more accurately match the position and shape of the target.
Smart Images

Figure CN117830283B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, specifically to a method for detecting defects in strip steel based on redundant feature reuse and receptive field enhancement. Background Technology
[0002] Strip steel is an essential raw material in industrial production, widely used in automobile manufacturing, machinery production, and aerospace. Its quality directly affects the quality and performance of industrial products made from it. During industrial production, defects such as oxidation, scratches, and inclusions on the strip steel surface are unavoidable due to factors such as raw materials, production processes, and the production environment. These defects can reduce the corrosion resistance, wear resistance, and fatigue resistance of products, leading to safety accidents. Timely detection of these defects is crucial for ensuring product quality. Therefore, the detection of defects in strip steel is particularly important.
[0003] Traditional defect detection methods primarily rely on manual visual inspection. However, manual inspection is easily influenced by subjective biases, making it difficult to define a uniform defect threshold. Furthermore, manual inspection suffers from low efficiency, high leakage rates, and high labor costs. Subsequently, machine vision-based inspection methods have rapidly developed and, due to their non-contact, safe, reliable, high-precision, and efficient characteristics, have gradually replaced manual inspection as a crucial method for industrial inspection.
[0004] Machine vision-based detection methods mainly consist of two stages: feature extraction and classification. However, the feature extraction stage of machine vision methods relies on manual design, making it difficult to meet the demands of complex industrial inspection environments. Detection methods often exhibit poor generalization and robustness, hindering their application in actual industrial production processes.
[0005] The emergence of deep learning has led to the rapid development of computer vision tasks, with object detection becoming a research hotspot. Deep learning, as a strategy capable of automatically learning feature distributions from image data, offers more efficient and accurate object identification in relevant detection tasks. Compared to previous methods, deep learning-based detection techniques exhibit better robustness and generalization. However, in strip steel defect detection, existing object detection algorithms are difficult to directly apply due to irregular defect scales and indistinct defect features.
[0006] How to achieve efficient and accurate identification of defects in strip steel is a technical problem that needs to be solved. Summary of the Invention
[0007] The technical objective of this invention is to address the above-mentioned shortcomings by providing a strip steel defect detection method based on redundant feature reuse and receptive field enhancement, thereby solving the technical problem of how to achieve efficient and accurate identification of strip steel defects.
[0008] This invention relates to a strip steel defect detection method based on redundant feature reuse and enhanced receptive field, comprising the following steps:
[0009] Data acquisition: Images with surface defects of steel strips are acquired as raw images. The defects in the raw images are labeled to obtain label information. A dataset is constructed based on the raw images and the corresponding label information, and the dataset is divided into training set, validation set and test set. The label information includes the position information of the annotation box, scale information and category label.
[0010] Image processing: Image enhancement processing is performed on the original images in the training set to obtain the image-processed training set;
[0011] Model Construction: Based on the YOLOv5s model, a redundant feature reuse module RFR is introduced to replace the residual structure of the C3 network structure in the basic model. An attention module SCBAM is introduced into the neck of the basic model, and a receptive field enhancement module RFE is added between the neck and head of the basic model to obtain the strip steel defect detection model. The strip steel defect detection model is used to detect defects in the input image and output the predicted bounding box and the defect category.
[0012] Label clustering: For all bounding boxes in the training set, calculate the cross-union ratio (CUP) between bounding boxes based on their scale information, and then cluster the bounding boxes using the K-means++ algorithm based on the CUP, selecting K bounding boxes as cluster centers;
[0013] Model training: The clustered bounding boxes are used as the prior boxes of the strip steel defect detection model. The strip steel defect detection model is trained based on the training set, and the trained strip steel defect detection model is tested and validated based on the test set and validation set to obtain the final strip steel defect detection model.
[0014] Defect detection: The strip image to be detected is used as the input image. The final strip defect detection model performs defect detection on the input image and outputs the predicted bounding box and the corresponding defect category.
[0015] Preferably, the location information in the label information is the location information of the center point of the label box, and the scale information is the length and width of the label box.
[0016] Preferably, image enhancement processing is performed on the original images in the training set, including the following steps:
[0017] The original image is scaled using the resize method in the OpenCV library to uniformly scale the original image to a predetermined size.
[0018] Adjust the brightness, contrast, and color saturation of the original image;
[0019] Image enhancement processing is performed on the original image based on Mosaic.
[0020] Preferably, the strip defect detection model includes an input end, a backbone network, a neck, a head, and an output end;
[0021] The input terminal is used to input images;
[0022] The backbone network includes a convolutional module, a redundant feature reuse module (RFR), and a spatial pyramid pooling module (SPPF), which are used to extract features from the input image and output multiple feature maps.
[0023] The neck section is a feature pyramid structure combining FPN and PAN modules, including a convolutional module, an upsampling module, a redundant feature reuse module RFR, a concatenation layer, an attention module SCBAM, and a receptive field enhancement module RFE, which are used to fuse multiple feature maps output by the backbone network and output the fused feature map.
[0024] The head is used to extract the location and category information of the target from the feature map output from the neck, and generate a prediction box;
[0025] The output terminal is used to filter and adjust the predicted bounding boxes generated by the header to obtain the final target detection result.
[0026] Preferably, the redundant feature reuse module RFR is used to perform the following operations:
[0027] L100: The input image is convolved using a 1×1 convolution module to obtain the first feature map;
[0028] L200: The first feature map is convolved using a 3×3 convolution module to obtain the second feature map;
[0029] L300: The first feature map and the second feature map are concatenated to form a redundant feature map;
[0030] L400, repeat steps L100-L300 twice.
[0031] Preferably, the attention module SCBAM includes a channel attention module and a spatial attention module, corresponding to a channel attention stage and a spatial attention stage. The attention module SCBAM is used to perform the following:
[0032] In the channel attention stage, the input feature map is compressed into a channel dimension vector through a global average pooling layer, the channel dimension is transformed through a 1×1 convolution operation, and weights are obtained through Sigmoid activation. The resulting weighted feature map is used as the channel attention weight map.
[0033] In the spatial attention stage, the feature map is compressed by max pooling and average pooling layers to obtain compressed feature maps. The compressed feature maps are then concatenated to obtain concatenated feature maps. The concatenated feature maps are then aggregated by a 7×7 convolution operation. Weights are obtained by the Sigmoid function to obtain a weighted feature map, which serves as the spatial attention weight map.
[0034] The input feature map is weighted based on the spatial attention weight map and the channel attention weight map to obtain the final feature map.
[0035] Preferably, the receptive field enhancement module RFE is used to perform the following:
[0036] The input feature map is divided into four equal parts: the first channel, the second channel, the third channel, and the fourth channel.
[0037] The first feature map is output by extracting features from the feature map of the first channel using a 3×3 convolution module.
[0038] The second feature map is output by extracting features from the feature map of the second channel through a 1×11 convolution module.
[0039] The third feature map is extracted by using an 11×1 convolution module.
[0040] The first feature map, the second feature map, the third feature map, and the feature map of the fourth channel are stitched together to obtain the stitched feature map.
[0041] The strip defect detection method of the present invention based on redundant feature reuse and receptive field enhancement has the following advantages:
[0042] 1. A strip steel defect detection model is constructed based on the YOLOv5s model with the introduction of the redundant feature reuse module RFR and the attention module SCBAM. The strip steel defect detection model is used to detect defects in strip steel. The redundant feature reuse module RFR enhances the feature extraction capability of the model and enhances the detection capability of fuzzy defects. Since strip steel defects are easily interfered with by the background, the attention module SCBAM is introduced to enhance the contrast between defects and background and improve the accuracy of strip steel defect detection. The receptive field enhancement module RFE is introduced to enhance the model's ability to capture complete defects.
[0043] 2. For the label information corresponding to the original image, the intersection-union ratio (IUR) of the bounding boxes is calculated based on the scale information. Based on the IUR of the bounding boxes, the bounding boxes are clustered using the K-means++ algorithm. K bounding boxes are selected as cluster centers to generate K bounding boxes that can better represent the scale information in the dataset. During the model training process, the clustered bounding boxes are used as prior boxes in the strip steel defect detection model, which can more accurately match the position and shape of the target and improve the model's localization ability. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] The invention will be further described below with reference to the accompanying drawings.
[0046] Figure 1 The flowchart is shown as an example of a strip defect detection method based on redundant feature reuse and receptive field enhancement.
[0047] Figure 2 This is a schematic diagram of the strip defect detection model in the strip defect detection method based on redundant feature reuse and receptive field enhancement in the embodiment.
[0048] Figure 3 This is a schematic diagram of the redundant feature reuse module RFR in the strip defect detection method based on redundant feature reuse and receptive field enhancement in the embodiment.
[0049] Figure 4 This is a schematic diagram of the attention module SCBAM in the strip defect detection method based on redundant feature reuse and receptive field enhancement in the embodiment.
[0050] Figure 5 This is a schematic diagram of the channel attention module of the attention module SCBAM in the strip defect detection method based on redundant feature reuse and receptive field enhancement in the embodiment.
[0051] Figure 6 This is a schematic diagram of the spatial attention module of the attention module SCBAM in the strip defect detection method based on redundant feature reuse and receptive field enhancement in the embodiment.
[0052] Figure 7 This is a schematic diagram of the receptive field enhancement module (RFE) in the strip defect detection method based on redundant feature reuse and receptive field enhancement, as shown in the embodiment. Detailed Implementation
[0053] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0054] This invention provides a strip steel defect detection method based on redundant feature reuse and receptive field enhancement, which is used to solve the technical problem of how to achieve efficient and accurate identification of strip steel defects.
[0055] Example:
[0056] This invention relates to a strip steel defect detection method based on redundant feature reuse and receptive field enhancement, comprising six steps: data acquisition, image processing, model construction, label clustering, model training, and defect detection.
[0057] Step S100 Data Acquisition: Acquire images with surface defects of strip steel as original images, annotate the defects in the original images to obtain label information, construct a dataset based on the original images and corresponding label information, and divide the dataset into training set, validation set and test set, where the label information includes the position information of the annotation box, scale information and category label.
[0058] In step S100 of this embodiment, the dataset label format is converted from XML to TXT format. This involves extracting the annotation information from each XML file and converting it to the corresponding TXT file. Each line of the TXT file represents the category, center coordinates, length, and width. Finally, the converted dataset is divided into training, validation, and test sets in an 8:1:1 ratio to facilitate model training.
[0059] Step S200 Image Processing: Perform image enhancement processing on the original images in the training set to obtain the image-processed training set.
[0060] This embodiment uses data augmentation to perform data augmentation processing on the original image with labeled information to obtain more complex data information, reduce overfitting, and improve the accuracy of the detection model.
[0061] Image enhancement processing is performed on the original images in the training set, including the following steps:
[0062] (1) Perform image scaling on the original image, and use the resize method in the OpenCV library to uniformly scale the original image to a predetermined size;
[0063] (2) Adjust the brightness, contrast and color saturation of the original image;
[0064] (3) Image enhancement processing of the original image based on Mosaic.
[0065] In this embodiment, the image enhancement process first uses the `resize` method from the OpenCV library to uniformly scale the defective strip product images to 512×512 pixels. Next, the brightness, contrast, and color saturation of the defective images are adjusted to further improve the model's robustness. Then, Mosaic data augmentation is performed on the defective images. Specifically, a new Mosaic canvas is created, a point is randomly generated on the canvas, and the four images are placed around this point. Images exceeding the canvas are cropped, while those within the canvas do not require cropping, forming a new composite image. During the stitching process, the algorithm uses random matrix transformations, such as rotation and translation, to increase the diversity of the composite image.
[0066] Step S300 Model Construction: Based on the YOLOv5s model, a redundant feature reuse module RFR is introduced to replace the residual structure of the C3 network structure in the basic model. An attention module SCBAM is introduced into the neck of the basic model, and a receptive field enhancement module RFE is added between the neck and head of the basic model to obtain the strip steel defect detection model. The strip steel defect detection model is used to detect defects in the input image and output the predicted bounding box and the defect category.
[0067] In this embodiment, the strip defect detection model includes an input end, a backbone network, a neck, a head, and an output end.
[0068] The input terminal is used to input images; in this embodiment, the input is a 512×512 RGB image.
[0069] The backbone network includes a convolutional module, a redundant feature reuse module (RFR), and a spatial pyramid pooling module (SPPF), which are used to extract features from the input image and output multiple feature maps.
[0070] As a specific implementation of the backbone network, the backbone network, from top to bottom, includes the first convolutional module, the second convolutional module, the first redundant feature reuse module (RFR), the third convolutional module, the second redundant feature reuse module (RFR), the fourth convolutional module, the third redundant feature reuse module (RFR), the fifth convolutional module, the fourth redundant feature reuse module (RFR), and the first spatial pyramid pooling module (SPPF).
[0071] The neck section is a feature pyramid structure combining the FPN and PAN modules, including a convolutional module, an upsampling module, a redundant feature reuse module (RFR), a concatenation layer, an attention module (SCBAM), and a receptive field enhancement module (RFE). It is used to fuse multiple feature maps output by the backbone network and output the fused feature map.
[0072] The Redundant Feature Reuse (RFR) module performs the following operations:
[0073] L100: The input image is convolved using a 1×1 convolution module to obtain the first feature map;
[0074] L200: The first feature map is convolved using a 3×3 convolution module to obtain the second feature map;
[0075] L300: The first feature map and the second feature map are concatenated to form a redundant feature map;
[0076] L400, repeat steps L100-L300 twice.
[0077] Due to insufficient fuzzy feature extraction, traditional convolutional structures struggle to extract effective information. To enhance feature extraction capabilities, some architectures increase the number of network layers. However, increasing the number of layers inevitably leads to more parameters and computational overhead. To avoid introducing excessive parameters and computational overhead while increasing the number of layers, depthwise separable convolutions are typically used instead of ordinary convolutional structures. However, the use of depthwise separable convolutions may reduce the network's detection capabilities. To address this issue, this embodiment introduces a Redundant Feature Reuse (RFR) module. The design of RFR is inspired by the application of redundancy in GhostNet, but unlike GhostNet's use of depthwise separable convolutions to generate redundant features, this embodiment uses ordinary convolutions instead of depthwise separable convolutions for redundant feature generation. This structure can deepen the network structure and enhance its detection capabilities without increasing the number of parameters.
[0078] This embodiment improves the residual structure in the original C3 module by using a Redundant Feature Reuse (RFR) module. The C3 module first divides each channel into half using two 1×1 convolutional modules. The right branch then passes through the residual structure, and finally, the output of the left branch and the residual structure are concatenated. The output features are then obtained through a 1×1 convolutional module. This embodiment proposes the Redundant Feature Reuse (RFR) module to replace the residual structure in the C3 module, thereby improving the network's feature extraction capability.
[0079] Redundant Feature Reuse Module (RFR) Figure 3As shown, in the Redundant Feature Reuse (RFR) module, the channels are first reduced to half their original size using a 1×1 convolutional module. Then, a 3×3 convolutional module further generates complex features. Finally, the feature maps output from the 1×1 and 3×3 convolutional modules are concatenated. Similar features before and after the 3×3 convolutional module can be concatenated to form similar redundant feature maps, while dissimilar parts can make the concatenated features more diverse. The RFR module consists of two consecutive redundant feature modules (RF).
[0080] The redundant feature reusing module (RF) can only replace normal convolutions, which is still difficult to improve the feature extraction capability of the network. Therefore, this embodiment connects two consecutive redundant feature reusing modules (RF) to increase the network depth and improve its detection capability. In addition, connecting two consecutive redundant feature reusing modules (RF) allows for the reuse of local features and can preserve some detailed information in deeper layers of the network. However, as the network deepens and the number of redundant feature reusing modules (RF) increases, the network is prone to gradient vanishing. To address this, this embodiment introduces residual connections in the redundant feature reusing module (RFR), which can effectively solve the gradient vanishing problem caused by increased network depth. Compared with the residual structure in the C3 module of YOLOv5s, the redundant feature reusing module (RFR) in this embodiment reduces the number of parameters and computational cost, increases network depth, and improves the network's feature extraction and detection capabilities.
[0081] The neck section is a feature pyramid structure combining the FPN and PAN modules. Following the Spatial Pyramid Pooling (SPPF) module are the sixth convolutional module, an upsampling module, a concatenation of outputs from the upper layer and the third redundant feature reuse module (RFR), the fifth redundant feature reuse module (RFR), the first attention module (SCBAM), the seventh convolutional module, an upsampling module, a concatenation of outputs from the upper layer and the second redundant feature reuse module (RFR), the sixth redundant feature reuse module (RFR), the second attention module (SCBAM), the eighth convolutional module, a concatenation of outputs from the upper layer and the seventh convolutional module, the seventh redundant feature reuse module (RFR), the third attention module (SCBAM), the ninth convolutional module, a concatenation of outputs from the upper layer and the sixth convolutional module, and the eighth redundant feature reuse module (RFR). After the sixth redundant feature reuse module (RFR), the first receptive field enhancement module (RFE) is added; after the seventh redundant feature reuse module (RFR), the second receptive field enhancement module (RFE) is added; and after the eighth redundant feature reuse module (RFR), the third receptive field enhancement module (RFE) is added.
[0082] The attention module SCBAM includes a channel attention module and a spatial attention module, corresponding to a channel attention stage and a spatial attention stage. The attention module SCBAM is used to perform the following:
[0083] (1) In the channel attention stage, the input feature map is compressed into a channel dimension vector through a global average pooling layer, the channel dimension is transformed through a 1×1 convolution operation, and weights are obtained through Sigmoid activation, resulting in a weighted feature map as the channel attention weight map.
[0084] (2) In the spatial attention stage, the feature map is compressed by the max pooling layer and the average pooling layer to obtain the compressed feature map. The compressed feature map is then concatenated to obtain the concatenated feature map. The concatenated feature map is then aggregated by a 7×7 convolution operation. The weights are obtained by the Sigmoid function to obtain the weighted feature map as the spatial attention weight map.
[0085] (3) The input feature map is weighted based on the spatial attention weight map and the channel attention weight map to obtain the final feature map.
[0086] Unlike the original attention module CBAM, the attention module SCBAM in this embodiment simplifies the channel attention module in the original CBAM. The structure of the attention module SCBAM is the same as the original CBAM, including both a channel attention module and a spatial attention module. The structure of the attention module SCBAM is as follows: Figure 4 As shown. In the channel attention stage, unlike the previous structure, the input feature map is compressed into a channel-dimensional vector only through a global average pooling layer to prevent maximum values from destroying global information. Then, a 1×1 convolution operation is used to transform the channel dimensions, exchanging information between channels. Finally, the weights are obtained through the sigmoid activation function, resulting in the channel attention weight map. The channel attention stage is as follows. Figure 5 As shown in the diagram. In the spatial attention stage, the feature map is first compressed using max pooling and average pooling layers. Then, the compressed feature maps are concatenated. Next, a 7×7 convolution operation is used to aggregate the features of the concatenated feature map. Finally, the sigmoid function is used to obtain the weights, resulting in the spatial attention weight map. The spatial attention stage is as follows: Figure 6 As shown. Finally, the input feature map is weighted using the spatial attention weight map and the channel attention weight map to obtain the final feature map.
[0087] In this embodiment, the attention module SCBAM is inserted into the neck. The attention module SCBAM enhances features simultaneously from both channel and spatial aspects. Channel weighting makes the network pay more attention to defect features, while spatial weighting helps to alleviate the misalignment caused by feature fusion, enhances the network's ability to distinguish between defects and background, and effectively improves the network's classification and localization capabilities.
[0088] The receptive field enhancement module RFE structure is as follows: Figure 7 As shown, the first 1 / 4 channel of this module is used to extract features from the input feature map using a 3×3 convolutional module, the second 1 / 4 channel is used to extract features from the input feature map using a 1×11 convolutional module, the third 1 / 4 channel is used to extract features from the input feature map using an 11×1 convolutional module, and the fourth 1 / 4 channel is concatenated. The execution is as follows:
[0089] (1) Divide the input feature map into four equal parts, namely the first channel, the second channel, the third channel and the fourth channel;
[0090] (2) The feature map of the first channel is extracted by a 3×3 convolution module, and the first feature map is output.
[0091] (3) Extract features from the feature map of the second channel using a 1×11 convolution module and output the second feature map;
[0092] (4) The feature map of the third channel is extracted by an 11×1 convolution module, and the third feature map is output.
[0093] (5) The first feature map, the second feature map, the third feature map and the feature map of the fourth channel are spliced together to obtain the spliced feature map.
[0094] In this embodiment, the receptive field enhancement module (RFE) uses a 3×3 convolutional module to extract key defect features. Then, convolutional modules with large kernels of 1×11 and 11×1 are used to increase the receptive field and extract complete defect features. Using convolutional modules with large kernels of 1×11 and 11×1 effectively reduces computational costs. Considering the scale ratio of defects in actual defect detection datasets, this convolutional kernel can better fit the defect shape. Inserting the RFE module between the neck and head allows for further extraction and refinement of irregular defect features at different levels before output, providing more complete defect feature information for the detection head.
[0095] The head is used to extract the location and category information of the target from the feature map output from the neck, and generate a prediction box.
[0096] In this embodiment, the outputs of the first receptive field enhancement module (RFE), the second receptive field enhancement module (RFE), and the third receptive field enhancement module (RFE) are sequentially extracted from the header for detection and classification.
[0097] The output is used to filter and adjust the predicted bounding boxes generated in the header to obtain the final target detection results.
[0098] Step S400 Label Clustering: For all bounding boxes in the training set, calculate the crossover ratio (CRO) between bounding boxes based on their scale information, and then cluster the bounding boxes using the K-means++ algorithm based on the CRO. Select K bounding boxes as cluster centers.
[0099] In this embodiment, the bounding boxes are clustered using the K-means++ algorithm based on the intersection-union ratio (IU / UK) of the bounding boxes, including the following steps:
[0100] L100: Randomly select a sample from the dataset as the initial cluster center. The sample is the scale information in the label information.
[0101] L200: Calculate the intersection-union ratio of the remaining samples in the dataset to the initial cluster centers;
[0102] L300. Use the roulette wheel method to select a new point as the new cluster center;
[0103] L400, Repeat steps S200-L300 until K cluster centers are obtained;
[0104] L500: Using K cluster centers as initial points, execute the K-means algorithm.
[0105] In this embodiment, K=9, meaning that nine bounding boxes are selected as cluster centers to generate nine bounding boxes that can better represent the central scale information of the dataset.
[0106] Step S500 Model Training: The clustered bounding boxes are used as the prior boxes of the strip steel defect detection model. The strip steel defect detection model is trained based on the training set, and the trained strip steel defect detection model is tested and validated based on the test set and validation set to obtain the final strip steel defect detection model.
[0107] In this embodiment, the processed original images from the training set are input into the strip steel defect detection model. During training, the loss function is calculated and the model parameters are iteratively optimized. The number of early stops is set. When the network model reaches a certain index, and the number of early stops does not exceed that index, the network model ends training. Using the validation set, the model parameters are tuned to obtain the optimal weight file. During testing, the optimal weight file and the test set are simultaneously input into the strip steel defect detection model, and the intersection-union ratio (IUU) of the predicted bounding boxes and the labeled bounding boxes, as well as the evaluation index, are calculated.
[0108] Step S600 Defect Detection: The image of the strip steel to be detected is used as the input image. The final strip steel defect detection model is used to detect defects in the input image and outputs the prediction box and the corresponding defect category.
[0109] In this embodiment, the optimal weights of the acquired strip defect detection images and models are fed into the network, and the network will accurately output the location and category of the defects.
[0110] The present invention has been shown and described in detail above with reference to the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above embodiments, those skilled in the art will know that more embodiments of the present invention can be obtained by combining the means in the different embodiments described above, and these embodiments are also within the protection scope of the present invention.
Claims
1. A method for strip defect detection based on redundant feature reuse and receptive field enhancement, characterized in that, Includes the following steps: Data acquisition: Images with surface defects of steel strips are acquired as raw images. The defects in the raw images are labeled to obtain label information. A dataset is constructed based on the raw images and the corresponding label information, and the dataset is divided into training set, validation set and test set. The label information includes the position information of the annotation box, scale information and category label. Image processing: Image enhancement processing is performed on the original images in the training set to obtain the image-processed training set; Model Construction: Based on the YOLOv5s model, a redundant feature reuse module RFR is introduced to replace the residual structure of the C3 network structure in the basic model. An attention module SCBAM is introduced into the neck of the basic model, and a receptive field enhancement module RFE is added between the neck and head of the basic model to obtain the strip steel defect detection model. The strip steel defect detection model is used to detect defects in the input image and output the predicted bounding box and the defect category. Label clustering: For all bounding boxes in the training set, calculate the cross-union ratio (CUP) between bounding boxes based on their scale information, and then cluster the bounding boxes using the K-means++ algorithm based on the CUP, selecting K bounding boxes as cluster centers; Model training: The clustered bounding boxes are used as the prior boxes of the strip steel defect detection model. The strip steel defect detection model is trained based on the training set, and the trained strip steel defect detection model is tested and validated based on the test set and validation set to obtain the final strip steel defect detection model. Defect detection: The strip image to be detected is used as the input image. The final strip defect detection model detects defects in the input image and outputs the prediction box and the corresponding defect category. The redundant feature reuse module RFR is used to perform the following operations: L100: The input image is convolved using a 1×1 convolution module to obtain the first feature map; L200: The first feature map is convolved using a 3×3 convolution module to obtain the second feature map; L300: The first feature map and the second feature map are concatenated to form a redundant feature map; L400, repeat step L100-step L300 twice; The attention module SCBAM includes a channel attention module and a spatial attention module, corresponding to a channel attention stage and a spatial attention stage. The attention module SCBAM is used to perform the following: In the channel attention stage, the input feature map is compressed into a channel dimension vector through a global average pooling layer, the channel dimension is transformed through a 1×1 convolution operation, and weights are obtained through Sigmoid activation. The resulting weighted feature map is used as the channel attention weight map. In the spatial attention stage, the feature map is compressed by max pooling and average pooling layers to obtain compressed feature maps. The compressed feature maps are then concatenated to obtain concatenated feature maps. The concatenated feature maps are then aggregated by a 7×7 convolution operation. Weights are obtained by the Sigmoid function to obtain a weighted feature map, which serves as the spatial attention weight map. The input feature map is weighted based on the spatial attention weight map and the channel attention weight map to obtain the final feature map.
2. The strip defect detection method based on redundant feature reuse and receptive field enhancement according to claim 1, characterized in that, The location information in the label information refers to the location of the center point of the label box, and the scale information refers to the length and width of the label box.
3. The strip defect detection method based on redundant feature reuse and enhanced receptive field according to claim 1, characterized in that, Image enhancement processing is performed on the original images in the training set, including the following steps: The original image is scaled using the resize method in the OpenCV library to uniformly scale the original image to a predetermined size. Adjust the brightness, contrast, and color saturation of the original image; Image enhancement processing is performed on the original image based on Mosaic.
4. The strip defect detection method based on redundant feature reuse and enhanced receptive field according to claim 1, characterized in that, The strip defect detection model includes an input end, a backbone network, a neck, a head, and an output end; The input terminal is used to input images; The backbone network includes a convolutional module, a redundant feature reuse module (RFR), and a spatial pyramid pooling module (SPPF), which are used to extract features from the input image and output multiple feature maps. The neck section is a feature pyramid structure combining FPN and PAN modules, including a convolutional module, an upsampling module, a redundant feature reuse module RFR, a concatenation layer, an attention module SCBAM, and a receptive field enhancement module RFE, which are used to fuse multiple feature maps output by the backbone network and output the fused feature map. The head is used to extract the location and category information of the target from the feature map output from the neck, and generate a prediction box; The output terminal is used to filter and adjust the predicted bounding boxes generated by the header to obtain the final target detection result.
5. The strip defect detection method based on redundant feature reuse and receptive field enhancement according to claim 4, characterized in that, The receptive field enhancement module RFE is used to perform the following: The input feature map is divided into four equal parts: the first channel, the second channel, the third channel, and the fourth channel. The first feature map is output by extracting features from the feature map of the first channel using a 3×3 convolution module. The second feature map is output by extracting features from the feature map of the second channel through a 1×11 convolution module. The third feature map is extracted by using an 11×1 convolution module. The first feature map, the second feature map, the third feature map, and the feature map of the fourth channel are stitched together to obtain the stitched feature map.
Citation Information
Patent Citations
Low-altitude security target detection method and system based on deep learning
CN114792390A
Steel surface defect detection method based on improved YOLOv5s
CN115829991A
