A Method for Detecting Surface Defects in Hot-Rolled Strip Based on Improved YOLOv4

By improving the YOLOv4 network, combining the lightweight Transformer and ASFF adaptive feature fusion module, and optimizing post-processing operations, the problem of insufficient global feature capture in the surface defect detection of hot-rolled strip steel by convolutional neural networks is solved, and high-precision and efficient defect detection is achieved.

CN116012337BActive Publication Date: 2026-03-06JIANGSU UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-09
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing convolutional neural networks struggle to effectively capture global feature information in the detection of surface defects in hot-rolled strip steel, resulting in slow detection speed and insufficient accuracy.

Method used

An improved YOLOv4 network is adopted, combined with a lightweight Transformer network architecture as the feature extraction network. The ASFF adaptive feature fusion module is used to fuse features at different scales, and the post-processing operation is optimized by an improved DIoU NMS algorithm to improve detection accuracy.

Benefits of technology

While ensuring the detection speed, the detection accuracy and positioning accuracy of surface defects in hot-rolled strip steel have been significantly improved, and the missed detection rate has been reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116012337B_ABST
    Figure CN116012337B_ABST
Patent Text Reader

Abstract

This invention discloses a surface defect detection method for hot-rolled strip steel based on an improved YOLOv4. The method involves obtaining a publicly available hot-rolled strip steel dataset; modifying the anchor box parameters of the YOLOv4 network using the k-means++ algorithm, selecting the clustering result with the highest accuracy as the anchor box parameter values; constructing an improved YOLOv4 network including a backbone feature extraction network, a Neck part, and a prediction output module; adjusting the feature map size to fit the entire network model; and performing optimized post-processing operations on the algorithm; training the training and validation sets using the improved YOLOv4 network; and testing the test set using the trained improved network. Within the YOLOv4 framework, this invention uses a lightweight Transformer network architecture as the model's feature extraction network, extracting global and local representation information of the input object with fewer parameters; adding an ASFF adaptive feature fusion module to adaptively fuse features at different scales, enriching the representation information of large and small targets; and finally, employing an improved DIoUNMS algorithm to further reduce the false negative rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of hot-rolled strip steel surface defect detection technology, specifically relating to a hot-rolled strip steel surface defect detection method based on an improved YOLOv4. Background Technology

[0002] Against the backdrop of advocating high-quality development, hot-rolled strip steel, as a "green steel," boasts advantages such as high economic efficiency, recyclability, and high strength, leading to its widespread application in construction, automotive, and shipbuilding industries. However, in actual production, different processing techniques can cause surface defects in the strip steel. These defects not only affect the product's aesthetics but also reduce its wear resistance and fatigue strength. Failure to detect and address these defects in a timely manner will further deteriorate product quality. Therefore, it is necessary to pre-screen strip steel with surface defects to improve product pass rates and reduce economic losses. Compared to the subjectivity of manual inspection and the susceptibility to interference in machine vision inspection, deep learning-based defect detection offers advantages such as high precision, high efficiency, and generalization capabilities, making it more adaptable to complex inspection environments and widely used in the field of product defect detection.

[0003] In recent years, the application of deep learning in metal surface defect detection has been widely studied. Existing technologies include using an improved YOLOv3 algorithm to detect surface defects in steel profiles. This is achieved by replacing some convolutional layers of residual units in the Darknet53 network with deformable convolutions, adding a shallower prediction scale to the original three prediction scales to enhance feature learning capabilities and improve the representation of dense, small defects. Another approach utilizes an improved YOLOv3 algorithm to detect surface defects in hot-rolled steel bars. This involves fusing shallow and deep features from the network to generate a new prediction scale, incorporating DIoU bounding box regression loss, and employing K-Means++ clustering to extract more small defect features and accelerate model convergence. Furthermore, a fast detection algorithm based on an improved YOLOv4 model has been proposed for detecting defects in stamped parts. This algorithm replaces the backbone network CSPDarknet53 in the YOLOv4 structure with an improved MobileNetV3 network, combines it with SE Blocks (lightweight attention structures), and then performs data augmentation and K-Means clustering to improve detection accuracy. The algorithms described above all use convolutional neural networks (CNNs). However, CNNs typically extract local features and cannot effectively capture the dependencies between global features. Furthermore, as the network depth increases, the number of parameters and computational cost also increase, slowing down the detection speed. With the rapid development of Transformers, their superior global feature capture capabilities compared to CNNs have led to significant achievements in CNN applications. Considering the different advantages of CNNs and Transformers, this paper proposes a defect detection method based on an improvement of YOLOv4. Summary of the Invention

