A strip steel surface defect detection method and system based on improved YOLOv7
Patent Information
- Application Number
- CN202410708179.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-06-03
AI Technical Summary
anchor-based算法引入了非极大抑制(NMS),NMS虽然提高了检测精度,但计算量与复杂度严重阻碍了检测速度的提升
Smart Images

Figure CN118537328B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of defect detection, and in particular to a strip surface defect detection method and system based on improved YOLOv7. Background Art
[0002] Strip steel is an important product of the modern steel industry. The large production volume and fast transmission speed of strip steel put forward higher requirements for the accuracy and speed of strip steel surface defect detection. The complex environment and various interference factors of the production site also require the detection method to have good robustness and generalization. Traditional eddy current detection, magnetic flux leakage detection, infrared detection and other methods are difficult to meet the requirements of fast and accurate detection. In recent years, the rapid development of deep learning has become a research hotspot for strip steel surface defect image detection. The target detection algorithm based on deep learning has replaced the traditional target detection algorithm and become the mainstream of the target detection algorithm.
[0003] The existing deep learning target detection algorithms are mainly divided into two categories. One is the two-stage detection algorithm represented by Faster R-CNN and Mask R-CNN; the other is the one-stage detection algorithm represented by YOLO and SSD. The YOLO series of models are relatively balanced between detection accuracy and detection speed, and new benchmark models are constantly introduced. After several generations of development, they have absorbed a lot of advanced experience from other models, and the detection accuracy has been continuously improved while maintaining a good detection speed. At present, the YOLOv7 algorithm has greatly improved the detection speed and detection accuracy compared with previous versions, and is currently one of the best detection algorithms. However, a series of target detection algorithms including YOLOv7 use the anchor-based method. This method has an initial anchor box for different data sets, and during the network training process, the network outputs a predicted box based on the initial anchor box, and then compares it with the grounding truth box, and then reversely updates and iterates the network parameters. However, this method has disadvantages. The setting of anchors needs to be designed manually (aspect ratio, size and number of anchors), and different designs are required for different data sets, which is quite troublesome; the matching mechanism of anchors makes the frequency of matching extreme scales lower than that of matching objects of moderate size. It is not easy for the training network to learn these extreme samples during learning. There are many anchors, and each one needs to perform IOU calculation, which reduces efficiency. The anchor-based algorithm introduces non-maximum suppression (NMS). Although NMS improves the detection accuracy, the computational complexity and complexity seriously hinder the improvement of detection speed. Summary of the invention
[0004] One of the purposes of the present invention is to provide a strip surface defect detection method and system based on improved YOLOv7, which adopts EIoU l oss as the regression loss function, which has a constant scale and can directly optimize the evaluation index of bounding box regression to accelerate the model fitting speed. The ConvNext network improves the detection accuracy of the YOLOv7 model for small targets.
[0005] An embodiment of the present invention provides a strip steel surface defect detection method based on improved YOLOv7, comprising:
[0006] The strip surface images collected on site are input into the improved YOLOv7 model to obtain the detection results;
[0007] Among them, the backbone network of the improved YOLOv7 model is the ConvNext network; the improved YOLOv7 model uses EIOU loss as the regression loss function to guide training during training.
[0008] Preferably, the formula of the EIOU loss function is as follows:
[0009]
[0010] Where, L EIoU represents EIOU loss; L IoU represents IOU loss; L dis Indicates distance loss; L asp represents the edge length loss; ρ 2 (b,b gt ) represents the Euclidean distance between the real box and the predicted box length; ρ 2 (ω,ω gt ) represents the Euclidean distance between the width of the real box and the predicted box; ρ 2 (h,h gt ) represents the Euclidean distance between the height of the real box and the predicted box; C represents the shortest length that contains both the real box and the predicted box; C ω Indicates the shortest width of both the real box and the predicted box; C h Indicates the shortest height that includes both the true box and the predicted box.
[0011] Preferably, the final loss function of the improved YOLOv7 model during training is as follows:
[0012] L AF =L EIoU (box)+L FL (objectness)+L CE (class)
[0013] Where, L AF represents the final loss function; L EIoU(box) is the target box selection loss,
[0014] L FL (objectness) is the objective loss, L CE (class) is the target classification loss.
[0015] Preferably, the improved YOLOv7 model uses GELU as the activation function.
[0016] Preferably, the strip surface image collected on site follows the following rules:
[0017] Obtaining operation monitoring data of strip steel production equipment;
[0018] The abnormal analysis library is used to analyze the operation monitoring data. Based on the analysis results, the image acquisition equipment is controlled to acquire images at the positions on the strip corresponding to the acquisition and analysis results.
[0019] The present invention also provides a strip steel surface defect detection system based on improved YOLOv7, comprising:
[0020] The monitoring unit is used to input the strip surface image collected on site into the improved YOLOv7 model to obtain the detection result;
[0021] Among them, the backbone network of the improved YOLOv7 model is the ConvNext network; the improved YOLOv7 model uses EIOU loss as the regression loss function to guide training during training.
[0022] Preferably, the formula of the EIOU loss function is as follows:
[0023]
[0024] Where, L EIoU represents EIOU loss; L IoU represents IOU loss; L dis Indicates distance loss; L asp represents the edge length loss; ρ 2 (b,b gt ) represents the Euclidean distance between the real box and the predicted box length; ρ 2 (ω,ω gt ) represents the Euclidean distance between the width of the real box and the predicted box; ρ 2 (h,h gt ) represents the Euclidean distance between the height of the real box and the predicted box; C represents the shortest length that contains both the real box and the predicted box; C ω Indicates the shortest width of both the real box and the predicted box; C h Indicates the shortest height that includes both the true box and the predicted box.
[0025] Preferably, the final loss function of the improved YOLOv7 model during training is as follows:
[0026] L AF =L EIoU (box)+L FL (objectness)+L CE (class)
[0027] Where, L AF represents the final loss function; L EIoU (box) is the target box selection loss,
[0028] L FL (objectness) is the objective loss, L CE (class) is the target classification loss.
[0029] Preferably, the improved YOLOv7 model uses GELU as the activation function.
[0030] Preferably, the strip steel surface defect detection system based on the improved YOLOv7 further includes: a collection unit for collecting strip steel surface images on site;
[0031] The acquisition unit collects the strip surface image on site and performs the following operations:
[0032] Obtaining operation monitoring data of strip steel production equipment;
[0033] The abnormal analysis library is used to analyze the operation monitoring data. Based on the analysis results, the image acquisition equipment is controlled to acquire images at the positions on the strip corresponding to the acquisition and analysis results.
[0034] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0035] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0037] Figure 1 Schematic diagram of the reversed residual ConvNeXt Block structure in an embodiment of the present invention;
[0038] Figure 2 is a schematic diagram of the structure of ConvNeXt Block in an embodiment of the present invention;
[0039] Figure 3 Schematic diagram of the processing of ConvNeXt Block in an embodiment of the present invention;
[0040] Figure 4 A schematic diagram of a traditional YOLOv7 network structure in an embodiment of the present invention;
[0041] Figure 5 Schematic diagram of the improved YOLOv7 network structure in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0043] The embodiment of the present invention provides a strip surface defect detection method based on improved YOLOv7, such as Figure 1 As shown, including:
[0044] The strip surface images collected on site are input into the improved YOLOv7 model to obtain the detection results;
[0045] Among them, the backbone network of the improved YOLOv7 model is the ConvNext network; the improved YOLOv7 model uses EIOU loss as the regression loss function to guide training during training.
[0046] Traditional YOLOv7 uses CIoU as the bounding box regression loss during training. This application chooses to use EIoU as the bounding box regression loss, which is more suitable. The parameter v in the CIoU function reflects the difference between the aspect ratios, rather than the confidence difference between the width and height, which will have a certain impact on the model fitting. Therefore, the EIoU function is used as the loss function. The EIoU function splits the parameter v that measures the similarity of the aspect ratio into two parts, calculates the losses of the width and height respectively, and converges faster. The EIoU loss function is:
[0047]
[0048] Where, L EIoU represents EIOU loss; L IoU represents IOU loss; L dis Indicates distance loss; L asp represents the edge length loss; ρ 2 (b,b gt) represents the Euclidean distance between the real box and the predicted box length; ρ 2 (ω,ω gt ) represents the Euclidean distance between the width of the real box and the predicted box; ρ 2 (h,h gt ) represents the Euclidean distance between the height of the real box and the predicted box; C represents the shortest length that contains both the real box and the predicted box; C ω Indicates the shortest width of both the real box and the predicted box; C h Indicates the shortest height that includes both the true box and the predicted box.
[0049] The process of CIoU algorithm:
[0050] If the predicted box is B P =(x1,y1,x2,y2), and GT box (ground truth) is B g =(x1',y1',x2',y2')
[0051] Input the bounding box coordinates B of the predicted box B P and GT box B g :
[0052] B P =(x1,y1,x2,y2)
[0053] B G =(x1',y1',x2',y2')
[0054] Output: L GioU
[0055] Step 1: Calculate the area P of B: A P =(x2-x1)x(y2-y1)
[0056] Step 2: Calculate the area g of B: Ag = (x2'-x1')x(y2'-y1')
[0057] Step 3: Calculate the area P of the intersection box between B and B g , IB:
[0058] x1 IB =max(x1,x1')x2 IB =min(x2,x2')
[0059] y1 IB =max(y1,y1')y2 IB =min(y2,y2')
[0060] if(x2 IB >x1 IB and y2IB >y1 IB ):
[0061] IB=(x2 IB -x1 IB )×(y2 IB -y1 IB )
[0062] Else:
[0063] IB=0
[0064] End
[0065] Step 4: Calculate the area P and B of the smallest enclosing box containing B g , EB:
[0066] x1 EB =min(x1,x1')x2 EB =max(x2,x2')
[0067] y1 EB =min(y1,y1')y2 EB =max(y2,y2')
[0068] EB=(x2 EB -x1 EB )×(y2 EB -y1 EB )
[0069] Step 5: Calculate IoU:
[0070] AU=A p +A g -IB
[0071] I oU=IB / AU
[0072] Step 6: Calculate GI oU
[0073] GI oU = I oU - (EB - AU) / EB
[0074] Step 7: Calculate the loss function L GIoU
[0075] L GIoU =1-GI oU
[0076] Step 8: Improve GI oU inclusion. AUB remains unchanged, the distance between the two boxes is transformed, and GI oU loss remains unchanged, which is improved to DI oU
[0077] Calculate DI oU:
[0078]
[0079] Step 9: Calculate L DIoU :
[0080] L DIoU =1-I oU+DI oU
[0081] Step 10: Improve DI OU, the center points overlap, the center point distance remains unchanged, the DI OU loss remains unchanged, but the aspect ratio is different and improved to C IOU. When the center points of the two boxes overlap, the values of c and d remain unchanged. So at this time, the aspect ratio of the box needs to be introduced
[0082] Calculate CI oU:
[0083] CI oU=DI oU+αv
[0084] Where α is the weight function and v is used to measure the consistency of aspect ratio:
[0085]
[0086] Step 11: Calculate L CIoU :
[0087] CI oU=1-I oU+DI oU+αv
[0088] The penalty term of EI oU is based on the penalty term of CI oU, and the influencing factor of aspect ratio is separated to calculate the length and width of the target box and the anchor box respectively. The loss function consists of three parts: overlap loss, center distance loss, and width and height loss. The first two parts continue the method in CI oU, but the width and height loss directly minimizes the difference between the width and height of the target box and the anchor box, making the convergence speed faster.
[0089] Compared with the traditional YOLOv7, the number of prediction boxes is reduced, but the positive and negative samples are still extremely unbalanced. This imbalance makes the cross entropy loss adopted by the objectness loss of YOLOv7 inappropriate. Focus (FL) may be an important method to alleviate this problem. It focuses on adding weights to the loss corresponding to the sample according to the difficulty of sample discrimination, that is, adding smaller weights to samples that are easy to distinguish and larger weights to samples that are difficult to distinguish, thereby improving performance. Focus Loss has the following characteristics: when it is very small (the sample is difficult to distinguish, regardless of whether the classification is correct), the adjustment factor approaches 1, and the weight of the sample in the loss function is not affected; when it is very large (the sample is easy to distinguish, regardless of whether the classification is correct), the adjustment factor approaches 0, and the weight of the sample in the loss function decreases a lot; the focus parameter can adjust the degree of reduction in the weight of the easy-to-classify sample, and the larger the weight, the greater the reduction. Now let's start to introduce how the function of Focus is obtained:
[0090] The cross entropy loss LCE for binary classification can be described by the following formula.
[0091] L CE (p,y)=-ylog(p)-(1-y)log(1-p)
[0092] Among them, y∈{0,1} represents the GT class, where 1 represents the object and 0 represents the background. p∈[0,1] is the target probability output of the logistic function. In order to extract the difficult-to-distinguish samples and reduce the weight of the easy-to-distinguish samples, in L CE Add the adjustment factor to get L FL :
[0093] L FL (p,y)=|yp| γ L CE (p,y)
[0094] In the formula, γ is an adjustable parameter and is greater than 0. When a sample is correctly classified, |yp|->0, i.e., p->y, L FL (p,y) is close to 0, indicating that the loss of easy-to-classify samples decreases. When the sample is misclassified, |yp|->1, L CE Equivalent to L FL .
[0095] In order to give each predicted box an objective label during the training phase, the predicted box whose center is closest to the true box is marked as positive. This box overlaps with the true box greater than the threshold and is not counted in the objective loss L FLThe threshold is set to 0.5. The class prediction loss still uses the binary cross entropy loss, which is the same as the traditional YOLOv7. Therefore, the final loss function of the improved YOLOv7 in this application during the training phase is as follows:
[0096] L AF =L EIoU (box)+L FL (objectness)+L CE (class) (10)
[0097] Summarize
[0098] Theoretically, AF YOLOv7 is more efficient than AB YOLOv7. Take an N×N grid as an example. For the AF method, the maximum number of predicted bounding boxes is N×N because one box is predicted for each point. For the AB method, the maximum number of predicted bounding boxes is 3×N×N because three boxes are predicted for each point. Theoretically, the training time and test time of the AF method are both less than the AB method.
[0099] The improved feature fusion method can produce more decent defect detection boxes.
[0100] The E IoU regression loss splits the aspect ratio loss into the difference between the predicted width and height and the minimum bounding box width and height, which accelerates the convergence of the predicted box and improves the regression accuracy of the predicted box.
[0101] Using FL as the targeted loss improves the detection performance. On the one hand, when the number gap between positive and negative samples is large, the network may not be suitable for convergence due to the cross entropy loss; on the other hand, the algorithm can effectively reduce the weight of easy-to-distinguish samples and pay more attention to difficult-to-distinguish samples, making the samples in the optimization process more targeted.
[0102] ConvNeXt introduces the concepts of cross-channel and group convolution. The number of input maps corresponds to the number of feature maps and the number of convolution kernels, and each convolution kernel processes a corresponding channel. The cross-channel layer interacts the features in each channel group with the features in other channel groups, and then concatenates the interacted features. The group convolution layer divides the output of the cross-channel layer into several channel groups, and then performs convolution operations on each channel group, and finally concatenates the results, which increases the information interaction and mutual influence between features, thereby improving the feature expression ability and generalization ability of the model. Secondly, ConvNeXt uses the reversed residual ConvNeXt Block structure as shown in Figure 1 , first 1*1 convolution to increase the dimension, then 1*1 convolution to reduce the dimension. Finally, hierarchical normalization is used to replace the original batch normalization, retaining the standardization layer after the depth convolution, and GELU replaces the original ReLu activation function.
[0103] In terms of network architecture, the number of stacking times in ResNet50 is adjusted from (3,4,6,3) to (3,3,9,3), which has similar FLOPs as SwinT. In terms of downsampling design, SwinT is used to use a downsampling layer for the ConvNeXt network, which consists of a layer normalization plus a convolution layer with a convolution kernel of 2 and a stride of 2. Four ConvNeXt versions, T / S / B / L, are proposed, where Conv represents the convolution operation, k represents the size of the convolution kernel, s represents the stride, layer Norm represents layer normalization, and Downsamp le represents the downsampling process. The structure of ConvNeXt Block is as follows: Figure 2 .
[0104] The strip steel images are partially limited by the lack of objective conditions, and the clarity of the images is always affected, thereby reducing the accuracy of the target algorithm. Compared with the increase in model size caused by directly adding a multi-layer attention mechanism or adding a feature extraction network, ConvNeXt can replace part of the CBS structure in the YOLOv7 network, thereby improving the detection accuracy while reducing the model size. ComvNeXt is a pure convolutional neural network, which is benchmarked against Swin Transformer. Through a series of experimental comparisons, under the same conditions, ConvNext has faster reasoning speed and higher accuracy than Swin Transformer. ConNext BLock Figure 3 As shown;
[0105] Although the ConvNeXt module is a pure convolutional structure, it is very different from the traditional convolutional network, which is the key to its high efficiency. When processing the same image information, the traditional convolution uses a 3*3 or 1*1 convolution kernel to extract information, while the ConvNeXt module takes into account the high accuracy of the attention model due to global information acquisition and uses a large 7*7 convolution kernel to improve the ability to acquire global information. Figure 4 This is the network structure of YOLOV7 before improvement; Figure 5 Improved YOLOv7 network structure.
[0106] In one embodiment, the strip surface image collected on-site follows the following rules:
[0107] Obtaining operation monitoring data of strip steel production equipment;
[0108] The abnormal analysis library is used to analyze the operation monitoring data. Based on the analysis results, the image acquisition equipment is controlled to acquire images at the positions on the strip corresponding to the acquisition and analysis results.
[0109] The operation monitoring data of the strip steel production equipment is analyzed, and then the action of the image acquisition equipment is controlled to collect images at the corresponding positions to achieve accurate image acquisition. Among them, the abnormal analysis library is constructed in advance, and the analysis results in the abnormal analysis library are associated one by one with the corresponding call parameter set; the call parameter set is a feature data set constructed by extracting the historical operation monitoring data used during construction and then using the extracted features; feature extraction is performed on the operation monitoring data, mainly extracting the voltage and current of various parts of the strip steel production equipment; the pressure values of the pressure rollers on various parts of the strip steel and other data corresponding to the features, such as: average value, maximum value, minimum value, variance, etc.
[0110] This embodiment controls the action of the image acquisition device by analyzing the operation monitoring data collected on site, and then adjusts the action of the image acquisition device according to different situations. The control method includes: image acquisition interval, starting sampling position, etc. This embodiment will also make adaptive changes to the specific control according to different specific situations of the application.
[0111] For the control in the case of using multiple cameras evenly distributed in the width direction of the finished strip production, the winding speed in the operation monitoring data is mainly used to control the interval of image sampling. The specific control is: parse the analysis results, determine the location of the predicted abnormal position in the width direction of the strip, and based on the location, determine the camera responsible for sampling, and construct a sampling time axis from the equipment outlet position to the acquisition center position corresponding to the camera. According to the location of the predicted abnormal position in the length direction of the strip, determine the abnormal point in the sampling time axis, and determine the distance between the abnormal point and the nearest interval sampling point on the time axis; when the distance is zero or within the preset difference range, do not change the time axis; otherwise, generate a new interval sampling point at the abnormal point;
[0112] In view of setting a guide rail in the width direction of the finished product of the strip and setting a camera on the guide rail for image acquisition, the image acquisition action in this scenario is that the guide rail drives the camera to slide above the strip, and image sampling is performed during the sliding process; at this time, the control is not only the control of the sampling time interval, but also includes: controlling the action of the guide rail according to the location of the defect; in order to achieve the action of the camera, the defect position is exactly located in the middle area of the acquired image to improve the accuracy and effectiveness of defect recognition; when the abnormal position is predicted and determined, the specific control determination includes: constructing a plane model diagram of the strip from the product outlet of the equipment to the guide rail, mapping the predicted abnormal position to the plane model diagram to form an abnormal point; according to the current control parameters of the guide rail, constructing the corresponding trajectory of the image acquisition device on the plane model diagram; according to the current sampling time interval control set of the image acquisition device, determining the interval sampling point on the trajectory; determining the abnormal point is the distance from the nearest interval sampling point; when the distance is zero or within the preset difference range, the control parameters of the image acquisition device are not changed; otherwise, the corresponding nearest interval sampling point is replaced by the abnormal point, the trajectory is reconstructed, and the control parameters of the image acquisition device are determined based on the reconstructed trajectory.
[0113] In one embodiment, the strip surface image collected on-site also follows the following rules:
[0114] Obtain historical inspection record data of strip steel production equipment;
[0115] Analyze historical detection record data to determine at least one focus point;
[0116] Determine the control parameters of the image acquisition device before and after the focus point according to the focus value of each focus point and the preset control parameter determination library;
[0117] The historical detection record data is analyzed to determine at least one focus point, including:
[0118] Statistics are collected on abnormal points in historical detection records, and abnormal points whose occurrence times of the same abnormal point are greater than a preset threshold and / or whose difference between the occurrence time and the current time is less than or equal to a preset time threshold are extracted as focus points;
[0119] The method for determining the attention value corresponding to the attention point is as follows:
[0120] According to the time of the historical records corresponding to the attention point, query the preset first attention coefficient table to determine the first attention coefficient corresponding to each appearance of the attention point; the closer the time in the first attention coefficient table is to the current time, the greater the first attention coefficient;
[0121] According to the total number of occurrences of the attention point, query the preset second attention coefficient table to determine the second attention coefficient; the more times in the second attention coefficient, the greater the second attention coefficient;
[0122] The sum of the first attention coefficients is multiplied by a preset first weight; the second attention coefficient is multiplied by a preset second weight, and then the sum of the two is calculated to obtain an attention value.
[0123] The control parameter determination library associates the attention value with the control parameter set, and the control parameter set includes: the control parameters of the image acquisition device before and after the attention point. The larger the attention value, the shorter the image acquisition time interval corresponding to the control parameter.
[0124] For the positioning of the points of interest, the plane area corresponding to the strip size of a production cycle of the strip production equipment can be used to construct a coordinate system, and then the point can be accurately positioned. The production cycle can be one rotation of the roller of the production equipment producing the strip or other integer cycles.
[0125] In one embodiment, the present invention further provides a strip steel surface defect detection system based on improved YOLOv7, comprising: a monitoring unit and a collection unit; the collection unit is used to collect the strip steel surface image on site; the monitoring unit inputs the strip steel surface image collected on site into the improved YOLOv7 model to obtain a detection result;
[0126] Among them, the backbone network of the improved YOLOv7 model is the ConvNext network; the improved YOLOv7 model uses EIOU loss as the regression loss function to guide training during training.
[0127] The acquisition unit collects the strip surface image on site and performs the following operations:
[0128] Obtaining operation monitoring data of strip steel production equipment;
[0129] The abnormal analysis library is used to analyze the operation monitoring data. Based on the analysis results, the image acquisition equipment is controlled to acquire images at the positions on the strip corresponding to the acquisition and analysis results.
[0130] The loss function is improved to solve the problems of data imbalance and slow training speed. EIoU loss is used as the regression loss function, which is scale-invariant and can directly optimize the evaluation index of bounding box regression to speed up the model fitting. The ConvNext network has better learning performance on high-density objects and can capture global information and rich contextual information. It is applied to the YOLOv7 model and its backbone network is replaced with the ConvNext network to improve the detection accuracy of the YOLOv7 model for small targets.
[0131] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A strip steel surface defect detection method based on improved YOLOv7, characterized in that: include: The strip surface images collected on site are input into the improved YOLOv7 model to obtain the detection results; Among them, the backbone network of the improved YOLOv7 model is the ConvNext network; the improved YOLOv7 model uses EIOU loss as the regression loss function to guide training during training; The strip surface images collected on site follow the following rules: Obtaining operation monitoring data of strip steel production equipment; The abnormal analysis library is used to analyze the operation monitoring data. Based on the analysis results, the image acquisition equipment is controlled to acquire images at the positions on the strip corresponding to the acquisition and analysis results. The control for the case where multiple cameras are evenly distributed in the width direction of the strip steel product is as follows: analyze the analysis results, determine the location of the predicted abnormal position in the width direction of the strip steel, determine the camera responsible for sampling based on the location, construct a sampling time axis of the strip steel corresponding to the camera from the equipment outlet position to the acquisition center position corresponding to the camera, determine the abnormal point in the sampling time axis based on the location of the predicted abnormal position in the length direction of the strip steel, and determine the distance between the abnormal point and the nearest interval sampling point on the time axis; when the distance is zero or within the preset difference range, do not change the time axis; otherwise, generate a new interval sampling point at the abnormal point; A guide rail is set in the width direction of the finished product of the strip and a camera is set on the guide rail for image acquisition. The image acquisition action is that the guide rail drives the camera to slide above the strip, and image sampling is performed during the sliding process; the control also includes: constructing a plane model diagram of the strip from the product outlet of the equipment to the guide rail, and mapping the predicted abnormal position to the plane model diagram to form an abnormal point; according to the current control parameters of the guide rail, constructing a trajectory corresponding to the image acquisition device on the plane model diagram; according to the current sampling time interval control set of the image acquisition device, determining the interval sampling point on the trajectory; determining the abnormal point is the distance to the nearest interval sampling point; when the distance is zero or within the preset difference range, the control parameters of the image acquisition device are not changed; otherwise, replacing the corresponding nearest interval sampling point with the abnormal point, reconstructing the trajectory, and determining the control parameters of the image acquisition device based on the reconstructed trajectory.
2. The strip surface defect detection method based on improved YOLOv7 according to claim 1 is characterized in that: The formula of the EIOU loss function is as follows: Where, L EIoU represents EIOU loss; L IoU represents IOU loss; L dis Indicates distance loss; L asp represents the edge length loss; ρ 2 (b,b gt ) represents the Euclidean distance between the real box and the predicted box length; ρ 2 (ω,ω gt ) represents the Euclidean distance between the width of the real box and the predicted box; ρ 2 (h,h gt ) represents the Euclidean distance between the height of the real box and the predicted box; C represents the shortest length that contains both the real box and the predicted box; C ω Indicates the shortest width of both the real box and the predicted box; C h Indicates the shortest height that includes both the true box and the predicted box.
3. The strip surface defect detection method based on improved YOLOv7 according to claim 1 is characterized in that: The final loss function of the improved YOLOv7 model during training is as follows: L AF =L EIoU (box)+L FL (objectness)+L CE (class) Where, L AF represents the final loss function; L EIoU (box) is the target box selection loss, L FL (objectness) is the objective loss, L CE (class) is the target classification loss.
4. The strip surface defect detection method based on improved YOLOv7 according to claim 1 is characterized in that: The improved YOLOv7 model uses GELU as the activation function.
5. A strip surface defect detection system based on improved YOLOv7, characterized in that: include: The monitoring unit is used to input the strip surface image collected on site into the improved YOLOv7 model to obtain the detection result; A collection unit, used for collecting images of the strip surface on site; Among them, the backbone network of the improved YOLOv7 model is the ConvNext network; the improved YOLOv7 model uses EIOU loss as the regression loss function to guide training during training; The acquisition unit collects the strip surface image on site and performs the following operations: Obtaining operation monitoring data of strip steel production equipment; The abnormal analysis library is used to analyze the operation monitoring data. Based on the analysis results, the image acquisition equipment is controlled to acquire images at the positions on the strip corresponding to the acquisition and analysis results. The control for the case where multiple cameras are evenly distributed in the width direction of the strip steel product is as follows: analyze the analysis results, determine the location of the predicted abnormal position in the width direction of the strip steel, determine the camera responsible for sampling based on the location, construct a sampling time axis of the strip steel corresponding to the camera from the equipment outlet position to the acquisition center position corresponding to the camera, determine the abnormal point in the sampling time axis based on the location of the predicted abnormal position in the length direction of the strip steel, and determine the distance between the abnormal point and the nearest interval sampling point on the time axis; when the distance is zero or within the preset difference range, do not change the time axis; otherwise, generate a new interval sampling point at the abnormal point; A guide rail is set in the width direction of the finished product of the strip and a camera is set on the guide rail for image acquisition. The image acquisition action is that the guide rail drives the camera to slide above the strip, and image sampling is performed during the sliding process; the control also includes: constructing a plane model diagram of the strip from the product outlet of the equipment to the guide rail, and mapping the predicted abnormal position to the plane model diagram to form an abnormal point; according to the current control parameters of the guide rail, constructing a trajectory corresponding to the image acquisition device on the plane model diagram; according to the current sampling time interval control set of the image acquisition device, determining the interval sampling point on the trajectory; determining the abnormal point is the distance to the nearest interval sampling point; when the distance is zero or within the preset difference range, the control parameters of the image acquisition device are not changed; otherwise, replacing the corresponding nearest interval sampling point with the abnormal point, reconstructing the trajectory, and determining the control parameters of the image acquisition device based on the reconstructed trajectory.
6. The strip steel surface defect detection system based on improved YOLOv7 according to claim 5 is characterized in that: The formula of the EIOU loss function is as follows: Where, L EIoU represents EIOU loss; L IoU represents IOU loss; L dis Indicates distance loss; L asp represents the edge length loss; ρ 2 (b,b gt ) represents the Euclidean distance between the real box and the predicted box length; ρ 2 (ω,ω gt ) represents the Euclidean distance between the width of the real box and the predicted box; ρ 2 (h,h gt ) represents the Euclidean distance between the height of the real box and the predicted box; C represents the shortest length that contains both the real box and the predicted box; C ω Indicates the shortest width of both the real box and the predicted box; C h Indicates the shortest height that includes both the true box and the predicted box.
7. The strip steel surface defect detection system based on improved YOLOv7 according to claim 5 is characterized in that: The final loss function of the improved YOLOv7 model during training is as follows: L AF =L EIoU (box)+L FL (objectness)+L CE (class) Where, L AF represents the final loss function; L EIoU (box) is the target box selection loss, L FL (objectness) is the objective loss, L CE (class) is the target classification loss.
8. The strip steel surface defect detection system based on improved YOLOv7 according to claim 5, characterized in that: The improved YOLOv7 model uses GELU as the activation function.
Citation Information
Patent Citations
YOLO v5 steel surface damage detection method introducing attention mechanism and ConvNext network
CN115731177A
Strip steel surface defect detection method and system based on improved YOLOv5
CN117011231A