A steel plate surface defect detection method, device and equipment based on YOLOX

Through the improved YOLOX network structure, the detection accuracy of small target defects on the surface of steel plates is enhanced, the problem of unreliable detection in existing technologies is solved, and more efficient defect detection effects are achieved.

CN116071338BActive Publication Date: 2025-09-19SUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310133204.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-20
Publication Date
2025-09-19
Estimated Expiration
2043-02-20

AI Technical Summary

Technical Problem

The existing technology for detecting small target defects on the surface of steel plates lacks sufficient precision and accuracy, resulting in unreliable detection and affecting production efficiency and costs.

Method used

A steel plate surface defect detection method based on YOLOX is adopted. The Focus module is connected in series with the darknet module, and the CBAM module and RFB module are combined for feature extraction and fusion. The ASPP module is used to obtain multi-scale object information, and the decoupling head is used to predict the target output. The positive and negative samples are dynamically matched to optimize the model weight.

Benefits of technology

The detection accuracy of small target defects on the surface of steel plates has been significantly improved, with the MAP value increased by more than 3 percentage points, reducing production costs and improving product quality and production efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116071338B_ABST
    Figure CN116071338B_ABST
Patent Text Reader

Abstract

The present invention relates to a steel plate surface defect detection method based on YOLOX. The method comprises the following steps: constructing a defect detection model based on a YOLOX network, initializing epoch, learning rate and model weight; inputting a training set into the defect detection model, performing preprocessing and then inputting the training set into a backbone network, passing through a Focus module and four darknet modules connected in series, outputting three effective feature maps of different sizes; inputting the three effective feature maps into three CBAM modules of corresponding sizes respectively, performing adaptive feature correction, and then inputting the three branches of a bottleneck network respectively, each branch including an RFB module and an ASPP module connected in series, outputting three enhanced feature maps, and respectively inputting the three enhanced feature maps into corresponding decoupling heads to output prediction results; decoding the prediction results, dynamically matching positive and negative samples using SimOTA, calculating the total loss value of the positive and negative samples, and updating the model weights based on the total loss value; repeatedly inputting sample data into the defect detection model for training until the number of training times reaches epoch, and outputting a final defect detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of steel plate defect detection, and in particular to a YOLOX-based steel plate surface defect detection method, device and equipment. Background Art

[0002] The development of deep learning has greatly promoted the advancement of defect detection. Steel plate defect detection methods based on deep learning abandon the hand-crafted feature extraction algorithms used in traditional machine learning. Instead, they adopt a model where the network learns features on its own, trains through interaction with sample data, and updates network architecture parameters through backpropagation, achieving automatic feature extraction. This eliminates the need for hand-crafted feature extraction algorithms and further improves accuracy and efficiency. They are currently widely used in industrial production inspections. Single-stage detection networks, led by the YOLO series, hold a key position in the field of target detection. By directly inputting images into the model, the neural network only needs to learn the image once to obtain the corresponding results. This ensures speed while maintaining a certain level of accuracy. After multiple iterations, performance and speed have been significantly optimized, making them the mainstream models in the field of deep learning-based target detection.

[0003] The existing model is YOLOX, which uses the same backbone and bottleneck networks as YOLOv3. Mosaic enhancement and hybrid enhancement are used for data preprocessing. The backbone network still uses the CSP architecture, primarily utilizing a residual structure for feature extraction. The extracted features are then fused and concatenated with the original input, and the resulting features in three different dimensions are output to the bottleneck network. This bottleneck network then performs feature fusion on the input feature map in three dimensions before outputting them to the decoupling head. The decoupling head forms three branches, one for the predicted box category, the other foreground and background, and the predicted box coordinates. These three outputs are stacked, decoded, and used to obtain positive samples using SimOTA. The predicted box is then optimized by calculating the loss. The activation functions used throughout the entire model network are Rectified Linear Unit (ReLU) and Weighted Rectified Linear Unit (SiLU), with the latter being the most common. The overall structure is an end-to-end YOLO model.

