Method for detecting surface defects of hot rolled strip steel
By improving the YOLOv8 network model, the problem of low accuracy and efficiency in strip surface defect detection is solved, higher detection accuracy and lower missed detection rate are achieved, and the reliability and automation of the detection results are improved.
Patent Information
- Application Number
- CN202411445972.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2024-12-20
AI Technical Summary
The prior art has low accuracy and efficiency in strip surface defect detection. Traditional image processing algorithms have poor detection results in the face of diverse textures and different scales. Deep learning models still need to be improved in this field.
Improve the YOLOv8 network model, by replacing the C2f module in the backbone network with the MSC2f module, the concat module in the neck network with the GS-SDI module, the detection head is GSP-Head, and the CIoU border regression loss function is replaced with Inner-CIoU. Combined with the multi-scale feature fusion of the MSC2f module, the semantics and details injection of the GS-SDI module, the feature integration of the GSP-Head and the classification loss calculation, the detection performance is improved.
It significantly improves the accuracy and efficiency of surface defect detection of strip steel, improves the reliability and automation of detection results, and achieves higher detection accuracy and lower missed detection rate.
Smart Images

Figure CN119168999A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for detecting surface defects of hot-rolled strip steel. Background Art
[0002] In steel production, hot-rolled strip is an important steel product, which is widely used in various industrial fields. However, due to production process and other reasons, strip often has surface defects, such as cracks, pitting and inclusions, which seriously affect its performance and quality. Therefore, real-time online detection of strip surface defects is particularly important.
[0003] Traditional strip surface defect detection methods mainly rely on manual visual inspection, which is inefficient and prone to missing defects, resulting in inaccurate detection results. With the development of machine vision technology, automated detection methods based on image processing are gradually being applied to strip surface defect detection. However, traditional image processing algorithms do not achieve ideal detection results when faced with strip surface defects with diverse textures and different scales, and have problems with poor versatility and robustness.
[0004] In recent years, deep learning technology has made significant progress in the field of image recognition, and deep learning-based defect detection methods have gradually become a research hotspot. Deep learning algorithms do not require manual explicit design of feature extraction methods, and can be trained on a large amount of data under different scenarios and conditions to obtain network models suitable for different scenarios. However, the accuracy and efficiency of existing deep learning models in strip surface defect detection still need to be improved.
[0005] Therefore, providing a new strip surface defect detection method with higher accuracy and efficiency has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] The present invention provides a method for detecting surface defects of hot-rolled strip steel in order to solve the problems existing in the above-mentioned prior art.
[0007] The technical solutions adopted in the present invention are:
[0008] A method for detecting surface defects of hot-rolled strip steel comprises the following steps:
[0009] S1) The original YOLOv8 network model is improved to obtain an improved YOLOv8 network model, wherein the improvements are as follows:
[0010] (1) The C2f module in the original backbone network is replaced by the MSC2f module, where the MSC2f module includes the first convolutional layer, the second convolutional layer and the MSBlock;
[0011] (2) replacing the concat module in the original neck network with a GS-SDI module, wherein all convolutional layers in the SDI module are replaced with a GSConv module;
[0012] (3) Replace the original detection head with GSP-Head;
[0013] (4) Replace the bounding box regression loss function CIoU during original network training with Inner-CIoU;
[0014] S2) Using public datasets to train the improved YOLOv8 network model;
[0015] S3) The hot-rolled steel strip to be inspected is input into the trained network model, and the surface defects of the hot-rolled steel strip are identified using the improved YOLOv8 network model.
[0016] Furthermore, the implementation method of the MSC2f module is as follows:
[0017] First, the input feature map is processed by the first convolutional layer, and the obtained output feature map is divided into two parts, namely the first feature map and the second feature map;
[0018] The first part of the feature map is processed by MSBlock, and the processed first part of the feature map and the second part of the feature map are spliced in the channel dimension to obtain a spliced feature map. The spliced feature map is processed by the second convolutional layer to obtain the final MSC2f module output feature map.
[0019] Furthermore, the MSBlock module includes a channel expansion convolution layer, an intermediate convolution layer combination and an output convolution layer. The implementation method of the MSBlock module is:
[0020] First, the first part of the input feature map is processed through the input channel expansion convolution layer to obtain the feature map after channel expansion;
[0021] The feature map after the channel expansion is divided into multiple parts, and each part of the feature map is processed by the combination of intermediate convolutional layers in turn;
[0022] The feature maps output by the intermediate convolutional layers are spliced in the channel dimension to obtain the spliced feature maps, which are processed by the output convolutional layer to obtain the final MSBlock module output feature maps.
[0023] Furthermore, the intermediate convolution layer combination includes several intermediate convolution layers, the intermediate convolution layer is an MSBlockLayer module, and the MSBlockLayer module includes a third convolution layer, a fourth convolution layer, and a fifth convolution layer; the feature map input to the intermediate convolution layer is processed by the third convolution layer to obtain an intermediate feature map;
[0024] Next, the intermediate feature map is processed by the fourth convolutional layer to obtain the processed feature map. Finally, the processed feature map is processed by the fifth convolutional layer to obtain the intermediate convolutional layer combined output feature map.
[0025] Furthermore, the GSP-Head module includes an eighth convolutional layer, a ninth convolutional layer, a tenth convolutional layer and an eleventh convolutional layer, and the implementation method of the GSP-Head module is:
[0026] The input feature map is successively passed through the eighth convolutional layer and the ninth convolutional layer for feature integration to obtain the processed feature map, and then the processed feature map is passed through the tenth convolutional layer to obtain the regression feature map and calculate the regression loss, and the classification feature map is obtained through the eleventh convolutional layer and the classification loss is calculated.
[0027] Furthermore, the eighth convolutional layer adopts a GSConv module.
[0028] Furthermore, the GSConv module includes a sixth convolutional layer and a seventh convolutional layer. The input feature map is processed by the sixth convolutional layer to obtain an intermediate feature map, and the intermediate feature map is processed by the seventh convolutional layer to obtain a processed feature map; the processed feature map is spliced with the output feature map of the sixth convolutional layer in the channel dimension to obtain a spliced feature map, and the spliced feature map is rearranged into feature maps of two channels through a reorganization operation, and spliced in the channel dimension to obtain the final GSConv module output feature map.
[0029] Furthermore, the sixth convolutional layer has an input channel number of c1, an output channel number of c_, a convolution kernel size of k, a step size of s, a padding of p, a grouping number of g, a dilation rate of d, and an activation function of the default activation function;
[0030] The number of input channels of the seventh convolutional layer is c_, the number of output channels is c_, the convolution kernel size is 5, the step size is 1, the padding is p, the number of groups is c_, the expansion rate is d, and the activation function is the default activation function.
[0031] The present invention has the following beneficial effects:
[0032] The invention has high accuracy and reliability, and has important practical significance and application prospects in improving steel quality and production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is the structural diagram of the original YOLOv8 network model.
[0034] Figure 2 This is the structural diagram of the improved YOLOv8 network model.
[0035] Figure 3 This is the structural diagram of the MSC2f module.
[0036] Figure 4 This is the structural diagram of the GS-SDI module.
[0037] Figure 5 This is the structural diagram of the GSP-Head module.
[0038] Figure 6 Schematic diagram of defect image.
[0039] Figure 7 This is the detection effect diagram of the original YOLOv8 network model.
[0040] Figure 8 This is the detection heat map of the original YOLOv8 network model.
[0041] Fig. 9 This is the detection effect diagram of the improved YOLOv8 network model.
[0042] Fig.10 Detection heat map of the improved YOLOv8 network model. DETAILED DESCRIPTION
[0043] The present invention will be further described below in conjunction with the accompanying drawings.
[0044] The present invention provides a method for detecting surface defects of hot-rolled strip steel, comprising the following steps:
[0045] S1) The original YOLOv8 network model is improved to obtain an improved YOLOv8 network model.
[0046] The original YOLOv8 network model mainly consists of three parts: Backbone, Neck, and Head. Figure 1 As shown in the figure, after a series of operations such as input part data enhancement, the image is preprocessed and sent to the backbone network, which extracts features from the processed image; then, the extracted features are fused by the Neck module to obtain features of three sizes: large, medium, and small; finally, the fused features are sent to the detection head, and the results are output after detection. The original YOLOv8 network model has low accuracy when used for hot-rolled strip surface defect detection.
[0047] The present invention improves the original YOLOv8 network model to obtain an improved YOLOv8 network model. The network architecture diagram of the improved YOLOv8 network model is as follows: Figure 2 As shown, the specific improvements are:
[0048] (1) The C2f module in the original backbone network is replaced by the MSC2f module, where the MSC2f module includes the first convolutional layer 1, the second convolutional layer 2 and MSBlock;
[0049] (2) replacing the concat module in the original neck network with a GS-SDI module, wherein all convolutional layers in the SDI module are replaced with a GSConv module;
[0050] (3) Replace the original detection head with GSP-Head;
[0051] (4) Replace the bounding box regression loss function CIoU during original network training with Inner-CIoU.
[0052] When the defects on the surface of hot-rolled strip are identified using the improved YOLOv8 network model, the accuracy is high. The improvements of the present invention are further described below.
[0053] 1.MSC2f module
[0054] 1.1: Introducing MSBlock,
[0055] The MSBlock module includes a channel expansion convolution layer 3, an intermediate convolution layer combination 4 and an output convolution layer 9. The first part of the input feature map is processed by the input channel expansion convolution layer 3 to obtain a feature map after channel expansion; the feature map after channel expansion is divided into multiple parts, and each part of the feature map is processed in turn by the intermediate convolution layer combination 4.
[0056] The feature maps output by the intermediate convolutional layer combination 4 are spliced in the channel dimension to obtain a spliced feature map, and the spliced feature map is processed by the output convolutional layer 9 to obtain the final MSBlock module output feature map.
[0057] The intermediate convolution layer combination 4 includes several intermediate convolution layers 5, the intermediate convolution layer 5 is an MSBlockLayer module, the MSBlockLayer module includes a third convolution layer 6, a fourth convolution layer 7 and a fifth convolution layer 8, and the feature map input to the intermediate convolution layer 5 is processed by the third convolution layer 6 to obtain an intermediate feature map.
[0058] Next, the intermediate feature map is processed by the fourth convolutional layer 7 to obtain a processed feature map, and finally, the processed feature map is processed by the fifth convolutional layer 8 to obtain an output feature map of the intermediate convolutional layer combination 4.
[0059] MSBlock implements multi-scale feature fusion through the following steps:
[0060] Feature grouping: After the input feature map undergoes 1×1 convolution, the number of channels increases and it is divided into multiple groups (X1-Xn), and feature extraction is performed on each group.
[0061] Inverted Bottleneck Layer: Except for the first group, the other groups are processed by the inverted bottleneck layer. The inverted bottleneck layer uses large kernel convolution to capture more extensive information.
[0062] Feature fusion: Each set of features is fused by adding them layer by layer, and finally a 1×1 convolution is used to interact between channels to generate a multi-scale feature representation.
[0063] Through this grouping and fusion strategy, MSBlock effectively improves the multi-scale representation capability of feature extraction while maintaining a relatively fast inference speed.
[0064] 1.2: Implementation steps of MSBlockLayer
[0065] Input convolution layer (self.in_conv): Through a convolution operation (i.e. the third convolution layer 6), the number of input feature channels is converted from inc to ouc, and the convolution kernel size is 1.
[0066] Middle convolution layer (self.mid_conv): Through a convolution operation (i.e. the fourth convolution layer 7), the features are deeply convolved with a convolution kernel size of k and a group number of ouc, keeping the number of feature channels unchanged.
[0067] Output convolution layer (self.out_conv): Through a convolution operation (i.e. the fifth convolution layer 8), the number of feature channels is converted from ouc back to inc, and the convolution kernel size is 1.
[0068] Forward propagation: The input features pass through the third convolution layer 6, the fourth convolution layer 7 and the fifth convolution layer 8 in sequence to obtain the final output features.
[0069] 1.3: Implementation steps of MSBlock
[0070] Input channel expansion convolution layer 3 (self.in_conv): Through a convolution operation, the number of input feature channels is expanded from inc to in_channel, where in_channel is inc multiplied by in_expand_ratio divided by in_down_ratio.
[0071] The split and convolution of the middle convolution layer combination 4 (self.mid_convs): the expanded input feature channel number in_channel is split into multiple sub-channels, and the number of channels of each sub-channel is self.mid_channel, where self.mid_channel is the length of in_channel divided by kernel_sizes. For each sub-channel, it is processed by multiple MSBlockLayers, and the number of input channels of each MSBlockLayer is self.mid_channel, the number of output channels is groups, and the convolution kernel size is kernel_size.
[0072] Output convolution layer 9 feature map concatenation and output convolution (self.out_conv): All processed sub-channel feature maps are concatenated together to form a new feature map. Through a convolution operation, the number of channels of the concatenated feature map is converted from in_channel to ouc, and the convolution kernel size is 1.
[0073] Attention mechanism (self.attention): If the attention mechanism exists, the output feature map is weighted to enhance important features.
[0074] Forward propagation (forward): The input features are first channel-expanded through the input convolution layer. The expanded feature map is divided into multiple sub-channels, which are processed by the corresponding intermediate convolution layer. The processed sub-channel feature maps are added and then passed through the corresponding intermediate convolution layer. All the processed sub-channel feature maps are spliced together and the final output feature map is obtained through the output convolution layer. If the attention mechanism exists, the final output feature map is weighted.
[0075] 1.4: Implementation steps of MSC2f
[0076] Input the first convolutional layer 1: The input feature channel number c1 is divided into two parts (i.e., the first part feature map y[0] and the second part feature map y[1]) through a convolution operation. The number of channels in each part is 2*self.c, where self.c is c2 multiplied by e.
[0077] Intermediate convolution (self.m): contains multiple MSBlock modules, each of which is used to extract multi-scale features. The number of input channels and output channels of MSBlock are both self.c, the convolution kernel size is kernel_sizes, the input expansion ratio is in_expand_ratio, the middle expansion ratio is mid_expand_ratio, the number of layers is layers_num, and the input downsampling ratio is in_down_ratio.
[0078] The second convolutional layer 2: After concatenating the feature map output by the intermediate convolutional layer with the input feature map, a convolution operation is performed to convert the number of channels to c2.
[0079] Forward propagation: Figure 3 As shown in the figure, the input feature first passes through the input convolution layer self.cv1 to divide the input feature map into two parts. The segmented feature map is passed to the middle convolution layer self.m for processing to obtain multiple sub-feature maps. All sub-feature maps are concatenated with the original input feature map and passed through the output convolution layer self.cv2 to obtain the final output feature map.
[0080] 2.GS-SDI module
[0081] 2.1: Introducing SDI
[0082] The SDI (Semantic and Detail Injection) module can significantly improve the semantic expression and detail retention capabilities of feature maps by injecting semantic information from high-level features and detail information from low-level features into each layer of feature maps, thereby improving the performance and efficiency of neural networks.
[0083] 2.2: Improve the implementation steps of SDI
[0084] Original smooth convolution layer (self.convs): Use nn.Conv2d to initialize the convolution layer, perform convolution operations on each input channel, and convert the feature map of each input channel to the target channel number channels[0]. The convolution kernel size is 3, the stride is 1, and the padding is 1.
[0085] Forward propagation (forward): Get the target size (target_size) of the input feature map list (xs), which is the height and width of the first feature map (x) in the input feature map list (xs). Then traverse the input feature map list (xs), and for each feature map, if its size is larger than the target size, adjust it to the target size through adaptive average pooling (DownSample); if its size is smaller than the target size, adjust it to the target size through bilinear interpolation (UpSample). The adjusted feature map is processed by the original smooth convolution layer (self.convs) to obtain the processed feature map, and the processed feature map is multiplied element by element to obtain the output feature map.
[0086] 2.3: Implementation steps of GSConv
[0087] The GSConv module includes a sixth convolutional layer 14 and a seventh convolutional layer.
[0088] The sixth convolutional layer 14 (self.cv1) uses the Conv module to perform a convolution operation, converting the number of input channels c1 to c2 / / 2, with a convolution kernel size of k, a stride of s, a padding of p, a number of groups of g, a dilation rate of d, and applying the default activation function.
[0089] The seventh convolutional layer 15 (self.cv2): Use the Conv module to perform convolution operation, further convolve the feature map of the c2 / / 2 channel, with a convolution kernel size of 5, a stride of 1, a padding of p, a number of groups of c2 / / 2, a dilation rate of d, and the default activation function.
[0090] Channel shuffle operation: concatenate the feature map after the seventh convolution layer 15 (self.cv2) with the feature map after the sixth convolution layer 14 (self.cv1). Perform channel shuffle operation on the concatenated feature map to enhance the feature representation capability.
[0091] Forward propagation (forward): The input feature map is convolved through the sixth convolutional layer 14 (self.cv1) to obtain the convolved feature map x1. x1 is convolved through the seventh convolutional layer 15 (self.cv2) to obtain the feature map x2 after the second convolution. x1 and x2 are concatenated to form a concatenated feature map. The concatenated feature map is shuffled to rearrange the channel order and enhance the feature representation capability.
[0092] 2.4: Implementation steps of GS-SDI ( Figure 4 The structure diagram of the GS-SDI module
[0093] Improved smooth convolution layer (self.convs): Use the GSConv module to perform a convolution operation on each input channel and convert the feature map of each input channel into the target channel number channels[0].
[0094] Forward propagation (forward): Get the target size (target_size) of the input feature map list (xs), which is the height and width of the first feature map (x) in the input feature map list (xs). Then traverse the input feature map list (xs), and for each feature map, if its size is larger than the target size, adjust it to the target size through adaptive average pooling (DownSample); if its size is smaller than the target size, adjust it to the target size through bilinear interpolation (UpSample). The adjusted feature map is processed by the improved smoothing convolution layer 10,11,12,13 (self.convs) to obtain the processed feature map, and the processed feature map is multiplied element by element to obtain the output feature map.
[0095] 3.GSP-Head( Figure 5 The structure diagram of the GSP-Head module)
[0096] 3.1: Proposing GSP-Head
[0097] The GSP-Head module includes an eighth convolutional layer 16, a ninth convolutional layer 17, a tenth convolutional layer 18 and an eleventh convolutional layer 19. The input feature map is successively integrated through the eighth convolutional layer 16 and the ninth convolutional layer 17 to obtain a processed feature map, and then the processed feature map is passed through the tenth convolutional layer 18 to obtain a regression feature map and calculate the regression loss, and the classification feature map is obtained through the eleventh convolutional layer 19 and the classification loss is calculated.
[0098] 3.2: Implementation steps of GSP-Head
[0099] Parameters: Set the number of categories nc, which defaults to 80. Determine the number of detection layers nl, which is equal to the length of the input channels ch. Set the maximum regression value reg_max to 16. Calculate the number of outputs no for each anchor point, which is equal to nc plus reg_max multiplied by 4. Initialize the stride stride to a zero tensor of length nl.
[0100] The eighth convolutional layer 16 and the ninth convolutional layer 17 (self.stem): The convolutional layer is initialized using the GSConv module, and two 3x3 convolution operations are performed on each input channel.
[0101] The tenth convolution layer 18 (self.cv2) and the eleventh convolution layer 19 (self.cv3): The tenth convolution layer 18 (self.cv2): For each input channel, a 1x1 convolution layer is used to convert the number of channels to 4*reg_max. The eleventh convolution layer 19 (self.cv3): For each input channel, a 1x1 convolution layer is used to convert the number of channels to nc.
[0102] Distributed Focal Loss Layer (self.dfl): If reg_max is greater than 1, it is initialized with the DFL module, otherwise it uses nn.Identity().
[0103] Forward propagation:
[0104] Input feature map processing: Get the shape of the input feature map x. Traverse each detection layer, such as Figure 5 As shown, each input feature map x[i] is processed as follows: two 3x3 convolution operations are performed through the eighth convolution layer 16 and the ninth convolution layer 17 (self.stem). A 1x1 convolution operation is performed through the tenth convolution layer 18 (self.cv2) and the eleventh convolution layer 19 (self.cv3), and the results are concatenated together.
[0105] Training mode: If in training mode, directly return the feature map after the above processing.
[0106] Inference mode: If dynamic mode is on or the feature map shape changes, recalculate the anchors and strides. Concatenate all processed feature maps x together to form x_cat. Segment x_cat to get bounding box predictions box and class predictions cls. Process box through the distributed focal loss layer self.dfl and convert the result to bounding box coordinates dbox. Concatenate dbox and cls together to get the final prediction y.
[0107] 4.Inner-CIoU
[0108] 4.1: Introducing Inner-IoU
[0109] Inner-IoU loss is a bounding box regression loss method based on auxiliary bounding boxes, which aims to accelerate the regression process and improve detection performance. By introducing a scaling factor to control the scale of the auxiliary bounding box, better generalization can be achieved on different datasets and detectors.
[0110] In the regression process, Inner-IoU loss evaluates the regression state by calculating the IoU loss of the auxiliary bounding box, and performs gradient propagation by calculating the regression loss to accelerate convergence. For high IoU samples, using a smaller auxiliary bounding box to calculate the loss can accelerate convergence, while for low IoU samples, using a larger auxiliary bounding box is more applicable.
[0111] At the same time, Inner-IoU loss inherits some characteristics of IoU loss and has its own characteristics. By adjusting the scale factor, auxiliary bounding boxes of different scales can be generated, thereby achieving acceleration effects in the regression process of high IoU samples and low IoU samples respectively.
[0112] 4.2: Implementation steps of get_inner_iou
[0113] Coordinate conversion (xyxy2xywh): If the input bounding box coordinate format is (x1,y1,x2,y2), it is converted to (x,y,width,height) format, where (x1,y1) is the upper left corner coordinate and (x2,y2) is the lower right corner coordinate.
[0114] Bounding box format conversion: If the xywh parameter is False, box1 and box2 are converted from (x1, y1, x2, y2) format to (x, y, width, height) format.
[0115] Extract bounding box parameters: Split the coordinates of box1 and box2 into center coordinates (x1, y1) and width and height (w1, h1) as well as (x2, y2) and (w2, h2).
[0116] Calculate the coordinates of the inscribed rectangle: Calculate the coordinates of the upper left corner and lower right corner of the inscribed rectangle (b1_x1, b1_y1, b1_x2, b1_y2) and (b2_x1, b2_y1, b2_x2, b2_y2), where the width and height are multiplied by ratio for scaling.
[0117] Calculate the intersection area: Calculate the intersection area inter of the inscribed rectangles.
[0118] Calculate the union area: Calculate the union area of the inscribed rectangles.
[0119] Calculate IoU: Return the IoU value of the inscribed rectangle, i.e. inter / union
[0120] 4.3: Implementation steps of Inner-CIoU
[0121] Coordinate conversion: If the input bounding box coordinate format is (x,y,w,h), it is converted to (x1,y1,x2,y2) format.
[0122] Calculate inner_iou: Call the get_inner_iou function to calculate the inner_iou of the bounding box box1 and the real box box2.
[0123] Extract bounding box parameters: Split the coordinates of box1 and box2 into upper left corner coordinates (b1_x1, b1_y1) and lower right corner coordinates (b1_x2, b1_y2) as well as (b2_x1, b2_y1) and (b2_x2, b2_y2).
[0124] Calculate the intersection area: Calculate the intersection area inter of the bounding boxes.
[0125] Calculate the union area of the bounding boxes.
[0126] Calculate IoU: Calculate and return the regular IoU value, i.e. inter / union.
[0127] Calculate CIoU: Calculate the convex hull width cw and height ch; Calculate the square of the center point distance rho2; Calculate the aspect ratio consistency measure v and its weight alpha; Calculate inner_iou minus the sum of rho2 / c2 and v*alpha.
[0128] The dataset of the present invention adopts the open source dataset NEU-DET, which contains six types of defects: rolling scale, plaque, crack, pitting surface, inclusions and scratches; it has a total of 1800 images, and its example images are as follows Figure 6 As shown, the images in the dataset are preprocessed and converted into YOLO format.
[0129] Compared with the original YOLOv8 algorithm, the algorithm of the present invention improves mAP@0.5 by 4.0% to 79.9%. To verify the detection effect of the present invention, data-enhanced images are used for detection. Figure 7 and Figure 8 This is the detection effect diagram and heat map of the original YOLOv8. Fig. 9 and Fig.10 The results show that the improved detection method significantly improves the detection accuracy, reduces the missed detection rate, and improves the accuracy and efficiency of strip surface defect detection.
[0130] In the model training stage, the present invention uses a large-scale hot-rolled strip surface defect image data set for training and optimization. Through repeated iterative training, the parameters and structure of the model are continuously adjusted to make it better adapt to the strip surface defect detection task. At the same time, in order to improve the generalization ability and stability of the model, the present invention uses data enhancement technology to preprocess and optimize the data.
[0131] Experimental results show that the improved YOLOv8 network model has achieved remarkable results in the task of hot-rolled strip surface defect detection. Compared with the traditional manual inspection method, the technology of the present invention has higher accuracy and efficiency, and greatly improves the automation and reliability of strip surface defect detection.
[0132] The above description is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements without departing from the principle of the present invention, and these improvements should also be regarded as within the protection scope of the present invention.
Claims
1. A method for detecting surface defects of hot-rolled strip, characterized in that: The steps include: S1) The original YOLOv8 network model is improved to obtain an improved YOLOv8 network model, wherein the improvements are as follows: (1) The C2f module in the original backbone network is replaced by the MSC2f module, wherein the MSC2f module includes a first convolutional layer (1), a second convolutional layer (2) and an MSBlock; (2) replacing the concat module in the original neck network with a GS-SDI module, wherein all convolutional layers in the SDI module are replaced with a GSConv module; (3) Replace the original detection head with GSP-Head; (4) Replace the bounding box regression loss function CIoU during original network training with Inner-CIoU; S2) Using public datasets to train the improved YOLOv8 network model; S3) The hot-rolled steel strip to be inspected is input into the trained network model, and the surface defects of the hot-rolled steel strip are identified using the improved YOLOv8 network model.
2. The method for detecting surface defects of hot rolled strip according to claim 1, characterized in that: The implementation method of the MSC2f module is: First, the input feature map is processed by the first convolutional layer (1), and the obtained output feature map is divided into two parts, namely the first feature map and the second feature map; The first part of the feature map is processed by MSBlock, and the processed first part of the feature map and the second part of the feature map are spliced in the channel dimension to obtain a spliced feature map. The spliced feature map is processed by the second convolutional layer (2) to obtain the final MSC2f module output feature map.
3. The method for detecting surface defects of hot rolled strip according to claim 2, characterized in that: The MSBlock module comprises a channel expansion convolution layer (3), an intermediate convolution layer combination (4) and an output convolution layer (9), and processes the first part of the input feature map through the input channel expansion convolution layer (3) to obtain a feature map after channel expansion; The feature map after the channel expansion is divided into multiple parts, and each part of the feature map is processed by the intermediate convolution layer combination (4) in turn; The feature maps output by the intermediate convolutional layer combination (4) are concatenated in the channel dimension to obtain a concatenated feature map, which is then processed by the output convolutional layer (9) to obtain the final MSBlock module output feature map.
4. The method for detecting surface defects of hot rolled strip according to claim 3, characterized in that: The intermediate convolution layer combination (4) includes a plurality of intermediate convolution layers (5), wherein the intermediate convolution layer (5) is an MSBlockLayer module, and the MSBlockLayer module includes a third convolution layer (6), a fourth convolution layer (7) and a fifth convolution layer (8), and the feature map input to the intermediate convolution layer (5) is processed by the third convolution layer (6) to obtain an intermediate feature map; Next, the intermediate feature map is processed by the fourth convolutional layer (7) to obtain a processed feature map, and finally, the processed feature map is processed by the fifth convolutional layer (8) to obtain an output feature map of the intermediate convolutional layer combination (4).
5. The method for detecting surface defects of hot rolled strip according to claim 1, characterized in that: The GSP-Head module comprises an eighth convolutional layer (16), a ninth convolutional layer (17), a tenth convolutional layer (18) and an eleventh convolutional layer (19), and the input feature map is sequentially passed through the eighth convolutional layer (16) and the ninth convolutional layer (17) for feature integration to obtain a processed feature map, and then the processed feature map is passed through the tenth convolutional layer (18) to obtain a regression feature map and calculate the regression loss, and the processed feature map is passed through the eleventh convolutional layer (19) to obtain a classification feature map and calculate the classification loss.
6. The method for detecting surface defects of hot rolled strip according to claim 5, characterized in that: The eighth convolutional layer (16) adopts a GSConv module.
7. The method for detecting surface defects of hot rolled strip according to claim 1 or 6, characterized in that: The GSConv module includes a sixth convolutional layer (14) and a seventh convolutional layer (15), The input feature map is processed by the sixth convolution layer (14) to obtain an intermediate feature map, and the intermediate feature map is processed by the seventh convolution layer (15) to obtain a processed feature map; the processed feature map and the output feature map of the sixth convolution layer (14) are spliced on the channel dimension to obtain a spliced feature map, and the spliced feature map is rearranged into feature maps of two channels through a reorganization operation, and spliced on the channel dimension to obtain a final GSConv module output feature map.
8. The method for detecting surface defects of hot rolled strip according to claim 7, characterized in that: The sixth convolutional layer (14) has an input channel number of c1, an output channel number of c_, a convolution kernel size of k, a step size of s, a padding of p, a grouping number of g, a dilation rate of d, and an activation function of a default activation function; The seventh convolutional layer (15) has an input channel number of c_, an output channel number of c_, a convolution kernel size of 5, a step size of 1, a padding of p, a grouping number of c_, a dilation rate of d, and an activation function of the default activation function.