[0004] Purpose of the invention: The purpose of this invention is to propose a surface defect detection method for hot-rolled strip steel based on an improved YOLOv4. This method can fully extract the global and local features of defects while ensuring a certain detection speed, thereby improving the detection and positioning accuracy of surface defects in strip steel.

[0005] Technical solution: The present invention provides a method for detecting surface defects in hot-rolled strip steel based on an improved YOLOv4, comprising the following steps:

[0006] (1) Obtain the publicly available hot-rolled strip steel dataset, divide the dataset into training set, validation set and test set, and adjust the image size;

[0007] (2) The anchor box parameter values ​​of the YOLOv4 network are modified using the k-means++ algorithm, and the clustering result with the highest accuracy is selected as the anchor box parameter value of the YOLOv4 network.

[0008] (3) Construct an improved YOLOv4 network, adjust the feature map size to fit the entire network model, and perform optimized post-processing operations on the algorithm; the improved YOLOv4 network includes a backbone feature extraction network, a Neck part, and a prediction output module;

[0009] (4) The improved YOLOv4 network is used to train the training set and the validation set, and the trained improved network is used to test the test set.

[0010] (5) Input the image to be tested into the trained improved YOLOv4 network to detect surface defects of hot-rolled strip steel and obtain the confidence, category and location of the defects in the image.

[0011] Further, step (1) involves adjusting the image size by uniformly scaling the publicly available hot-rolled strip steel dataset images from the original size of 200×200 to 512×512.

[0012] Further, the Neck part in step (3) includes an SPP pyramid module, a PANet multi-scale fusion module, and an ASFF feature adaptive fusion module; the backbone feature extraction network adopts the MobileVit network architecture, extracting three feature maps from the network: 64×64×96, 32×32×128, and 16×16×160, which are used as inputs to the Neck part; then, the 16×16×160 feature map is adjusted to a size suitable for YOLOv4 through three CBL operations to obtain a 16×16×512 feature map; then, it is passed through the SPP pyramid module to increase the receptive field of the feature, and the number of channels is adjusted using feature concatenation and ordinary convolution to obtain a 16×16×512 feature map; then, the obtained 16×16×512 feature map is combined with the previously extracted feature maps from the backbone network. The first two feature maps extracted by the feature extraction network, 64×64×96 and 32×32×128, are input into the PANet multi-scale fusion module for multi-scale feature extraction and concatenation, resulting in three feature maps with more representational information: 64×64×128, 32×32×256, and 16×16×512. Next, the three obtained feature maps are enriched across different scales using the ASFF feature adaptive fusion module, outputting three feature maps: 64×64×128, 32×32×256, and 16×16×512. Then, these three feature maps are passed through three feature layers of different sizes in the prediction output module for multi-scale detection, yielding three preliminary prediction result feature maps: 64×64×C, 32×32×C, and 16×16×C. Finally, the post-processing operation is optimized, i.e., an improved DIoU is implemented. NMS is used to filter the preliminary prediction results to obtain the final output results. The output results are then converted using a conversion formula to obtain the center point coordinates, width, and height of the actual prediction box.