[0004] Currently, steel plates can develop various defects during the production process, including cracks, scratches, spots, and pitting. These defects not only affect appearance but also reduce strength and make them susceptible to rust. Existing detection networks lack sufficient precision and accuracy for small objects, failing to fully consider their characteristics. As network layers increase, the features of small objects shrink until they disappear, leading to significant false detections and missed detections of various small defects. This makes detection highly unreliable, significantly impacting production efficiency and costs, and prohibiting industrial application. Summary of the Invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the problem of insufficient detection precision and accuracy for small targets in the prior art.

[0006] To solve the above technical problems, the present invention provides a steel plate surface defect detection method based on YOLOX, comprising:

[0007] The sample data to be tested is input into the backbone network of the defect detection model built based on the YOLOX network. After passing through the Focus module and four darknet modules connected in series, three effective feature maps of different sizes are output after passing through the second darknet module, the third darknet module, and the fourth darknet module.

[0008] The three effective feature maps of different sizes are input into three CBAM modules of corresponding sizes respectively. The channel attention feature map and spatial attention feature map generated by the CBAM module are multiplied by the input effective feature map, and then output after adaptive feature correction.

[0009] The outputs of the three CBAM modules are respectively input into the three branches of the bottleneck network. Each branch includes an RFB module and an ASPP module connected in series, and outputs three enhanced feature maps.

[0010] The three enhanced feature maps are input into the corresponding decoupling heads respectively; the decoupling head convolves the input enhanced feature map, decomposing it into a regression branch, a confidence branch, and a classification branch, and outputs three prediction targets, which include the coordinate information of the prediction box, the foreground and background, and the object type; the three prediction targets are stacked and the prediction result is output.

[0011] In one embodiment of the present invention, before inputting the sample data to be detected into the backbone network of the defect detection model constructed based on the YOLOX network, the method further includes:

[0012] Obtain steel plate surface defect image data and divide it into training set and test set;

[0013] Initialize the epoch, learning rate, and model weight of the defect detection model built based on the YOLOX network; input the training set into the defect detection model and perform preprocessing to obtain a sample training set;

[0014] The preprocessing includes rotating, cropping, scaling, translating and GridMask enhancement of the steel plate surface defect image data.

[0015] In one embodiment of the present invention, each darknet module includes a BaseConv module and a CSPLayer module connected in series along the forward propagation direction;

[0016] The BaseConv module includes a convolution unit, a batch normalization unit and an activation function unit connected in series along the forward propagation direction;

[0017] The fourth darknet module also includes an SPP module, which is arranged after the CSPLayer module;

[0018] The SPP module convolves the input feature image and inputs it into multiple pooling units with different pooling kernel sizes for pooling. The multiple feature images obtained after pooling and the convolved feature image are input into the SELayer layer for processing, and then the BaseConv module outputs the effective feature map.

[0019] In one embodiment of the present invention, the RFB module decomposes the input enhanced feature map into three branches with different expansion rates. After each branch is processed by a convolution kernel of a different size, the three branches are spliced ​​and output through a 3×3 dilated convolution.

[0020] In one embodiment of the present invention, the ASPP module convolves the output of the RFB module through multiple parallel dilated convolutional layers with different sampling rates, and then fuses the output enhanced feature map.

[0021] In one embodiment of the present invention, after outputting the prediction result, the method further includes:

[0022] Decode the prediction results, use SimOTA to dynamically match positive and negative samples, calculate the total loss value of positive and negative samples, and optimize the model weights based on the total loss value;

[0023] Repeatedly input the sample data to be tested in the sample training set into the defect detection model for training until the number of training times reaches epoch, and output the final defect detection model;

[0024] The sample data to be tested in the test set is input into the final defect detection model to obtain the surface defect detection results of the steel plate.

[0025] In one embodiment of the present invention, the SimOTA dynamic matching of positive and negative samples includes:

[0026] Filter the positive sample candidate area as the real box;

[0027] Calculate the overlap I OU between the real box and each predicted box;

