Improved YOLOv8-based steel surface defect detection method and system

By introducing RFCBAMConv, Triplet attention mechanism and GSEMAConv modules in the YOLOv8 model, the problem of large amount of parameters and low accuracy in steel surface defect detection is solved, and high-precision and generalization detection effect is achieved, which is suitable for industrial applications.

CN119067928APending Publication Date: 2024-12-03湖南天桥嘉成智能科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411099446.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing YOLO series models have large parameters and low detection accuracy in steel surface defect detection, making it difficult to accurately extract defect characteristics under complex backgrounds, and have poor generalization.

Method used

By replacing the convolution module of the Backbone trunk part of the YOLOv8 model as the RFCBAMConv module, the Triplet attention mechanism is introduced, and the convolution module is replaced with the GSEMAConv module in the Neck part, the VOVGSEMACSP module is built to improve detection accuracy and generalization capabilities, while reducing the model Parameter quantity.

Benefits of technology

显著提升了钢材表面缺陷检测的精度和泛化性,降低了模型复杂度和资源需求,适用于实际工业应用。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067928A_ABST
    Figure CN119067928A_ABST
Patent Text Reader

Abstract

The invention provides a steel surface defect detection method and system based on improved YOLOv8, and the method comprises the steps: obtaining and preprocessing a steel surface defect data set, and dividing the preprocessed steel surface defect data set into a training set and a test set; selecting a YOLOv8 model as a basic model, improving the YOLOv8 model, and constructing a steel surface defect detection model; inputting the training set into a steel surface defect detection model for iterative optimization training; inputting the test set into a trained steel surface defect detection model for defect detection, and obtaining a defect detection result of each steel image in the test set; the improved YOLOv8 model provided by the invention not only remarkably improves the precision and generalization of steel surface defect detection, but also effectively reduces the complexity and resource demand of the model, thereby having the potential of wide popularization in actual industrial application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection and computer vision technology, and more specifically, to a steel surface defect detection method and system based on improved YOLOv8. Background Art

[0002] The wide application and versatility of steel make it an indispensable material in modern society. It has contributed to industrial development, technological innovation and sustainable development, and is used in shipbuilding, aerospace, energy equipment and other fields. During the production and processing of steel, various defects may appear on the surface of steel due to various reasons. The causes of surface defects of steel include raw material problems, improper processing technology, equipment defects, operational errors, etc. These defects not only affect the appearance of steel, but also may reduce the performance and service life of steel, affect the production of the manufacturing industry, and are likely to cause safety accidents. Therefore, it is necessary to detect defects on the surface of steel. Traditional defect detection technologies mainly include: manual visual inspection, ultrasonic testing, magnetic particle testing, penetration testing, eddy current testing and radiographic testing, etc., but these detection technologies have problems such as low efficiency, test results affected by subjective factors, poor stability, limitations in detecting defect states and high cost.

[0003] With the development of technology, defect detection technology has evolved from traditional manual inspection to deep learning-based detection technology. Deep learning-based defect detection has significant advantages in global and local feature learning, complex nonlinear problem processing capabilities, real-time and robustness, as well as scalability and versatility.

[0004] There are two types of deep learning-based object detection algorithms: one is a single-stage algorithm: RetinaNet, SSD series, YOLO series, etc.; the other is a two-stage algorithm: R-CNN, Fast R-CNN, Faster R-CNN, etc. The two-stage algorithm has limitations in defect detection, mainly manifested in slow detection speed, easy information loss, and increased computational complexity. In contrast, the single-stage algorithm can complete detection through one forward propagation, but its detection accuracy is low, and it is difficult to accurately identify and extract defect features in complex backgrounds, and further optimization is still needed.

[0005] At present, the YOLO series models are widely used in the field of steel surface defect detection. However, the YOLO series models have a large number of parameters and are not very accurate when used directly for steel surface defect detection. How to reduce the number of parameters while improving detection accuracy, and accurately extract complex defect features in the presence of background noise, is a difficult problem that the manufacturing industry needs to solve. Summary of the invention

[0006] In order to overcome the defects of the above-mentioned models in the prior art that it is difficult to improve detection accuracy while reducing the amount of parameters, and the feature extraction ability and generalization are poor, the present invention provides a steel surface defect detection method and system based on improved YOLOv8, which can reduce the calculation requirements and parameter amount of the model and improve the detection accuracy; at the same time, it can also improve the adaptability of the model in complex backgrounds and the generalization ability of different types of steel defects.

[0007] In order to solve the above technical problems, the technical solution of the present invention is as follows:

[0008] A steel surface defect detection method based on improved YOLOv8, comprising the following steps:

[0009] S1: obtaining a steel surface defect dataset and preprocessing it, and dividing the preprocessed steel surface defect dataset into a training set and a test set; the steel surface defect dataset includes a plurality of steel images with different surface defects;

[0010] S2: The YOLOv8 model is selected as the basic model, and the YOLOv8 model is improved. The convolution module of the Backbone part of the YOLOv8 model is replaced with the RFCBAMConv module; the Triplet attention mechanism is introduced in each C2f module of the Backbone part and replaced with the C2f-Triplet module; the convolution module of the Neck part of the YOLOv8 model is replaced with the GSEMAConv module; the VOVGSEMACSP module is constructed based on the GSEMAConv module and each C2f module of the Neck part is replaced to construct a steel surface defect detection model;

[0011] S3: inputting the training set into the steel surface defect detection model for iterative optimization training, and completing the training until the value of the preset total loss function is lower than the preset threshold, thereby obtaining a trained steel surface defect detection model;

[0012] S4: Input the test set into the trained steel surface defect detection model to perform defect detection, and obtain the defect detection result of each steel image in the test set.

[0013] Preferably, in step S1, the preprocessing includes: cutting all steel images in the steel surface defect data set into a uniform size, and converting them into grayscale images respectively;

[0014] The surface defects in each grayscale image are manually labeled to complete the preprocessing.

[0015] Preferably, in step S2, the structure of the RFCBAMConv module includes: a first branch and a second branch arranged in parallel, a weight redistribution layer and a first convolution layer;

[0016] The first branch includes: a global average pooling layer, a first linear layer, a first ReLU activation layer, a second linear layer and a first Sigmoid activation layer connected in sequence; the output of the first Sigmoid activation layer is used as the output of the first branch;