[0013] Furthermore, the backbone feature extraction network is composed of multiple MobileVit blocks and MobileNetV2 blocks; the MobileVit block consists of a Local representations part, a Global representations part, and a Fusion fusion part; the Local representations part is used to extract local spatial information, using n×n and 1×1 convolutions to extract local features from the input features and project them into a high-dimensional space; the Global representations part is used to learn global features, unfolding the features into N non-overlapping flattened patches, where the Transformer part is used to encode the relationships between multiple patches; the Fusion fusion part uses n×n convolutions to fuse the local and global features obtained from the first two parts; the MobileNetV2... The block first uses 1×1 convolution to increase the dimensionality and extract richer features; then it uses 3×3 depthwise separable convolution to extract features with a larger receptive field with less computation; then it uses 1×1 convolution to reduce the dimensionality of the input feature map and reduce the number of parameters; finally, it uses residual connections to capture more feature information while increasing the amount of computation and parameters.

[0014] Furthermore, the ASFF feature adaptive fusion module automatically fuses the multi-scale feature information of the three input feature maps using the learned weight parameters to enhance feature extraction, which is achieved through the following formula:

[0015] ASFF-3 = X 1→3 *α 3 +X 2→3 *β 3 +X 3→3 *γ 3

[0016] Among them, X 1→3 The level 1 feature layer is transformed to the same size as the level 3 feature layer by adjusting the number of channels and scaling the size; similarly, X 2→3 To transform level 2 features into feature layers of the same size as level 3 features; X 3→3 This is the level 3 feature layer; α, β, and γ are their respective weight coefficients, obtained through backpropagation during training.

[0017] Furthermore, the post-processing operation is optimized, namely the improved DIoU NMS, by adding a weight coefficient λ to the original DIoU calculation formula to further filter out duplicate detection prediction boxes. The specific operation steps are as follows:

[0018] S1: Sort all candidate prediction boxes in descending order of confidence value;

[0019] S2: Select the prediction box A with the highest confidence value, add it to the output list, and remove it from the candidate list;

[0020] S3: Calculate the DIoU value of box A with other candidate prediction boxes, and remove candidate prediction boxes with values ​​greater than the NMS threshold as overlapping predictions from the candidate list;

[0021] The improved formula for calculating the DIoU value is as follows:

[0022]

[0023] Where λ is the weighting coefficient (0 < λ < 1), when λ < 1, the original The value is reduced, the DIoU value increases, and the predicted bounding boxes that are detected repeatedly are further filtered out under the original confidence threshold.

[0024] S4: Repeat steps S1-S3 until the candidate list is empty, then return the output list, which is the actual predicted bounding box.

[0025] Beneficial Effects: Compared with existing technologies, the beneficial effects of this invention are as follows: Under the YOLOv4 framework, a new network is reconstructed using Transformer technology. A lightweight Transformer network architecture is used as the feature extraction network for the model, extracting global and local representation information of the input object with fewer parameters. Secondly, the ASFF adaptive feature fusion module adaptively fuses features of different scales, enriching the representation information of large and small targets. Finally, the NMS algorithm is replaced with an improved DIoU NMS algorithm, further reducing the false negative rate. Through comparison with other algorithms, and considering both FPS and mAP evaluation metrics, the algorithm of this invention exhibits the best overall detection performance, effectively improving the accuracy of hot-rolled strip surface defect detection while ensuring a certain detection speed. Attached Figure Description

[0026] Figure 1 This is a schematic diagram of the improved YOLOv4 network structure proposed in this invention;

[0027] Figure 2 This is a schematic diagram of the MobileVit block structure;

[0028] Figure 3This is a schematic diagram of the MobileNetV2 block structure;

[0029] Figure 4 This is a schematic diagram of the ASFF adaptive feature fusion module. Detailed Implementation

[0030] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings.

[0031] This invention provides a method for detecting surface defects in hot-rolled strip steel based on an improved YOLOv4, specifically including the following steps:

[0032] Step 1: Obtain the publicly available hot-rolled strip steel dataset, divide the dataset into training set, validation set and test set, and adjust the image size.