[0028] Sum the IOU of the top 10 predicted boxes with the highest overlap with the true box to obtain the k value of the true box, round k down, and use the top k predicted boxes as positive samples, and the rest as negative samples;

[0029] Use positive samples and negative samples to calculate the cost matrix and dynamically match positive and negative samples;

[0030] The cost matrix is ​​expressed as:

[0031] in, and They are classification loss and localization loss respectively.

[0032] In one embodiment of the present invention, the calculating of the total loss value of positive and negative samples includes:

[0033] Use BCEWithLog itsLoss function to train the confidence branch and classification branch to obtain the foreground background loss L obj With classification loss L cls ;

[0034] Use SI OU function to train the regression branch and obtain the positioning loss L reg ;

[0035] Total loss value:

[0036] Among them, λ is the balance coefficient of positioning loss, the default value is 5.0, N pos is the number of anchor points classified as positive samples.

[0037] The embodiment of the present invention further provides a steel plate surface defect detection device based on YOLOX, comprising:

[0038] Data acquisition module, used to obtain steel plate surface defect image data;

[0039] A preprocessing module is used to rotate, crop, scale, translate and perform GridMask enhancement on the steel plate surface defect images to obtain sample images;

[0040] The backbone network module is used to process the input sample image through the Focus module and four darknet modules, and output three valid feature maps of different sizes;

[0041] The bottleneck network module is used to process the effective feature map through the CBAM module, RFB module and ASPP module of corresponding size and output the enhanced feature map;

[0042] The decoupling module is used to decompose the enhanced feature map and output three prediction targets, including coordinate information, foreground and background, and object type; the three prediction targets are stacked and the prediction results are output;

[0043] The model optimization module is used to decode the prediction results, use SimOTA to dynamically match positive and negative samples, calculate the total loss value of positive and negative samples, and optimize the model weights based on the total loss value;

[0044] Model acquisition module: Repeat the above steps, input sample images into the defect detection model for training, until the number of training times reaches epoch, and output the final defect detection model;

[0045] The test set prediction module inputs the test set into the final defect detection model to obtain the steel plate surface defect detection results.

[0046] The embodiment of the present invention further provides a steel plate surface defect detection device based on YOLOX, comprising:

[0047] A collection device for collecting images of surface defects of steel plates;

[0048] The device for the steel plate surface defect detection method based on YOLOX as described above is communicatively connected to the acquisition device, and is used to implement the steps of the steel plate surface defect detection method based on YOLOX when executing the computer program, and output the steel plate surface defect detection results;

[0049] A display device is communicatively connected to the device of the YOLOX-based steel plate surface defect detection method, and is used to obtain and display the steel plate surface defect detection results.

[0050] The above technical solution of the present invention has the following advantages over the prior art:

[0051] The YOLOX-based steel plate surface defect detection method described in the present invention is based on the YOLOX network and performs enhanced extraction and feature fusion on the features of small targets; through the CBAM module, convolution is performed in space and channel respectively, and attention feature maps are serialized in the two dimensions of channel and space, and multiplied with the input feature image to perform adaptive feature correction to improve detection accuracy; using the RFB module, the input enhanced feature map is decomposed into three branches with different expansion rates, and these three branches with different receptive fields are superimposed to expand the receptive field of the defect detection model network; through the ASPP module, different void ratios are used to construct void convolution kernels with different receptive fields to obtain multi-scale object information; compared with the original YOLOX network, the detection accuracy of small target defects such as cracks, scratches, inclusions, pitting and oxide scale on the steel plate surface is greatly improved, the MAP value is increased by more than three points, the small target defect detection effect is significant, which helps to reduce the production cost of steel plates and improve product quality and production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments of the present invention in conjunction with the accompanying drawings, wherein

[0053] Figure 1It is a flowchart of the steps of the steel plate surface defect detection method based on YOLOX provided by the present invention;

[0054] Figure 2 It is a structural diagram of the defect detection model provided by the present invention;

[0055] Figure 3 Schematic diagram of the structure of the BaseConv module provided by the present invention;

[0056] Figure 4 This is a schematic diagram of the composition structure of the SPP module provided by the present invention;