[0017] The second branch includes: a grouped convolution layer, a normalization layer, a second ReLU activation layer and a tensor shape adjustment layer connected in sequence, the output of the tensor shape adjustment layer is connected in sequence to an average pooling layer, a maximum pooling layer, a second convolution layer and a second Sigmoid activation layer; the outputs of the tensor shape adjustment layer and the second Sigmoid activation layer are used together as the output of the second branch;

[0018] The outputs of the first branch and the second branch are input into the weight redistribution layer together, and the output of the weight redistribution layer passes through the first convolution layer to obtain the output of the RFCBAMConv module.

[0019] Preferably, in step S2, introducing the Triplet attention mechanism into each C2f module of the Backbone backbone includes:

[0020] Replace the original Bottleneck blocks in each C2f module of the Backbone with Triplet_Bottleneck blocks to build a C2f-Triplet module.

[0021] The structure of the Triplet_Bottleneck block is as follows: a Triplet attention block is added after the two original convolution blocks in the Bottleneck block; the Triplet attention block includes three parallel branches, which are used to calculate the attention weight of the input tensor by interacting with three different dimensions.

[0022] Preferably, in step S2, the structure of the GSEMAConv module includes:

[0023] Taking the GSConv structure as the basic structure, an EMA attention block is added before the shuffle layer in the GSConv structure to obtain a GSEMAConv module.

[0024] Preferably, in step S2, the structure of the VOVGSEMACSP module includes: a third convolutional layer, a GSEMABottleneck, a fourth convolutional layer, a concatenation layer and a fifth convolutional layer;

[0025] The input of the VOVGSEMACSP module passes through two branches, one passes through the third convolutional layer and GSEMABottleneck in sequence, and the other passes through the fourth convolutional layer. The outputs of the two branches are spliced ​​through the splicing layer and input into the fifth convolutional layer. The output of the fifth convolutional layer is used as the output of the VOVGSEMACSP module.

[0026] Preferably, the structure of the GSEMA Bottleneck comprises: a first GSEMAConv module, a second GSEMAConv module and a sixth convolutional layer;

[0027] The first GSEMAConv module and the second GSEMAConv module are connected in sequence, and the sixth convolutional layer is arranged in parallel with the two GSEMAConv modules;

[0028] The output of the second GSEMAConv module and the output of the sixth convolutional layer are weightedly added as the output of the GSEMABottleneck.

[0029] Preferably, in step S3, the calculation of the total loss function adopts the TaskAlignedAssigner strategy, and the total loss function includes a weighted combination of classification loss and regression loss;

[0030] The classification loss is specifically VFL loss;

[0031] The regression loss includes CIOU loss and DFL loss.

[0032] Preferably, the basic model selected in step S2 is specifically a YOLOv8n model.

[0033] The present invention also provides a steel surface defect detection system based on improved YOLOv8, which applies the above-mentioned steel surface defect detection method based on improved YOLOv8, including:

[0034] Preprocessing unit: used for acquiring and preprocessing a steel surface defect dataset, and dividing the preprocessed steel surface defect dataset into a training set and a test set; the steel surface defect dataset includes a plurality of steel images with different surface defects;

[0035] Model building unit: used for selecting the YOLOv8 model as the basic model, and improving the YOLOv8 model, replacing the convolution module of the Backbone part of the YOLOv8 model with the RFCBAMConv module; introducing the Triplet attention mechanism in each C2f module of the Backbone part and replacing it with a C2f-Triplet module; replacing the convolution module of the Neck part of the YOLOv8 model with a GSEMAConv module; building a VOVGSEMACSP module based on the GSEMAConv module and replacing each C2f module of the Neck part to build a steel surface defect detection model;

[0036] Model training unit: used for inputting the training set into the steel surface defect detection model for iterative optimization training, until the value of the preset total loss function is lower than the preset threshold value, the training is completed, and the trained steel surface defect detection model is obtained;

[0037] Defect detection unit: used to input the test set into the trained steel surface defect detection model for defect detection, and obtain the defect detection result of each steel image in the test set.

[0038] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:

[0039] The present invention provides a steel surface defect detection method and system based on improved YOLOv8. First, a steel surface defect data set is obtained and preprocessed, and the preprocessed steel surface defect data set is divided into a training set and a test set; a YOLOv8 model is selected as a basic model, and the YOLOv8 model is improved to construct a steel surface defect detection model; then the training set is input into the steel surface defect detection model for iterative optimization training, and the training is completed when the value of a preset total loss function is lower than a preset threshold, and a trained steel surface defect detection model is obtained; finally, a test set is input into the trained steel surface defect detection model for defect detection, and a defect detection result of each steel image in the test set is obtained;

[0040] The present invention effectively compensates for the limitations of the steel surface defect detection model under background noise and the defects themselves by introducing the RFCBAMConv module, the Triplet attention mechanism and the GSEMAConv module; specifically, the RFCBAMConv module enhances the algorithm's ability to capture local features; the Triplet attention mechanism optimizes the feature extraction process and effectively improves the algorithm's recognition of multi-dimensional features; the GSEMAConv and VOVGSEMACSP modules further improve the algorithm's detection accuracy and reduce the number of parameters through multi-scale attention mechanism and parameter optimization; the improved model proposed in the present invention not only significantly improves the accuracy and generalization of steel surface defect detection, but also effectively reduces the complexity and resource requirements of the model, thereby having the potential to be widely promoted in actual industrial applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is a flow chart of a steel surface defect detection method based on improved YOLOv8 provided in Example 1.

[0042] Figure 2 This is a diagram of the YOLOv8 model structure provided in Example 1.

[0043] Figure 3 This is a structural diagram of the steel surface defect detection model based on the improved YOLOv8 model provided in Example 1.

[0044] Figure 4 This is the structure diagram of RFCBAMConv provided in Example 2.

[0045] Figure 5 This is a schematic diagram of the Triplet Attention provided in Example 2.

[0046] Figure 6 This is a diagram of the C2f-Triplet structure provided in Example 2.

[0047] Figure 7 This is the Triplet_Bottleneck structure diagram provided in Example 2.

[0048] Figure 8 This is the GSConv structure diagram provided in Example 2.

[0049] Fig. 9 This is the GSEMAConv structure diagram provided in Example 2.

[0050] Fig.10 This is a schematic diagram of EMA Attention provided in Example 2.

[0051] Fig.11 This is the VoVGSEMACSP structure diagram provided in Example 2.

[0052] Fig.12 This is a structural diagram of the GSEMA Bottleneck provided in Example 2.