[0033] The publicly available hot-rolled strip steel dataset has been uniformly scaled from its original size of 200×200 to 512×512. Images from each defect class in the dataset have been randomly selected and divided into training, validation, and test sets in a 7:2:1 ratio. The dataset includes six common surface defects in hot-rolled strip steel: cracks (crazing, Cr), rolled-in scale (RS), inclusions (In), pitted surface (PS), patches (Pa), and scratches (Sc). Each defect class contains 300 images, for a total of 1800 images in the dataset.

[0034] Step 2: Use the k-means++ algorithm to modify the anchor box parameter values ​​of the YOLOv4 network model, and select the clustering result with the highest accuracy as the anchor box parameter values ​​of the YOLOv4 network.

[0035] The specific implementation process of the k-means++ algorithm is as follows:

[0036] S1. Input the hot-rolled strip surface defect dataset and set the k value to 9;

[0037] S2. Randomly select a sample point from the dataset as the first initial cluster center;

[0038] S3. Calculate the distance D(x) between each sample and the existing cluster centers;

[0039] S4. Calculate the probability P(x) of each sample point being selected as the next cluster center, and select the sample point corresponding to the maximum probability value as the next cluster center;

[0040] S5. Repeat steps S3 and S4 until 9 initial cluster centers are obtained;

[0041] S6. Calculate the distance from each sample point to the 9 initial cluster centers, and classify it into the corresponding cluster center according to the closest distance. After all samples have been classified, multiple clusters are obtained.

[0042] S7. The new cluster centers are updated to be the mean of all sample points in each cluster;

[0043] S8. Repeat steps S6 and S7 until the cluster centers no longer change, then output the final 9 cluster centers.

[0044] Step 3: Construct an improved YOLOv4 network, adjust the feature map size to fit the entire network model, and perform optimized post-processing operations on the network.

[0045] The improved YOLOv4 network structure diagram is as follows: Figure 1 As shown, the improved YOLOv4 network includes a backbone feature extraction network, a Neck section, and a prediction output module (YOLO Head). The Neck section includes an SPP pyramid module, a PANet multi-scale fusion module, and an ASFF feature adaptive fusion module; the backbone feature extraction network adopts the MobileVit network architecture, and the MobileVit network structure diagram is shown below. Figure 2As shown, three feature maps are extracted from the network: 64×64×96, 32×32×128, and 16×16×160, which are used as inputs to the Neck part. Next, the 16×16×160 feature map is processed through three CBL (Conv convolution + BN batch normalization + LeakyReLU linear unit function with leakage correction) operations to adjust the number of channels to a size suitable for YOLOv4, resulting in a 16×16×512 feature map. Then, this map is passed through the SPP pyramid module to increase the receptive field of the features, and feature concatenation and ordinary convolution are used to adjust the number of channels, resulting in another 16×16×512 feature map. Finally, the obtained 16×16×512 feature map is combined with the first two feature maps extracted from the backbone feature extraction network: 64×64×96, 32×32×128, and 16×16×160. The 32×32×128 feature map is input into the PANet multi-scale fusion module for multi-scale feature extraction and splicing, resulting in three feature maps with more representational information: 64×64×128, 32×32×256, and 16×16×512. Next, the three feature maps are enriched across different scales using the ASFF feature adaptive fusion module, outputting three feature maps: 64×64×128, 32×32×256, and 16×16×512. Then, these three feature maps are subjected to multi-scale detection through three feature layers of different sizes in the prediction output module, yielding three preliminary prediction result feature maps: 64×64×C, 32×32×C, and 16×16×C. Finally, the post-processing operation is optimized using an improved DIoU NMS to filter the preliminary prediction results and obtain the final output results. The output results are then converted using a conversion formula to obtain the center point coordinates, width, and height of the actual prediction box.