[0057] Figure 5 This is a schematic diagram of the structure of the decoupling head provided by the present invention;

[0058] Figure 6 This is a schematic diagram of the test results of the existing YOLOX-based defect detection technology on the training set;

[0059] Figure 7 It is a schematic diagram of the test results of the steel plate surface defect detection method based on YOLOX provided by the present invention on the training set. DETAILED DESCRIPTION

[0060] 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 the present invention and implement it. However, the embodiments are not intended to limit the present invention.

[0061] Reference Figure 1 FIG. 1 is a flow chart of the steps of the steel plate surface defect detection method based on YOLOX of the present invention, comprising:

[0062] S1: The sample data to be tested is input into the backbone network of the defect detection model built based on YOLOX. After passing through the Focus module and four darknet modules in series, three effective feature maps of different sizes are output after passing through the second darknet module, the third darknet module, and the fourth darknet module.

[0063] Reference Figure 2 Figure 1 is a schematic diagram of the structure of the defect detection model provided by the present invention; the defect detection model includes a backbone network, a bottleneck network and a decoupling head; the backbone network includes a Focus module and four darknet modules; the bottleneck network includes three branches, each of which includes a CBAM module, an RFB module and an ASPP module connected in series in sequence;

[0064] The Focus module is used to obtain a value for every pixel in the input sample image, obtain four independent feature layers, and then stack the four feature layers to concentrate the width and height information into channel information. The input channels are expanded four times, and the spliced ​​feature layers become twelve channels compared to the original three channels, which enhances the feature extraction capability. The output is then sent to the first darknet module after convolution, batch normalization and activation by the BaseConv module.

[0065] Reference Figure 3 As shown in FIG, the BaseConv module includes a convolution unit, a batch normalization unit, and an activation function unit sequentially connected in series along the forward propagation direction, and the activation function adopts the SiLU function.

[0066] The first darknet module, the second darknet module, the third darknet module and the fourth darknet module each include a BaseConv module and a CSPLayer module connected in series along a forward propagation direction;

[0067] The CSPLayer module is used to perform residual calculation on the input feature image after 1×1 convolution; the output after residual calculation is stacked with the output after only 1×1 convolution, and then the output is obtained by 1×1 convolution after stacking.

[0068] The SPP module is added to the CSPLayer module of the fourth darknet module; the SPP module is the SPBottl eNeck module, refer to Figure 4 As shown in the figure, the SPP module pools the feature image through pooling kernels of different sizes, which can significantly improve the receptive field of the network; SELayer is added to the SPP module to extract multi-scale spatial information, realize the fusion of more spatial features, and improve the sensitivity to channel features.

[0069] The CSPLayer modules of the second, third, and fourth darknet modules each output a valid feature map, namely the first, second, and third feature maps, which are fed into the bottleneck network; the shapes of the first, second, and third feature maps are f1 = (80, 80, 256), f2 = (40, 40, 512), and f3 = (20, 20, 1024), respectively;

[0070] S2: Input the three effective feature maps of different sizes into three CBAM modules of corresponding sizes respectively, multiply the channel attention feature map and spatial attention feature map generated by the CBAM module with the input effective feature map, perform adaptive feature correction and output;

[0071] The CBAM module performs convolution processing on space and channels to extract features, and serializes attention feature map information in both channel and space dimensions. The two feature map information are then multiplied with the original input feature map for adaptive feature correction.

[0072] S3: The outputs of the three CBAM modules are input into the three branches of the bottleneck network respectively. Each branch includes an RFB module and an ASPP module connected in series, and outputs three enhanced feature maps.

[0073] The RFB module is used to transform each input feature image into three branches with different expansion rates. The bottom layer of each branch is processed by convolution kernels of sizes 1x1, 3x3, and 5x5, respectively, and then subjected to a 3x3 dilated convolution, so that different branches have different receptive fields. Finally, these branches with different receptive fields are superimposed to significantly improve the receptive field of the network;