[0053] Fig.13 This is a structural diagram of a steel surface defect detection system based on improved YOLOv8 provided in Example 3. DETAILED DESCRIPTION

[0054] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;

[0055] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;

[0056] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0057] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0058] Example 1

[0059] like Figure 1 As shown, this embodiment provides a steel surface defect detection method based on improved YOLOv8, comprising the following steps:

[0060] S1: obtaining a steel surface defect dataset and preprocessing it, and dividing the preprocessed steel surface defect dataset into a training set and a test set; the steel surface defect dataset includes a plurality of steel images with different surface defects;

[0061] S2: The YOLOv8 model is selected as the basic model, and the YOLOv8 model is improved. The convolution module of the Backbone part of the YOLOv8 model is replaced with the RFCBAMConv module; the Triplet attention mechanism is introduced in each C2f module of the Backbone part and replaced with the C2f-Triplet module; the convolution module of the Neck part of the YOLOv8 model is replaced with the GSEMAConv module; the VOVGSEMACSP module is constructed based on the GSEMAConv module and each C2f module of the Neck part is replaced to construct a steel surface defect detection model;

[0062] S3: inputting the training set into the steel surface defect detection model for iterative optimization training, and completing the training until the value of the preset total loss function is lower than the preset threshold, thereby obtaining a trained steel surface defect detection model;

[0063] S4: Input the test set into the trained steel surface defect detection model to perform defect detection, and obtain the defect detection result of each steel image in the test set.

[0064] In the specific implementation process, firstly, a steel surface defect dataset is obtained and preprocessed, and the preprocessed steel surface defect dataset is divided into a training set and a test set; in this embodiment, the steel surface defect dataset includes a plurality of steel images with different surface defects;

[0065] Then, the YOLOv8 model is selected as the basic model, and the YOLOv8 model is improved to build a steel surface defect detection model;

[0066] This embodiment uses the single-stage detection algorithm YOLOv8 as the basic model. Figure 2 The figure shows the basic structure of the YOLOv8 model. YOLOv8 currently has five versions: n, s, m, l, and x. They differ in network depth, width, number of parameters, and amount of computation to meet different application requirements and computing resource constraints.

[0067] exist Figure 2 In the structure, the YOLOv8 model consists of three parts: Backbone, Neck and Head:

[0068] Backbone is mainly responsible for extracting high-level semantic features from the input image. The C2f structure combines the advantages of the residual structure and the ELAN structure, adjusts the number of channels and residual connections, achieves lightweight design and rich gradient flow information, and thus improves the feature extraction capability.

[0069] Neck is used to further integrate and adjust the features extracted by Backbone, which is conducive to fusing features at different levels and thus improving the network's ability to perceive targets. At the same time, it uses top-down and bottom-up path aggregation strategies to significantly improve the performance of target detection through multi-scale feature fusion and enhanced feature representation.

[0070] The head part includes a bounding box regression layer and a classification layer, which are responsible for predicting the target position and category respectively. The decoupled head structure is used to separate the classification prediction and the bounding box regression prediction, and detect them in parallel at different scales. At the same time, it is transformed from Anchor-Based to Anchor-Free to reduce the number of parameters and computational complexity, and enhance the generalization ability of the algorithm.

[0071] Due to the diversity and complexity of steel defect types, steel surface defect detection technology is easily interfered by background noise and defect characteristics, which makes it difficult to capture complex details, identify defect areas incorrectly, and have low detection accuracy. In order to improve the performance of defect detection models, ensure that accuracy is improved while reducing the number of parameters and enhance the generalization of the model, such as Figure 3 As shown, this embodiment is improved based on the YOLOv8 model to build a steel surface defect detection model;

[0072] In the Backbone part, this embodiment replaces the original convolution module with the RFCBAMConv module, and introduces the Triplet attention mechanism to improve the C2f module;

[0073] In the Neck part, GSConv is improved and integrated with the EMA attention mechanism to obtain GSEMAConv, and GSEMAConv is used to replace the convolution module in the Neck part. Then, based on GSEMAConv, the lightweight structure of GSEMA_bottleneck and VoVGSEMACSP is introduced to improve the C2f module in the Neck part.

[0074] After building a steel surface defect detection model based on the improved YOLOv8 model, the training set is input into the steel surface defect detection model for iterative optimization training until the value of the preset total loss function is lower than the preset threshold, and the training is completed to obtain the trained steel surface defect detection model;

[0075] Finally, the test set is input into the trained steel surface defect detection model for defect detection, and the defect detection results of each steel image in the test set are obtained;

[0076] This method effectively compensates for the limitations of the steel surface defect detection model under background noise and the defects themselves by introducing the RFCBAMConv module, the Triplet attention mechanism and the GSEMAConv module; specifically, the RFCBAMConv module enhances the algorithm's ability to capture local features; the Triplet attention mechanism optimizes the feature extraction process and effectively improves the algorithm's recognition of multi-dimensional features; the GSEMAConv and VOVGSEMACSP modules further improve the algorithm's detection accuracy and reduce the number of parameters through multi-scale attention mechanism and parameter optimization.

[0077] Example 2

[0078] This embodiment provides a steel surface defect detection method based on improved YOLOv8, comprising the following steps:

[0079] S1: obtaining a steel surface defect dataset and preprocessing it, and dividing the preprocessed steel surface defect dataset into a training set and a test set; the steel surface defect dataset includes a plurality of steel images with different surface defects;

[0080] S2: The YOLOv8 model is selected as the basic model, and the YOLOv8 model is improved. The convolution module of the Backbone part of the YOLOv8 model is replaced with the RFCBAMConv module; the Triplet attention mechanism is introduced in each C2f module of the Backbone part and replaced with the C2f-Triplet module; the convolution module of the Neck part of the YOLOv8 model is replaced with the GSEMAConv module; the VOVGSEMACSP module is constructed based on the GSEMAConv module and each C2f module of the Neck part is replaced to construct a steel surface defect detection model;

[0081] S3: inputting the training set into the steel surface defect detection model for iterative optimization training, and completing the training until the value of the preset total loss function is lower than the preset threshold, thereby obtaining a trained steel surface defect detection model;

[0082] S4: inputting the test set into the trained steel surface defect detection model to perform defect detection, and obtaining the defect detection result of each steel image in the test set;

[0083] In the step S1, the preprocessing includes: cutting all steel images in the steel surface defect data set into a uniform size and converting them into grayscale images respectively;

[0084] Manually mark the surface defects in each grayscale image to complete the preprocessing;