[0046] like Figure 2 , Figure 3 As shown, the backbone feature extraction network MobileVit mainly consists of multiple MobileVit blocks and MobileNetV2 blocks. Each MobileVit block comprises Local representations, Global representations, and a Fusion component. Figure 2As shown, the Local representations part is used to extract local spatial information. It uses n×n and 1×1 convolutions to extract local features from the input features and project them into a high-dimensional space. The Global representations part is used to learn global features. It unfolds the features into N non-overlapping flattened patches. The Transformer part is used to encode the relationship between multiple patches. The Fusion part uses n×n convolutions to fuse the local and global features obtained from the first two parts. It includes the Resblock_body residual structure and the CSPX cross-stage structure.

[0047] The MobileNetV2 block is also known as the inverted residual, such as Figure 3 As shown, we first use 1×1 convolution to increase the dimensionality and extract richer features; then we use 3×3 depthwise separable convolution to extract features with a larger receptive field with less computation; then we use 1×1 convolution to reduce the dimensionality of the input feature map and reduce the number of parameters; finally, we use residual connections to capture more feature information while increasing the amount of computation and parameters.

[0048] The SPP pyramid module uses four different pooling sizes for max pooling to increase the receptive field of the third feature map extracted from the backbone feature extraction network and subjected to three CBL operations to varying degrees. After generating four feature maps, feature concatenation and channel adjustment are performed, and the output feature map with a size of 16×16×512 is used as the third input of the PANet module.

[0049] The PANet multi-scale fusion module performs multiple convolutional upsampling and downsampling operations to extract and concatenate the 16×16×512 feature map obtained from the SPP pyramid module and the 64×64×96 and 32×32×128 feature maps obtained from the backbone feature extraction network from bottom to top and top to bottom. This multi-scale fusion of semantic and spatial information outputs three feature maps of sizes 64×64×128, 32×32×256, and 16×16×512, which are then input into the ASFF feature adaptive fusion module.

[0050] The ASFF feature adaptive fusion module can automatically fuse multi-scale feature information from three input feature maps (64×64×128, 32×32×256, and 16×16×512) using learned weight parameters, thereby enhancing feature extraction. Taking a three-feature-layer ASFF structure as an example... Figure 4For example, each ASFF input consists of level 1, level 2, and level 3. When the level 3 feature map contains both large and small objects, the presence of small objects can interfere with feature extraction. In this case, the information of small objects should be filtered out, and the high-level semantic feature information contained in the level 1 and level 2 feature maps should be combined to enrich the feature information of large objects in the level 3 feature map. Taking ASFF-3 as an example, the calculation of the ASFF feature adaptive fusion module is as follows: the features of the three layers are transformed, multiplied by the corresponding weight coefficients, and added together to obtain the new fused feature map ASFF-3. The calculation formula is shown below:

[0051] ASFF-3 = X 1→3 *α 3 +X 2→3 *β 3 +X 3→3 *γ 3

[0052] Among them, X 1→3 The level 1 feature layer is transformed to the same size as the level 3 feature layer by adjusting the number of channels and scaling the size; similarly, X 2→3 To transform level 2 features into feature layers of the same size as level 3 features; X 3→3 This is the level 3 feature layer; α, β, and γ are their respective weight coefficients, obtained through backpropagation during training.

[0053] The prediction output module performs multi-scale detection using three feature layers of different sizes, outputting three predicted feature maps: 64×64×C, 32×32×C, and 16×16×C, respectively, capable of detecting targets at small, medium, and large scales. Each feature layer consists of one CBL module and a regular convolution. Here, the CBL module is used for channel number transition and adjustment, while the regular convolution is used to output the prediction result.

[0054] The post-processing operation is optimized, namely the improved DIoU NMS. A weighting coefficient is added to the original DIoU calculation formula to further filter out duplicate detection bounding boxes. The specific steps are as follows:

[0055] S1. Sort all candidate prediction boxes in descending order of confidence value.

[0056] S2. Select the prediction box A with the highest confidence value, add it to the output list, and remove it from the candidate list.