[0074] The ASPP module uses multiple parallel atrous convolution layers with different sampling rates. Different atrous rates are used to construct atrous convolution kernels with different receptive fields. The features extracted at each sampling rate are further processed in separate branches and fused to generate the final result. Convolution kernels with different receptive fields are constructed using different atrous rates to capture multi-scale object information.

[0075] S4: Input the three enhanced feature maps into the corresponding decoupling heads respectively; each decoupling head outputs three prediction targets, which include the coordinate information of the prediction box, the foreground and background, and the object type; the three prediction targets are stacked and the prediction result is output;

[0076] Reference Figure 5 As shown in the figure, the decoupling head YoloHead performs convolution on the input enhanced feature map and decomposes it into regression branch, confidence branch and classification branch. It obtains the coordinate information of the prediction box, foreground and background, and object category respectively, stacks them, and outputs the prediction result.

[0077] Specifically, each enhanced feature map generates three prediction targets: Reg(h, w, 4), which determines the regression parameters (i.e., coordinate information) of each feature point. After adjusting the regression parameters, a prediction box is obtained; Obj(h, w, 1), which determines whether each feature point contains an object; and C ls(h, w, num_c l asses), which determines the type of object contained in each feature point. These three prediction targets are stacked to produce a prediction result for each feature layer: (h, w, 4 + 1 + num_c l asses), where 4 represents the regression parameter of each feature point, 1 indicates whether an object is contained, num_c l asses represents the type of object contained in each feature point, and (h, w) represents the length and width of the prediction box.

[0078] Based on the above embodiment, in this embodiment, before inputting the sample data to be detected into the backbone network of the defect detection model constructed based on the YOLOX network, the following steps are also included:

[0079] Obtain steel plate surface defect image data and divide it into training set and test set;

[0080] Build a defect detection model based on the YOLOX network, initialize the epoch, learning rate, and model weight; input the training set into the defect detection model and perform preprocessing to obtain a sample training set;

[0081] The preprocessing includes rotating, cropping, scaling, translating and GridMask enhancement of the steel plate surface defect image data.

[0082] Based on the above embodiment, in this embodiment, after outputting the prediction result, the method further includes:

[0083] The prediction results are decoded, and SimOTA is used to dynamically match positive and negative samples. The total loss value of positive and negative samples is calculated, and the model weights are optimized based on the total loss value. The sample data to be tested in the sample training set is repeatedly input into the defect detection model for training until the number of training times reaches epoch, and the final defect detection model is output. The sample data to be tested in the test set is input into the final defect detection model to obtain the surface defect detection results of the steel plate.

[0084] The method of using SimOTA to dynamically match positive and negative samples includes: screening positive sample candidate areas as the true box gt; calculating the overlap between the true box gt and each predicted box anchor; summing the IOUs of the top 10 predicted box anchors with the highest overlap and the true box to obtain the k value of the true box, rounding k down, taking the top k anchors as positive samples and the rest as negative samples; calculating the cost matrix using the positive and negative samples, and dynamically matching the positive and negative samples;

[0085] The cost matrix is ​​expressed as:

[0086] in, and They are classification loss and localization loss respectively.

[0087] Use BCEWithLog itsLoss function to train the confidence branch and classification branch to obtain the foreground background loss L obj With classification loss L cls ; Use SI OU function to train the regression branch and obtain the positioning loss L reg ;

[0088] Total loss value:

[0089] Among them, λ is the balance coefficient of positioning loss, the default value is 5.0, N pos is the number of anchor points classified as positive samples.