[0085] In the step S2, the structure of the RFCBAMConv module includes: a first branch and a second branch arranged in parallel, a weight redistribution layer and a first convolution layer;

[0086] The first branch includes: a global average pooling layer, a first linear layer, a first ReLU activation layer, a second linear layer and a first Sigmoid activation layer connected in sequence; the output of the first Sigmoid activation layer is used as the output of the first branch;

[0087] The second branch includes: a grouped convolution layer, a normalization layer, a second ReLU activation layer and a tensor shape adjustment layer connected in sequence, the output of the tensor shape adjustment layer is connected in sequence to an average pooling layer, a maximum pooling layer, a second convolution layer and a second Sigmoid activation layer; the outputs of the tensor shape adjustment layer and the second Sigmoid activation layer are used together as the output of the second branch;

[0088] Input the outputs of the first branch and the second branch into the weight redistribution layer, and after the output of the weight redistribution layer passes through the first convolution layer, obtain the output of the RFCBAMConv module;

[0089] In step S2, the introduction of the Triplet attention mechanism in each C2f module of the Backbone backbone includes:

[0090] Replace the original Bottleneck blocks in each C2f module of the Backbone with Triplet_Bottleneck blocks to build a C2f-Triplet module.

[0091] The structure of the Triplet_Bottleneck block is as follows: a Triplet attention block is added after the two original convolution blocks in the Bottleneck block; the Triplet attention block includes three parallel branches for calculating the attention weights by interacting the input tensor with three different dimensions;

[0092] In step S2, the structure of the GSEMAConv module includes:

[0093] Taking the GSConv structure as the basic structure, an EMA attention block is added before the shuffle layer in the GSConv structure to obtain a GSEMAConv module;

[0094] In the step S2, the structure of the VOVGSEMACSP module includes: a third convolutional layer, a GSEMA Bottleneck, a fourth convolutional layer, a splicing layer and a fifth convolutional layer;

[0095] The input of the VOVGSEMACSP module passes through two branches, one of which passes through the third convolutional layer and GSEMABottleneck in sequence, and the other passes through the fourth convolutional layer. The outputs of the two branches are spliced ​​through the splicing layer and then input into the fifth convolutional layer. The output of the fifth convolutional layer is used as the output of the VOVGSEMACSP module;

[0096] The structure of the GSEMA Bottleneck includes: a first GSEMAConv module, a second GSEMAConv module and a sixth convolutional layer;

[0097] The first GSEMAConv module and the second GSEMAConv module are connected in sequence, and the sixth convolutional layer is arranged in parallel with the two GSEMAConv modules;

[0098] The output of the second GSEMAConv module and the output of the sixth convolutional layer are weightedly added as the output of the GSEMABottleneck;

[0099] In step S3, the calculation of the total loss function adopts the TaskAlignedAssigner strategy, and the total loss function includes a weighted combination of classification loss and regression loss;

[0100] The classification loss is specifically VFL loss;

[0101] The regression loss includes CIOU loss and DFL loss;

[0102] The total loss function is expressed as:

[0103] L 总 =α·L VFL +β(L CIOU +L DFL )

[0104] Among them, L 总 is the total loss function, L VFL , L CIOU and L DFL are VFL loss, CIOU loss and DFL loss respectively, α and β are the first and second weighting coefficients respectively, satisfying α+β=1;

[0105] The basic model selected in step S2 is specifically the YOLOv8n model.

[0106] In the specific implementation process, the defect detection in this embodiment is implemented based on the Ubuntu 20.04 operating system, the CPU is a 15vCPU Intel(R) Xeon(R) Platinum 8358P, and the GPU used is an NVIDIA RTX 3090 (24GB)*1; the deep learning training architecture used is PyTorch 1.11.0, Python 3.8, and cuba 11.3. The number of iterations (Epochs) is 300, and the batch size is 16;

[0107] Firstly, a steel surface defect dataset is obtained and preprocessed, and the preprocessed steel surface defect dataset is divided into a training set and a test set;

[0108] This example verifies the generalization performance of the model using the NEU-DET, GC10-DET steel surface defect datasets and the DeepPCB printed circuit board dataset;

[0109] The NEU-DET dataset consists of six types of steel surface defects, including cracks (cr), inclusions (in), patches (pa), pitted_surface (ps), rolled-in scale (rs), and scratches (sc); each category has 300 images, a total of 1800 images, each image size is 200×200 grayscale image; the NEU-DET training set and test set are randomly divided into a ratio of 8:2, that is, 1440 training images and 360 test images;

[0110] The GC10-DET dataset consists of 10 steel surface defects, including punching holes (ph), welds (wl), crescent notches (cg), water spots (ws), oil spots (os), silk spots (ss), inclusions (in), rolling pits (rp), creases (cr) and waist folds (wf); GC10-DET has a total of 2294 images, each of which is a 2048×1000 grayscale image; then the GC10-DET training set and test set are split in a ratio of 8:2, that is, 1835 training images and 459 test images; by using grayscale images, the image contrast can be improved, the noise can be reduced, and the image details can be enhanced, thereby minimizing the impact of surface characteristics such as defect reflectivity and roughness;

[0111] DeepPCB is a PCB surface defect dataset from GitHub, which contains 1500 PCB images with six types of surface defects: opening, short circuit, mouse bite, thorn, fake copper and pinhole; all images in this dataset are from linear scan CCD; each original image has 16k×16k pixels, which are cropped into many sub-images of size 640×640 and aligned using template matching technology; DeepPCB training set and test set are split in a ratio of 8:2, that is, 1200 training images and 300 test images;

[0112] The YOLOv8 model is selected as the basic model, and the YOLOv8 model is improved to build a steel surface defect detection model. Its structure is as follows Figure 3 As shown;

[0113] In the Backbone part, this embodiment replaces the original convolution module with the RFCBAMConv module, and introduces the Triplet attention mechanism to improve the C2f module;

[0114] 1)RFCBAMConv module:

[0115] Receptive-Field Attention Convolutional operation (RFAConv) focuses on the receptive field spatial features, focuses on the receptive field of each convolution kernel, generates independent attention weights, and dynamically weights features, effectively solving the problem of traditional convolution parameter sharing and improving the algorithm's sensitivity and expression ability to local features;