[0057] S3. Calculate the DIoU value of box A with other candidate prediction boxes, and remove candidate prediction boxes with values ​​greater than the NMS threshold as overlapping predictions from the candidate list.

[0058] The improved formula for calculating the DIoU value is as follows:

[0059]

[0060] Where λ is the weighting coefficient (0 < λ < 1), when λ < 1, the original The value is reduced, the DIoU value increases, and repeated detection prediction boxes are further filtered out at the original confidence threshold.

[0061] S4. Repeat S1-S3 until the candidate list is empty, then return the output list, which is the actual predicted bounding box.

[0062] Step 4: Train the training and validation sets using the improved YOLOv4 network, and test the test set using the trained improved network; input the image to be tested into the trained improved YOLOv4 network to detect surface defects of hot-rolled strip steel, and obtain the confidence level, category and location of the defects in the image.

[0063] In this embodiment, an improved YOLOv4 network is implemented using the Python programming language and the PyTorch deep learning framework. The improved YOLOv4 network is trained using images from the training set, and images from the validation set are used to verify the network's training performance. Simultaneously, for comparison, the original YOLOv4 network is trained using the same training method.

[0064] Meanwhile, this example uses a test set to comprehensively compare the improved YOLOv4 network with YOLOv4, YOLOv3, YOLOv5, and Faster R-CNN algorithms based on two evaluation metrics: mAP and FPS. As shown in Table 1, the algorithm presented in this paper has the best overall detection performance and achieves more accurate real-time detection.

[0065] Table 1 Comparison of different algorithms

[0066] algorithm mAP / (%) FPS / (frames) Faster R-CNN 71.32 18.3 YOLO v3 67.43 50.1 YOLOv4 68.59 45.6 YOLO v5 70.51 103.4 Algorithm of this invention 80.16 45.7

[0067] This example is implemented on Ubuntu 20.04 using the PyTorh deep learning framework. The GPU used is an NVIDIA GeForce GTX 3060 with 12GB of RAM, CUDA 11.1, and CUDNN 11.1. Training is performed for 150 epochs, with a batch size of 4 for both freeze and unfreeze sessions. The Adam optimizer is used for parameter processing, with a learning rate of le-3 for freeze and le-4 for unfreeze. Online data augmentation is applied to the training set during unfreeze training.

[0068] This embodiment uses a test set of 180 images to test the algorithm. Compared with the original YOLOv4 algorithm, the algorithm in this embodiment achieves an average accuracy of 80.16%, an improvement of 11.57%, and an FPS of 45.7 frames / s. The comparison between the results of this invention's algorithm and the original YOLOv4 algorithm shows that the original YOLOv4 algorithm is more prone to missed detections, and some defects are either undetectable or have low confidence levels; while the algorithm of this invention can detect as many defects as possible.