[0090] Specifically, the size of the surface defect image input in the sample training set is set to 640×640×3. First, the image size is changed to 320×320×64 after the Focus structure and BaseConv operation; then it passes through the first darknet module, the second darknet module, the third darknet module and the fourth darknet module in sequence, so that the image size is changed to 160×160×128, 80×80×256, 40×40×512, and 20×20×1024; the SPPBott l eNeck module is added to the fourth darknet module to complete the construction of the backbone network; three effective feature maps of different scales are respectively derived from the second darknet module, the third darknet module and the fourth darknet module, and the feature fusion is performed on the bottleneck network, and the three enhanced feature maps after the feature fusion are input into the three YOLO Head for classification prediction; the specific operation of the bottleneck network for feature fusion is: the three effective feature maps of different scales are respectively output as feat1, feat2, and feat3 after passing through the CBAM modules of corresponding sizes, and the feat3 derived from the fourth darknet module is subjected to Conv2D to obtain the enhanced feature map P1; P1 is upsampled and concat-connected with the fe2 derived from the third darknet module, and after the connection, the enhanced feature layer P2 is obtained through the CSPLayer and Concat structure; similarly, P2 is upsampled and concat-connected with the fe1 derived from the second darknet module, and after the connection, the enhanced feature layer P2 is obtained through the CSPLayer and Concat structure. er structure to obtain the enhanced feature layer P3; in addition, the enhanced feature layer needs to be fused again from top to bottom, the specific operation is: P3 is directly downsampled and concat-connected with P2, and after a CSPLayer structure, the enhanced feature layer P4 is obtained, P4 is further downsampled and concat-connected with P1, and after a CSPLayer structure, the enhanced feature layer P5 is obtained; finally, after feature fusion, 5 enhanced feature layers P1 to P5 are obtained; the enhanced feature layers P3, P4, and P5 are taken and input into three RFB modules and ASPP modules of three different sizes of 80×80×256, 40×40×512, and 20×20×1024, and then input into the YOLO Head network of three corresponding sizes for classification prediction to realize the detection of surface defects of steel plates.

[0091] The steel plate surface defect detection method based on YOLOX of the present invention fully considers the characteristics of steel plate surface defects, strengthens the extraction and fusion of features of small targets; Gr i is added in preprocessing The dMask enhancement method strikes a reasonable balance between deleting and retaining regional information in the image, ensuring that the final image context input to the model network is intact and the network is highly robust. The additional SELayer in the SPP module is designed to extract multi-scale spatial information, achieving more spatial feature fusion while improving sensitivity to channel features. The CBAM module (Channel and Spatial Attention Module) is added to the bottleneck network to perform convolution processing on both the spatial and channel dimensions to extract features, sequentially generating attention feature maps in both the channel and spatial dimensions. These two feature maps are then multiplied with the original input feature map for adaptive feature correction. The RFB module is added to the bottleneck network. Each input entering the RFB module forms three branches with different expansion rates, which are then superimposed to expand the network's receptive field. The ASPP module is also added to construct dilated convolution kernels with different receptive fields using different dilation rates to obtain multi-scale object information. The decoupling head uses the SIOU function for iterative optimization of the coordinate information of the predicted box, fully considering the vector angle between the required regressions and redefining the penalty metric to significantly improve the accuracy of the coordinate information. The MAP value of the defect detection model proposed in the present invention is improved by more than 3 percentage points compared with the existing model. The detection accuracy of small target defects such as cracks, scratches, inclusions, pitting and oxide scale on the surface of steel plates is greatly improved. The detection effect is significant, which helps to reduce the production cost of steel plates and improve product quality and production efficiency.

[0092] Reference Figure 6 As shown, the test results of the YOLOX model in the prior art on the test set are shown; Figure 7 As shown in FIG, the test results of the steel plate surface defect detection method based on YOLOX provided by the present invention are obtained on the test set; Figure 6 and Figure 7 It can be seen that the YOLOX-based steel plate surface defect detection method provided by the present invention improves the detection accuracy by more than 3 points compared with the existing detection method, and has a significant effect on the detection of small target defects, which helps to reduce the production cost of steel plates and improve product quality and production efficiency.

[0093] Based on the above embodiments, the present invention further provides a steel plate surface defect detection device based on YOLOX, comprising:

[0094] The data acquisition module 100 is used to acquire image data of surface defects of steel plates;

[0095] The pre-processing module 200 is used to rotate, crop, scale, translate and perform GridMask enhancement on the steel plate surface defect image to obtain a sample image;

[0096] The backbone network module 300 is used to process the input sample image through the Focus module and four darknet modules, and output three valid feature maps of different sizes;