[0116] like Figure 4 As shown in the figure, RFCBAMConv is improved on the basis of the original CBAM (Concentration-Based Attention Module), and the spatial attention mechanism is introduced into the spatial features of the receptive field to enhance the model's ability to capture local features; and the CAM attention in RFCBAMConv is replaced by SE attention, which aggregates global channel information by compressing feature maps; the channel dimension and the spatial dimension are weighted at the same time to reduce the computational overhead, and the remote information is considered through global pooling, which not only solves the problem of convolution kernel parameter sharing, but also improves the algorithm's ability to recognize key features;

[0117] In Backbone, RFCBAMConv is used to replace the original Conv. It not only integrates the improved receptive field spatial features, but also combines the channel attention mechanism to comprehensively improve the feature extraction ability of the algorithm from both spatial and channel dimensions. This design captures local details more accurately and enhances the generalization ability of the algorithm.

[0118] 2) C2f-Triplet:

[0119] Steel surface defects vary in shape, size, and distribution location. An image may contain multiple defects. When processing data sets containing background noise, the traditional C2f module suffers from the problem of spatial and channel information loss, resulting in false detection and missed detection, and it is difficult to effectively fuse features of different scales and dimensions. To improve detection efficiency and feature recognition capabilities, this embodiment improves C2f, designs the C2f-Triplet module, and introduces Triplet Attention.

[0120] like Figure 5 As shown in the figure, the triplet attention mechanism consists of three parallel branches. The attention weights are calculated by the interaction of different dimensions through the input tensor X. Z-pool is used to reduce the tensor dimension while retaining the important features of the original channel information to avoid information loss during feature compression.

[0121] The Z-pool formula is:

[0122] Z-pool(χ)=[MaxPool 0d (χ),AvgPool 0d (x)]

[0123] exist Figure 5 There are three branches:

[0124] Branch 1: Captures the interaction between channel C and width W; the input tensor is rotated 90 degrees counterclockwise along the H axis to obtain X1, and then the dimension is reduced by Z-pool, and then the attention weight is generated by the convolution layer, batch normalization and sigmoid activation function to obtain X1*, and finally rotated back to the original shape;

[0125] Branch 2: Capture the interaction between channel C and high H; the input tensor is rotated 90 degrees counterclockwise along the W axis to obtain X1, and the attention weight is generated through the same process to obtain X2* rotated back to the original shape;

[0126] Branch 3: Capture the interaction of spatial dimensions H and W; directly obtain X3 through Z-pool, and then generate attention weights through convolution, batch normalization, and sigmoid activation function to obtain X3*;

[0127] Finally, the attention weighted tensors of the three branches are aggregated by average to form the final tensor y, as follows:

[0128]

[0129] σ is the Sigmoid activation function; ψ 1 , 2 and ψ 3 It is a standard convolution with three branches; the original input tensor is combined with the attention weighted tensor through a residual connection to maintain the information flow and enhance the learning ability of the algorithm;

[0130] like Figure 6 As shown, C2f-Triplet replaces the Bottleneck structure in the original C2f module with Triplet_Bottleneck (as shown in Figure 7 As shown in the figure, the model can recognize features of different dimensions. C2f-Triplet introduces very few additional parameters, which has little impact on the algorithm's computational burden. It enables the algorithm to focus on the most important areas of defects, reduce the interference of background noise, better distinguish between defective and non-defective areas, and enhance the sensitivity to key features to reduce false detection and missed detection rates.

[0131] In the Neck part, GSConv is improved and integrated with the EMA attention mechanism to obtain GSEMAConv, and GSEMAConv is used to replace the convolution module in the Neck part. Then, based on GSEMAConv, the lightweight structure of GSEMA_bottleneck and VoVGSEMACSP is introduced to improve the C2f module in the Neck part.

[0132] 3) GSEMAConv:

[0133] In order to reduce the number of model parameters and the amount of calculation, the Neck part is improved. GSEMAConv is introduced to replace the Conv module of the Neck part. GSEMAConv is a GSConv module that integrates the EMA attention mechanism on the basis of GSConv. Then, the lightweight structure of GSEMA_bottleneck and VoVGSEMACSP is introduced on the basis of GSEMAConv. The VoVGSEMACSP module is used to replace the original C2f module, which can improve the accuracy while reducing the calculation requirements and parameters of the model.

[0134] When convolution transmits spatial information, the compression of spatial dimensions and the expansion of channels often lead to the loss of semantic information; channel-dense convolution retains the connection between channels, while channel-sparse convolution cuts off these connections; Figure 8 As shown in the figure, GSConv retains channel connections as much as possible while maintaining low time complexity, reduces redundant information, and does not need to compress feature maps; GSConv combines the advantages of depthwise separable convolution (DSC) and standard convolution (SC), and enhances the expressiveness of features by introducing DSC and shuffle; the shuffle operation enhances feature interaction by rearranging the channels or features of the data, breaks the data dependency pattern in the convolution layer, and rearranges the channels after grouped convolution to ensure that convolution kernels in different groups capture rich feature information; DSC reduces parameters and calculations by separating convolution operations;

[0135] However, in order to make up for the shortcomings of GSConv in terms of adaptability, this embodiment adds EMA attention to the GSConv structure before shuffle to obtain GSEMAConv, the structure of which is as follows: Fig. 9 As shown, the model can adaptively focus on the key areas in the image, further refine the feature fusion process, and make the feature fusion more refined and selective;

[0136] Efficient Multi-Scale Attention EMA combines the advantages of channel attention and spatial attention, and enhances feature representation through multi-scale and cross-space learning; Fig.10 As shown in the figure, the image information is captured by processing features of different scales in parallel, and the channels are divided into multiple sub-feature groups to enhance the spatial semantic uniformity; the two parallel convolution branches use 1×1 and 3×3 convolution kernels respectively to capture the global information and local spatial features between channels; through the matrix dot product operation, the EMA module aggregates features of different spatial dimensions, captures pixel-level relationships and enhances the global context; 1D and 2D global average pooling operations are used to capture long-range dependencies, and the channel weights are recalibrated in each branch; finally, the feature maps of the parallel branches are fused through cross-dimensional interactive operations to capture richer spatial and inter-channel information; the problem of difficult feature extraction in the steel defect dataset is solved, and the integration of EMA into GSConv can avoid the loss of defect information leading to incorrect positioning and recognition, so that the algorithm can adaptively focus on the key areas in the image and refine the feature fusion process;

[0137] 4)VoVGSEMACSP:

[0138] like Fig.11 As shown in the figure, GSEMAConv is used to transform the Bottleneck in the C2f module, and the VoVGSEMACSP is designed by a one-time aggregation method, which can better fuse features; the modified C2f module mainly replaces the Bottleneck in the original module with GSEMAbottleneck to improve the reasoning speed and algorithm performance; Fig.12 As shown in the figure, in the GSEMA bottleneck, the two original convolutions are replaced by GSEMAConv, which can fuse the residual information; the VoVGSEMACSP structure optimizes the performance and efficiency of the algorithm in identifying defect details through efficient feature aggregation and enhancement mechanism, while reducing the computational burden and the number of parameters;

[0139] After the model is built, the training set is input into the steel surface defect detection model for iterative optimization training until the value of the preset total loss function is lower than the preset threshold, and the training is completed to obtain the trained steel surface defect detection model;

[0140] In this embodiment, the TaskAlignedAssigner positive sample allocation strategy is used in loss calculation, which is a weighted combination of three loss functions: classification loss VFL (Varifocal Loss) and regression loss CIOU (Complete-IOU) + DFL (Deep Feature Loss); VFL is used as a classification loss function to deal with the problem of class imbalance and enhance the focus on high-quality positive samples; DFL helps to optimize the model's learning of unbalanced data sets;

[0141] CIOU is an improved IoU (Intersection over Union) loss function that not only considers the overlap between the predicted box and the true box, but also the distance and aspect ratio difference of the center point. CIOU improves the matching accuracy between the predicted box and the true box by introducing more geometric information, thereby improving the positioning ability of the model. DFL is a deep feature loss used to optimize the learning ability of the model on unbalanced data sets. It enables the model to better learn the detailed features in the unbalanced data by optimizing the deep features, thereby improving the generalization ability of the model on such data sets. The combination of CIOU (Complete-IOU) and DFL (Deep Feature Loss) is often referred to as the regression loss function of the target detection model. This combination enhances the overall performance of the model by using CIOU for bounding box regression (positioning) and optimizing the feature expression ability of the model through DFL.

[0142] The formula for DFL loss is as follows:

[0143] DFL(P i ,P i+1 )=-((y i+1 -y)log(P i )+(yy i )log(P i+1 ))

[0144] Finally, the test set is input into the trained steel surface defect detection model for defect detection, and the defect detection results of each steel image in the test set are obtained;

[0145] In this embodiment, the commonly used evaluation indicators in deep learning are used to evaluate the model performance, including precision (Precision, P), recall (Recall, R), mAP (Mean Average Precision), parameter quantity (Params) and GFLOPs and other evaluation indicators to comprehensively evaluate the model; the relevant formula is as follows:

[0146]

[0147] Among them, TP represents the number of true positive examples, FP represents the number of false positive examples, and FN represents the number of false negative examples;

[0148] Precision (P) refers to the proportion of actual positive samples among all samples predicted as positive by the algorithm; the higher the accuracy, the lower the probability that the algorithm will mistakenly predict a negative sample as a positive sample; recall (R) refers to the number of samples that are actually positive that are correctly predicted as positive by the algorithm; a higher recall indicates that the algorithm is better at identifying positive samples; mean average precision (mAP) is calculated by calculating the average precision of each category and then averaging the precision of all categories, which can measure the performance of the algorithm under different confidence thresholds; a higher mAP value indicates a higher overall accuracy of the algorithm in the detection task; GFLOP stands for one billion floating-point operations that can be performed per second; it is used to measure the complexity and processing speed of computing tasks. A higher GFLOPs value means that the algorithm has a higher computational complexity and needs to perform more floating-point operations;

[0149] In order to verify the effectiveness of the improvement strategy proposed in this embodiment, an ablation experiment was conducted; the experiment used YOLOv8n as the basic model for improvement, and the results are shown in Table 1; in the table, A, B, and C represent the addition of RFCBAMConv module, C2f-Triplet module, and improved Neck part, respectively, and the symbol √ represents the adoption of the improvement point;

[0150] Table 1 Ablation experiment results

[0151]

[0152] According to the ablation experiment results in Table 1, each group of experiments was analyzed and discussed in detail; the specific situation and conclusions of each group of experiments are as follows:

[0153] In the first group, the mAP@0.5 value of the baseline group (YOLOv8n) is 78%, which is used as a baseline model to compare the effects of other improved methods; in the second group of experiments, the RFCBAMConv module replaced the Conv part in the backbone network, and the mAP@0.5 increased by 1.8% with only a small increase in the amount of calculation. This shows that the RFCBAMConv module can extract richer and more discriminative features, thereby optimizing the detection accuracy of the model; in the third group of experiments, at the expense of a small amount of calculation, the Triplet attention was integrated into the C2f module in the backbone network, and the mAP@0.5 increased by 1.7%; it enables the model to effectively capture the interaction between different dimensions in the input feature map, thereby improving various performance indicators; the fourth group of experiments introduced the GSEMAConv module in the neck part to improve Conv and C2f. The results show that the amount of calculation and the amount of parameters have been reduced, the number of parameters is 2.7M, the GFLOPs is 7.2, and the mAP@0.5 has increased by 1.8%. This shows that this improvement significantly improves the performance of the model while reducing the number of parameters. The fifth group of experiments added the improved methods of the second and third groups to the model at the same time. Compared with the baseline model, the number of parameters remained unchanged, the amount of calculation increased, but mAP@0.5 increased by 2.7%. This shows that this improved method effectively improves the detection accuracy; the sixth group of experiments added the modules of the second and fourth groups to the model at the same time. The experimental results showed that the number of parameters and GFLOPs were reduced, and mAP@0.5 increased by 2.8%; this shows that while reducing the number of parameters, the detection accuracy was significantly improved; the seventh group of experiments added the modules of the third and fourth groups to the model at the same time. The experimental results showed that the number of parameters and GFLOPs were reduced, and mAP@0.5 increased by 2.9%; similar to the sixth group, this combination further improved the detection accuracy while reducing the number of parameters; finally, the eighth group of experiments added different improved methods of the fifth, sixth, and seventh groups to the model at the same time. The results showed that the number of parameters and the amount of calculation were reduced, and mAP@0.5 increased by 3.3%; this comprehensive improvement method significantly enhanced the ability to distinguish and express features of different defects, improved the ability to distinguish defect areas, improved the accuracy and recognition of defect detection, and achieved the goal of reducing the number of parameters while improving accuracy. It is suitable for the detection task of steel surface defects;

[0154] Through these experiments, we can see that different improvement methods have their own advantages in improving model detection accuracy and reducing the number of parameters; the comprehensive application of these improvement methods can further optimize the performance of the model and make it better adapt to actual application scenarios;