[0069] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A hot-rolled strip steel surface defect detection method based on improved YOLOv4, characterized by, The method comprises the following steps: (1) obtaining a public hot-rolled strip data set, dividing the data set into a training set, a validation set and a test set, and adjusting the picture size; (2) using a k-means++ algorithm to modify the anchor box parameter value of a YOLOv4 network, and selecting the cluster result with the highest precision as the anchor box parameter value of the YOLOv4 network; (3) constructing an improved YOLOv4 network, adjusting the feature map size to adapt to the entire network model; the improved YOLOv4 network comprises a backbone feature extraction network, a Neck part and a prediction output module; (4) training the training set and the validation set by using the improved YOLOv4 network, and testing the test set by using the trained improved network; (5) inputting a picture to be tested into the trained improved YOLOv4 network to detect the surface defects of the hot-rolled strip, and obtaining the confidence, the category and the position of the defects in the picture; The Neck part in step (3) comprises an SPP pyramid module, a PANet multi-scale fusion module and an ASFF feature adaptive fusion module; the backbone feature extraction network adopts a MobileVit network architecture, three feature maps, 64×64×96, 32×32×128 and 16×16×160, are extracted from the network and used as the input of the Neck part; then, the 16×16×160 feature map is adjusted to the size suitable for the YOLOv4 through 3 CBL operations, and a 16×16×512 feature map is obtained; then, the SPP pyramid module is used to increase the receptive field of the feature, the channel number is adjusted by using feature splicing and ordinary convolution, and a 16×16×512 feature map is obtained; then, the obtained 16×16×512 feature map and the first two feature maps, 64×64×96 and 32×32×128, extracted from the backbone feature extraction network are input into the PANet multi-scale fusion module for multi-scale feature extraction and splicing, and three feature maps, 64×64×128, 32×32×256 and 16×16×512, with more representative information are obtained; then, the three feature maps are input into the ASFF feature adaptive fusion module to cross-scalely enrich the representative information of different sizes, and three feature maps, 64×64×128, 32×32×256 and 16×16×512, are output; then, the three feature maps are input into the three feature layers with different sizes of the prediction output module for multi-scale detection, and three preliminary prediction result feature maps, 64×64×C, 32×32×C and 16×16×C, are obtained; then, the improved DIoU NMS is used to screen the preliminary prediction results to obtain the final output result, and the center point coordinates, the width and the height of the actual prediction box can be obtained through conversion formula calculation of the output result; The backbone feature extraction network is composed of a plurality of MobileVit blocks and MobileNetV2 blocks; the MobileVit block is composed of a Local representations local representation part, a Global representations global representation part and a Fusion fusion part; the Local representations local representation part is used to extract local spatial information, and n×n and 1×1 convolution is used to extract local features of the input features and project them into a high-dimensional space; the Global representations global representation part is used to learn global features, and the features are expanded into N non-overlapping flattened patches, wherein the Transformer part is used to encode the relationship between a plurality of patches; the Fusion fusion part uses n×n convolution to fuse the local and global features obtained by the previous two parts; the MobileNetV2 block first increases the dimension through 1×1 convolution, further extracts more rich features; then a 3×3 depth separable convolution is used to extract features with a larger receptive field with less computation; then 1×1 convolution is used to reduce the dimension of the input feature map, reducing the parameter amount; finally, residual connection is used to capture more feature information while increasing the computation and parameter amount as little as possible; The ASFF feature adaptive fusion module automatically fuses the multi-scale feature information of the three input feature maps through the learned weight parameters, strengthens the feature extraction, and is realized through the following formula: ASFF-3 = X 1→3 * alpha 3 + X 2→3 * beta 3 + X 3→3 * gamma 3 wherein X 1→3 is the level 1 feature layer transformed to the same size as the level 3 feature layer by adjusting the number of channels, scaling the size, and so on; similarly, X 2→3 is the level 2 transformed to the same size as the level 3 feature layer; and X 3→3 is the level 3 feature layer; and a, b, and g are respective weight coefficients obtained by back propagation in training. The improved DIoU NMS adds a weight coefficient λ to the original DIoU calculation formula to further filter out the duplicate detection prediction boxes, and the operation steps are as follows: S1: arrange all candidate prediction boxes in descending order according to the confidence value; S2: select the prediction box A with the highest confidence value and add it to the output list, and delete it from the candidate list; S3: calculate the DIoU value of box A and other candidate prediction boxes, and consider the candidate prediction boxes greater than the NMS threshold as overlapping predictions, and delete them from the candidate list; The calculation formula of the improved DIoU value is: Wherein, λ is a weight coefficient, 0 < λ < 1, when λ < 1, the original The value is reduced, the DIoU value increases, and the prediction box of repeated detection is further filtered out under the original confidence threshold. S4: repeat steps S1-S3 until the candidate list is empty, and return the output list, which is the real prediction box.

2. The hot-rolled strip steel surface defect detection method based on improved YOLOv4 according to claim 1, characterized in that, Step (1) adjusts the picture size to uniformly scale the public hot-rolled strip data set picture from the original size 200×200 to 512×512.