[0097] The bottleneck network module 400 is used to process the effective feature map through the CBAM module, RFB module and ASPP module of corresponding size and output an enhanced feature map;

[0098] The decoupling module 500 is used to decompose the enhanced feature map and output three prediction targets, including coordinate information, foreground and background, and object type; stack the three prediction targets and output the prediction result;

[0099] Model optimization module 600, which is used to decode the prediction results, dynamically match positive and negative samples using SimOTA, calculate the total loss value of positive and negative samples, and optimize the model weights based on the total loss value;

[0100] Model acquisition module 700: Repeat the above steps, input sample images into the defect detection model for training, until the number of training times reaches epoch, and output the final defect detection model;

[0101] The test set prediction module 800 inputs the test set into the final defect detection model to obtain the steel plate surface defect detection results.

[0102] The YOLOX-based steel plate surface defect detection device of this embodiment is used to implement the aforementioned YOLOX-based steel plate surface defect detection method. Therefore, the specific implementation method of the YOLOX-based steel plate surface defect detection device can be seen in the embodiment part of the YOLOX-based steel plate surface defect detection method in the previous text. For example, the backbone network module 300 and the decoupling module 500 are respectively used to implement steps S1 and S4 in the above-mentioned YOLOX-based steel plate surface defect detection method, and the bottleneck network module 400 is used to implement steps S2 and S3 in the above-mentioned YOLOX-based steel plate surface defect detection method. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part, and will not be repeated here.

[0103] Based on the above embodiments, the present invention further provides a steel plate surface defect detection device based on YOLOX, comprising:

[0104] A collection device for collecting images of surface defects of steel plates;

[0105] A YOLOX-based steel plate surface defect detection device, communicatively connected to the acquisition device, configured to implement the steps of the YOLOX-based steel plate surface defect detection method when executing the computer program, and output steel plate surface defect detection results;

[0106] A display device is communicatively connected to the YOLOX-based steel plate surface defect detection device, and is used to obtain and display the steel plate surface defect detection results.

[0107] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0108] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0109] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0110] The above is a detailed introduction to the YOLOX-based steel plate surface defect detection method, device and equipment provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A steel plate surface defect detection method based on YOLOX, characterized in that: include: The sample data to be tested is input into the backbone network of the defect detection model built based on the YOLOX network. After passing through the Focus module and four darknet modules connected in series, three effective feature maps of different sizes are output after passing through the second darknet module, the third darknet module, and the fourth darknet module. The three effective feature maps of different sizes are input into three CBAM modules of corresponding sizes respectively. The channel attention feature map and spatial attention feature map generated by the CBAM module are multiplied by the input effective feature map, and then output after adaptive feature correction. The outputs of the three CBAM modules are respectively input into the three branches of the bottleneck network. Each branch includes an RFB module and an ASPP module connected in series, and outputs three enhanced feature maps. The RFB module decomposes the input enhanced feature map into three branches with different expansion rates. After each branch is processed by a convolution kernel of a different size, the three branches are spliced ​​and output through a 3×3 dilated convolution. The ASPP module convolves the output of the RFB module through multiple parallel dilated convolution layers with different sampling rates, and then fuses the output enhanced feature map. The three enhanced feature maps are input into the corresponding decoupling heads respectively; the decoupling head convolves the input enhanced feature map, decomposing it into a regression branch, a confidence branch, and a classification branch, and outputs three prediction targets, which include the coordinate information of the prediction box, the foreground and background, and the object type; the three prediction targets are stacked and the prediction result is output.

2. The steel plate surface defect detection method based on YOLOX according to claim 1, characterized in that: Before inputting the sample data to be detected into the backbone network of the defect detection model built based on the YOLOX network, the method further includes: Obtain steel plate surface defect image data and divide it into training set and test set; Initialize the epoch, learning rate, and model weight of the defect detection model built based on the YOLOX network; input the training set into the defect detection model and perform preprocessing to obtain a sample training set; The preprocessing includes rotating, cropping, scaling, translating and GridMask enhancement of the steel plate surface defect image data.