[0155] In order to further verify the generalization of the model in this embodiment, the baseline algorithm and the model in this embodiment are respectively subjected to generalization experiments on the GC10-DET dataset and the DeepPCB dataset; the experimental settings are kept consistent, and the experimental results are shown in Tables 2 and 3;

[0156] Table 2 Generalization experiments on the GC10-DET dataset

[0157] Model mAP@0.5(%) Params / M GFLOPs Baseline 62.5 3.00 8.1 Ours 64.7 2.75 7.6

[0158] Table 3 Generalization experiments on the DeepPCB dataset

[0159] Model mAP@0.5(%) Params / M GFLOPs Baseline 96 3.00 8.1 Ours 98.9 2.75 7.6

[0160] According to the experimental results in Table 2, on the GC10-DET dataset, the model proposed in this paper improves mAP by 2.2% compared with the baseline model, reduces the number of parameters from 3M to 2.75M, and reduces the amount of calculation from 8.1GFLOPs to 7.6GFLOPs;

[0161] According to the experimental results in Table 3, on the DeepPCB dataset, the model mAP increased by 2.9%, the number of parameters was reduced from 3M to 2.75M, and the amount of calculation was reduced from 8.1GFLOPs to 7.6GFLOPs;

[0162] Therefore, the model proposed in this embodiment significantly improves the detection accuracy on both GC10-DET and DeepPCB datasets, and effectively reduces the number of parameters and calculations, showing good generalization and efficiency;

[0163] In addition, in order to verify the performance comparison of the proposed model with other models, experiments were conducted on the NEU-DET dataset. The experimental results are shown in Table 4.

[0164] Table 4 Comparison with current advanced target detection models on the NEU-DET dataset

[0165]

[0166] From Table 4, it can be seen that the algorithm proposed in this embodiment achieves the highest 81.8% on mAP@0.5. Although the precision is slightly lower than YOLOv8s, it is better than YOLOv8s in both mAP and recall. The recall rate is only 1.9% lower than YOLOv5s, and the number of parameters is 0.1M more than YOLOv10n, but it is better than YOLOv5s and YOLOv10n in other performance indicators. Compared with the benchmark model, the model in this embodiment has obvious advantages in mAP, computational complexity, detection accuracy and recall, but the number of parameters is only 0.3M lower than the benchmark, and there is still room for improvement in the number of parameters. In terms of overall performance, the algorithm of this embodiment is better than other algorithms.

[0167] Comprehensively considering various indicators, the steel surface defect detection model proposed in this embodiment maintains excellent detection accuracy and generalization while reducing the amount of calculation, reflecting its high versatility and practical value in the steel surface defect detection task;

[0168] This embodiment effectively compensates for the limitations of the steel surface defect detection model under background noise and the defects themselves by introducing the RFCBAMConv module, the Triplet attention mechanism and the GSEMAConv module; specifically, the RFCBAMConv module enhances the algorithm's ability to capture local features; the Triplet attention mechanism optimizes the feature extraction process and effectively improves the algorithm's recognition of multi-dimensional features; the GSEMAConv and VOVGSEMACSP modules further improve the algorithm's detection accuracy and reduce the number of parameters through multi-scale attention mechanisms and parameter optimization;

[0169] The model of this embodiment improves the mAP@0.5 values ​​by 2.2% and 2.9% on the GC10-DET and DeepPCB datasets, respectively, while significantly reducing the number of parameters and computational complexity of the model, demonstrating the generalization ability of the model in defect detection of different sizes and complexity; in addition, on the NEU-DET dataset, the model of this invention achieves 81.8% in the mAP@0.5 index. Although the number of parameters is slightly higher than that of some benchmark models, it still maintains a high advantage in comprehensive performance. Compared with the benchmark, the detection accuracy and recall rate are increased by 2% and 2.9%, respectively, demonstrating that the model of this embodiment has improved in missed detection and false detection, and has better feature recognition and positioning capabilities;

[0170] In summary, the improved model proposed in this embodiment not only significantly improves the accuracy and generalization of steel surface defect detection, but also effectively reduces the complexity and resource requirements of the model. Compared with the existing model, this model improves the accuracy of steel surface defect detection while reducing the number of parameters, and has the potential to be widely promoted in actual industrial applications.

[0171] Example 3

[0172] like Fig.13 As shown, this embodiment provides a steel surface defect detection system based on improved YOLOv8, and applies the above-mentioned steel surface defect detection method based on improved YOLOv8, including:

[0173] Preprocessing unit 301: used to obtain and preprocess a steel surface defect dataset, and divide the preprocessed steel surface defect dataset into a training set and a test set; the steel surface defect dataset includes a plurality of steel images with different surface defects;

[0174] Model construction unit 302: used for selecting the YOLOv8 model as the basic model, and improving the YOLOv8 model, replacing the convolution module of the Backbone part of the YOLOv8 model with the RFCBAMConv module; introducing the Triplet attention mechanism in each C2f module of the Backbone part and replacing it with a C2f-Triplet module; replacing the convolution module of the Neck part of the YOLOv8 model with a GSEMAConv module; constructing a VOVGSEMACSP module based on the GSEMAConv module and replacing each C2f module of the Neck part to construct a steel surface defect detection model;

[0175] Model training unit 303: used for inputting the training set into the steel surface defect detection model for iterative optimization training, until the value of the preset total loss function is lower than the preset threshold value, the training is completed, and the trained steel surface defect detection model is obtained;

[0176] The defect detection unit 304 is used to input the test set into the trained steel surface defect detection model to perform defect detection, and obtain the defect detection result of each steel image in the test set.

[0177] In the specific implementation process, first, the preprocessing unit 301 obtains and preprocesses the steel surface defect dataset, and divides the preprocessed steel surface defect dataset into a training set and a test set; in this embodiment, the steel surface defect dataset includes a plurality of steel images with different surface defects;

[0178] Then the model building unit 302 selects the YOLOv8 model as the basic model, and improves the YOLOv8 model to build a steel surface defect detection model;

[0179] After building a steel surface defect detection model based on the improved YOLOv8 model, the model training unit 303 inputs the training set into the steel surface defect detection model for iterative optimization training until the value of the preset total loss function is lower than the preset threshold, and the training is completed to obtain the trained steel surface defect detection model;

[0180] Finally, the defect detection unit 304 inputs the test set into the trained steel surface defect detection model to perform defect detection, and obtains the defect detection result of each steel image in the test set;