3. The steel plate surface defect detection method based on YOLOX according to claim 1, characterized in that: Darknet modules all include a BaseConv module and a CSPLayer module connected in series along the forward propagation direction; The BaseConv module includes a convolution unit, a batch normalization unit and an activation function unit connected in series along the forward propagation direction; The fourth darknet module also includes an SPP module, which is arranged after the CSPLayer module; The SPP module convolves the input feature image and inputs it into multiple pooling units with different pooling kernel sizes for pooling. The multiple feature images obtained after pooling and the convolved feature image are input into the SELayer layer for processing, and then the BaseConv module outputs the effective feature map.

4. The steel plate surface defect detection method based on YOLOX according to claim 1, characterized in that: After outputting the prediction result, the method further includes: Decode the prediction results, use SimOTA to dynamically match positive and negative samples, calculate the total loss value of positive and negative samples, and optimize the model weights based on the total loss value; Repeatedly input the sample data to be tested in the sample training set into the defect detection model for training until the number of training times reaches epoch, and output the final defect detection model; The sample data to be tested in the test set is input into the final defect detection model to obtain the surface defect detection results of the steel plate.

5. The steel plate surface defect detection method based on YOLOX according to claim 4, characterized in that: The SimOTA dynamic matching of positive and negative samples includes: Filter the positive sample candidate area as the real box; Calculate the IOU of the true box and each predicted box; Sum the IOU of the top 10 predicted boxes with the highest overlap with the true box, obtain the k value of the true box, round k down, and use the top k predicted boxes as positive samples, and the rest as negative samples; Use positive samples and negative samples to calculate the cost matrix and dynamically match positive and negative samples; The cost matrix is ​​expressed as: , in, and They are classification loss and localization loss respectively.

6. The steel plate surface defect detection method based on YOLOX according to claim 5, characterized in that: The calculation of the total loss value of positive and negative samples includes: Use the BCEWithLogitsLoss function to train the confidence branch and the classification branch to obtain the foreground background loss L obj With classification loss L cls ; Use SIOU function to train the regression branch and get the positioning loss L reg ; Total loss value: , Among them, λ is the balance coefficient of positioning loss, the default value is 5.0, N pos is the number of anchor points classified as positive samples.

7. A device for detecting steel plate surface defects based on YOLOX according to any one of claims 1 to 6, characterized in that: include: Data acquisition module, used to obtain steel plate surface defect image data; A preprocessing module is used to rotate, crop, scale, translate and GridMask enhance the steel plate surface defect images to obtain sample images; The backbone network module is used to process the input sample image through the Focus module and four darknet modules, and output three valid feature maps of different sizes; The bottleneck network module is used to process the effective feature map through the CBAM module, RFB module and ASPP module of corresponding size and output the enhanced feature map; The decoupling module is used to decompose the enhanced feature map and output three prediction targets, including coordinate information, foreground and background, and object type; Stack the three prediction targets and output the prediction results; The model optimization module is used to decode the prediction results, use SimOTA to dynamically match positive and negative samples, calculate the total loss value of positive and negative samples, and optimize the model weights based on the total loss value; Model acquisition module: repeatedly input sample images into the defect detection model for training until the number of training times reaches epoch, and outputs the final defect detection model; The test set prediction module inputs the test set into the final defect detection model to obtain the steel plate surface defect detection results.

8. A steel plate surface defect detection device based on YOLOX, characterized in that: include: A collection device for collecting images of surface defects of steel plates; The device of the steel plate surface defect detection method based on YOLOX according to claim 7 is communicatively connected to the acquisition device, and is used to implement the steps of the steel plate surface defect detection method based on YOLOX when executing the computer program, and output the steel plate surface defect detection results; A display device is communicatively connected to the device of the YOLOX-based steel plate surface defect detection method, and is used to obtain and display the steel plate surface defect detection results.

Citation Information

Patent Citations

  • Fruit identification method based on deep learning

    CN114565864A

  • Medical image segmentation method based on global and local feature reconstruction network

    CN114612479A