[0181] By introducing the RFCBAMConv module, Triplet attention mechanism and GSEMAConv module, this system effectively compensates for the limitations of the steel surface defect detection model under background noise and the defects themselves, improves the detection accuracy while reducing the number of parameters, and is more generalizable.

[0182] The same or similar reference numerals correspond to the same or similar components;

[0183] The terms used in the drawings to describe positional relationships are only used for illustrative purposes and should not be construed as limiting this patent;

[0184] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.

Claims

1. A steel surface defect detection method based on improved YOLOv8, characterized in that: The following steps are involved: S1: obtaining a steel surface defect dataset and preprocessing it, and dividing the preprocessed steel surface defect dataset into a training set and a test set; the steel surface defect dataset includes a plurality of steel images with different surface defects; S2: The YOLOv8 model is selected as the basic model, and the YOLOv8 model is improved. The convolution module of the Backbone part of the YOLOv8 model is replaced with the RFCBAMConv module; the Triplet attention mechanism is introduced in each C2f module of the Backbone part and replaced with the C2f-Triplet module; the convolution module of the Neck part of the YOLOv8 model is replaced with the GSEMAConv module; the VOVGSEMACSP module is constructed based on the GSEMAConv module and each C2f module of the Neck part is replaced to construct a steel surface defect detection model; S3: inputting the training set into the steel surface defect detection model for iterative optimization training, and completing the training until the value of the preset total loss function is lower than the preset threshold, thereby obtaining a trained steel surface defect detection model; S4: Input the test set into the trained steel surface defect detection model to perform defect detection, and obtain the defect detection result of each steel image in the test set.

2. According to claim 1, a steel surface defect detection method based on improved YOLOv8 is characterized in that: In the step S1, the preprocessing includes: cutting all steel images in the steel surface defect data set into a uniform size and converting them into grayscale images respectively; The surface defects in each grayscale image are manually labeled to complete the preprocessing.

3. The steel surface defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: In the step S2, the structure of the RFCBAMConv module includes: a first branch and a second branch arranged in parallel, a weight redistribution layer and a first convolution layer; The first branch includes: a global average pooling layer, a first linear layer, a first ReLU activation layer, a second linear layer and a first Sigmoid activation layer connected in sequence; the output of the first Sigmoid activation layer is used as the output of the first branch; The second branch includes: a grouped convolution layer, a normalization layer, a second ReLU activation layer and a tensor shape adjustment layer connected in sequence, the output of the tensor shape adjustment layer is connected in sequence to an average pooling layer, a maximum pooling layer, a second convolution layer and a second Sigmoid activation layer; the outputs of the tensor shape adjustment layer and the second Sigmoid activation layer are used together as the output of the second branch; The outputs of the first branch and the second branch are input into the weight redistribution layer together, and the output of the weight redistribution layer passes through the first convolution layer to obtain the output of the RFCBAMConv module.

4. The steel surface defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: In step S2, the introduction of the Triplet attention mechanism in each C2f module of the Backbone backbone includes: Replace the original Bottleneck blocks in each C2f module of the Backbone with Triplet_Bottleneck blocks to build a C2f-Triplet module. The structure of the Triplet_Bottleneck block is as follows: a Triplet attention block is added after the two original convolution blocks in the Bottleneck block; the Triplet attention block includes three parallel branches, which are used to calculate the attention weight of the input tensor by interacting with three different dimensions.

5. The steel surface defect detection method based on improved YOLOv8 according to claim 1, characterized in that: In step S2, the structure of the GSEMAConv module includes: Taking the GSConv structure as the basic structure, an EMA attention block is added before the shuffle layer in the GSConv structure to obtain a GSEMAConv module.

6. A steel surface defect detection method based on improved YOLOv8 according to claim 5, characterized in that: In step S2, the structure of the VOVGSEMACSP module includes: a third convolutional layer, a GSEMABottleneck, a fourth convolutional layer, a splicing layer and a fifth convolutional layer; The input of the VOVGSEMACSP module passes through two branches, one passes through the third convolutional layer and GSEMABottleneck in sequence, and the other passes through the fourth convolutional layer. The outputs of the two branches are spliced ​​through the splicing layer and input into the fifth convolutional layer. The output of the fifth convolutional layer is used as the output of the VOVGSEMACSP module.

7. A steel surface defect detection method based on improved YOLOv8 according to claim 6, characterized in that: The structure of the GSEMA Bottleneck includes: a first GSEMAConv module, a second GSEMAConv module and a sixth convolutional layer; The first GSEMAConv module and the second GSEMAConv module are connected in sequence, and the sixth convolutional layer is arranged in parallel with the two GSEMAConv modules; The output of the second GSEMAConv module and the output of the sixth convolutional layer are weightedly added as the output of the GSEMABottleneck.

8. The steel surface defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: In step S3, the calculation of the total loss function adopts the TaskAlignedAssigner strategy, and the total loss function includes a weighted combination of classification loss and regression loss; The classification loss is specifically VFL loss; The regression loss includes CIOU loss and DFL loss.

9. A steel surface defect detection method based on improved YOLOv8 according to any one of claims 1 to 8, characterized in that: The basic model selected in step S2 is specifically the YOLOv8n model.

10. A steel surface defect detection system based on improved YOLOv8, applying the steel surface defect detection method based on improved YOLOv8 as described in any one of claims 1 to 9, characterized in that: include: Preprocessing unit: used for acquiring and preprocessing a steel surface defect data set, and dividing the preprocessed steel surface defect data set into a training set and a test set; The steel surface defect dataset includes a plurality of steel images with different surface defects; Model building unit: used for selecting the YOLOv8 model as the basic model, and improving the YOLOv8 model, replacing the convolution module of the Backbone part of the YOLOv8 model with the RFCBAMConv module; introducing the Triplet attention mechanism in each C2f module of the Backbone part and replacing it with a C2f-Triplet module; replacing the convolution module of the Neck part of the YOLOv8 model with a GSEMAConv module; building a VOVGSEMACSP module based on the GSEMAConv module and replacing each C2f module of the Neck part to build a steel surface defect detection model; Model training unit: used for inputting the training set into the steel surface defect detection model for iterative optimization training, until the value of the preset total loss function is lower than the preset threshold value, the training is completed, and the trained steel surface defect detection model is obtained; Defect detection unit: used to input the test set into the trained steel surface defect detection model for defect detection, and obtain the defect detection result of each steel image in the test set.