A steel plate surface defect detection method and system based on semi-supervised learning

By improving the YOLOv5 network model and combining it with semi-supervised learning technology, the problem of dependence on labeling and slow detection speed in steel plate defect detection is solved, and fast, real-time, and high-precision steel plate defect detection is achieved.

CN116863274BActive Publication Date: 2024-09-20YANSHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310869580.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-17
Publication Date
2024-09-20
Estimated Expiration
2043-07-17

AI Technical Summary

Technical Problem

Existing steel plate defect detection methods rely on fully supervised training, requiring a large number of labels, and semi-supervised target detection methods are slow in detection and cannot meet real-time detection requirements.

Method used

A steel plate surface defect detection method based on semi-supervised learning is used to improve the YOLOv5 network model. Through data enhancement and pseudo-label balancing strategies, the labeling cost is reduced and the model accuracy is improved. It is trained on the NEU-DET hot-rolled steel plate surface defect public data set. .

Benefits of technology

It achieves fast, real-time and high-precision detection of steel plate defects, reduces the dependence on a large number of labeled samples, and improves the accuracy of the model during the training process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116863274B
    Figure CN116863274B
Patent Text Reader

Abstract

The invention discloses a steel plate surface defect detection method and system based on semi-supervised learning, which belongs to the technical field of steel plate defect detection, including defect image acquisition, construction of defect image data set; dividing the defect image database into a labeled data set and an unlabeled data set; dividing the labeled data set into a training set and a verification set, and performing data enhancement processing on the training set; establishing an improved yolov5 network model ECS-yolov5; using ECS-yolov5 as a semi-supervised detection model; acquiring real-time video and processing it, and applying a semi-supervised detection model to achieve real-time defect detection; a defect data storage module stores the detected defect data, and regularly uses new defect data to update the semi-supervised detection model parameters. The present invention can make the process of steel plate defect detection more convenient and simple, reduce the dependence on a large number of labeled samples, and the model accuracy can be more and more accurate during the training process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of steel plate defect detection, and in particular to a steel plate surface defect detection method and system based on semi-supervised learning. Background Art

[0002] The quality inspection of steel surface is an important part of the process to ensure the quality of steel. According to statistics, more than 60% of the quality objections of domestic plate and strip steel users are caused by surface defects. How to improve the inspection speed and accuracy of the surface inspection system has always been a research hotspot in this field. At present, machine vision inspection is gradually replacing traditional inspection methods. The Chinese invention patent "A steel plate surface damage detection device and method" (CN116046884A) invents a steel plate surface damage detection device and method. The invention discloses a steel plate surface damage detection device. The device scans the steel plate surface at high speed to obtain a three-dimensional model of the steel plate surface. The computer determines the damage information of the steel plate based on the original undamaged steel plate surface data and the received detection data. The device has a simple structure and a simple and easy detection method. It can perform dynamic, real-time, and high-precision automatic detection and judgment. The Chinese invention patent "A defect detection method based on deep learning semantic segmentation" (CN110473173A) invents a defect detection method based on deep learning semantic segmentation. The method performs object surface defect detection based on a trained deep learning semantic segmentation defect detection model. However, the method disclosed in the patent document requires manual annotation of the surface defect image, which is time-consuming and labor-intensive and easily affected by human subjectivity. The Chinese invention patent "Fast R-CNN (Fast Region-based Convolutional Neural Network Based on Attention)" (CN110473173A) invents a defect detection method based on deep learning semantic segmentation. The method performs object surface defect detection based on a trained deep learning semantic segmentation defect detection model. However, the method disclosed in the patent document requires manual annotation of the surface defect image, which is time-consuming and labor-intensive and easily affected by human subjectivity. The Chinese invention patent "Real-time detection system for steel plate defects based on embedded edge platform" (CN115619718A) invents a real-time detection system and method for steel plate defects based on embedded edge platform, including image acquisition module, embedded edge computing platform, defect calibration module and cloud storage / computing platform. By selecting lightweight models and combining them with appropriate compression, deep learning algorithm models can be easily and efficiently deployed on the edge computing platform to realize real-time detection of strip surface defects.

[0003] However, the current mainstream research on steel plate defect detection mainly relies on fully supervised training, but this requires a large number of labeled labels. In actual steel plate production, the probability of various defect samples appearing is low, which makes it difficult to collect enough defect samples of various types in a short time. Labeling these samples one by one is very time-consuming and labor-intensive. Therefore, directly applying the mainstream defect detection algorithm based on supervised learning cannot solve this problem well. Most of the current semi-supervised target detection methods are based on algorithms such as Faster R-CNN. They are a two-stage target detection algorithm, which has the problem of slow detection speed and cannot perform real-time detection. The present invention proposes a steel plate surface defect detection method based on semi-supervised learning, which adopts YOLOv5 as the fully supervised model, and is improved in combination with semi-supervised learning technology. It has a faster detection speed and can meet real-time requirements. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a steel plate surface defect detection method and system based on semi-supervised learning, which can make the steel plate defect detection process more convenient and simple, reduce the dependence on a large number of labeled samples, and the model accuracy can become more and more accurate during the training process.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] S1. Collect defect images and build a defect image dataset;

[0007] S2, dividing the defect image database into a labeled data set and an unlabeled data set;

[0008] S3, divide the labeled data set into a training set and a validation set, and perform data augmentation on the training set;

[0009] S4, establish the improved yolov5 network model ECS-yolov5;

[0010] S5, use ECS-yolov5 as a semi-supervised detection model;

[0011] S6, the video acquisition module collects and processes real-time video, and applies a semi-supervised detection model to achieve real-time defect detection;

[0012] S7. The defect data storage module stores the above detected defect data and regularly uses new defect data to update the parameters of the semi-supervised detection model.

[0013] A further improvement of the technical solution of the present invention is that: in S2, the labeled data set contains all types of defects and the number of each type of defect data is the same, and the ratio of the labeled data set to the unlabeled data set is 1:5.

[0014] The further improvement of the technical solution of the present invention is that: in S4, the improved yolov5 network model structure includes Backbone, Neck and Head;

[0015] S4 specifically includes the following steps:

[0016] S4.1 In Backbone, an attention layer ECA (Efficient Channel Attention) module is added to the C3 module, that is, the original C3 module is replaced with the newly formed C3ECA module;

[0017] In S4.2, in Neck, a lightweight upsampling operator CARAFE (Content-Aware ReAssembly of Features) module is introduced to replace the nearest bilinear upsampling operator in the upsampling module;

[0018] S4.3 replaces the regression loss function of the yolov5 model from CIoU to SIoU; the SIoU loss function consists of four parts: angle loss ∧, distance loss Δ, shape loss Ω, and IOU loss. The IOU loss is the intersection-over-union loss, which is expressed as follows:

[0019]

[0020] The SIoU loss function formula is as follows:

[0021]

[0022] A further improvement of the technical solution of the present invention is that: S5 specifically includes the following steps:

[0023] In the initialization phase of the S5.1 model, the labeled dataset is trained with ECS-yolov5 to generate effective pseudo labels for the subsequent teacher model;

[0024] S5.2: In the teacher-student mutual learning stage, ECS-yolov5 is used as the teacher model and student model in the semi-supervised detection framework. The teacher generates pseudo labels for training students. The student model gradually updates the parameters of the teacher model through EMA (Exponential Moving Average), updates the student model parameters with the total loss, and compares the student model results. The best student model is selected as the target model for the final detection.

[0025] A further improvement of the technical solution of the present invention is that S5.2 specifically includes the following steps:

[0026] S5.2.1 Student model training;

[0027] The labeled data and unlabeled data are enhanced, and the enhanced data is sent to the student model for training;

[0028] S5.2.2 Teacher model training;

[0029] Weakly enhance the labeled data and send it to the teacher model for reasoning. Set the pseudo-label generated by the threshold. The threshold method is the dynamic threshold method. The dynamic threshold method is to set an initial threshold first and then adjust it according to the actual situation. The dynamic threshold method can dynamically adjust the detection threshold according to the actual situation to ensure the accuracy and reliability of the detection results.

[0030] S5.2.3 introduces a pseudo-label balancing strategy in the teacher-student model; introduces a label balancing strategy to balance the number of pseudo-labels generated in each category, and then mixes the pseudo-labels with the labeled data to expand the labeled data set;

[0031] S5.2.4 Calculate optimization loss;

[0032] Student model training This step mainly uses labeled images and unlabeled images to update the student model. The labeled images are trained by the student model to obtain predicted values ​​and compared with the true labels to calculate the classification loss and bounding box regression loss. This part of the loss can be regarded as a supervised loss. For the unlabeled loss, it is defined as The optimization loss of the student network can be defined as:

[0033]

[0034] is the supervised loss, is the unsupervised loss, λ is the coefficient that balances the supervised loss and the unsupervised loss;

[0035] Monitoring loss Contains classification loss Bounding Box Regression Loss and confidence loss The monitoring loss is defined as:

[0036]

[0037] The classification loss With confidence loss As a cross-entropy loss CE (Cross-Entropy Loss), their calculation formula is:

[0038]

[0039]

[0040] Among them, x l represents the labeled sample, y cls With y loc Indicates its label, N L Represents the number of labeled samples; the formula for cross entropy loss is:

[0041]

[0042] Among them, x represents the sample, y represents the label, a represents the predicted output, and n represents the total number of samples;

[0043] In terms of bounding box regression, SIOU loss is used for bounding box regression:

[0044]

[0045] For unlabeled data, we define the unlabeled sample loss as :

[0046]

[0047] in, are pseudo labels generated by the teacher model;

[0048] S5.2.5 Student model update;

[0049] The student model is updated using labeled samples and unlabeled samples. The labeled samples are predicted by the student model and the classification loss is calculated with the true label. The unlabeled samples are first obtained by the teacher model to obtain pseudo labels. The student model is optimized by using the pseudo labels generated by the teacher, and the difference between the student model prediction value and the teacher model pseudo label is calculated as the consistency loss. The update of the student model is shown in the following formula:

[0050]

[0051] Among them, γ is the learning rate, θ s are the parameters of the student model;

[0052] S5.2.6 Teacher model update;

[0053] The student model parameters gradually update the teacher model parameters through EMA. The update of the teacher model parameters can be regarded as the fine-tuning of the teacher model by the student model after each iteration to update the parameters, so that the teacher model can update the model parameters at each step in each epoch:

[0054] θ t ←αθ t +(1-α)θ s

[0055] θ t is the teacher model parameter, θ s is the student model parameter, α is a hyperparameter that determines the speed of parameter transmission, which is usually close to 1;

[0056] S5.2.7 Repeat the above steps and test the student model with the test data, and select the student model corresponding to the best test result as the final detection model.

[0057] A further improvement of the technical solution of the present invention is that in S7, the new defect data are all unlabeled data.

[0058] A steel plate surface defect detection system based on semi-supervised learning, including a video acquisition module, an image detection and marking module and a defect data storage module:

[0059] The video acquisition module is a camera device, which is fixedly arranged above and below one lateral side of the steel plate conveying device to obtain real-time images of the steel plate surface and transmit the images to the server in real time;

[0060] The image detection and marking module stores a semi-supervised detection model, performs real-time detection on the steel plate surface image acquired by the video acquisition module, and obtains defect information and defect images, wherein the defect information includes defect classification, defect coordinates, and defect quantity;

[0061] The defect data storage module transmits the defect information and defect image obtained by the image detection module to the defect calibration module and stores them so as to subsequently train the model and improve the model accuracy.

[0062] Due to the adoption of the above technical solution, the technical progress achieved by the present invention is:

[0063] 1. The present invention improves the network structure ECS-yolov5 of yolov5, and ECS-yolov5 improves the Backbone, Neck, and Head parts of yolov5. A supervised algorithm is used to improve the accuracy of steel plate surface defect detection model training on the NEU-DET hot-rolled steel plate surface defect public dataset.

[0064] 2. The present invention improves the semi-supervised model, first uses the ECS-yolov5 network for training as labeled data, and uses ECS-yolov5 as the training framework in the teacher-student model, thereby realizing the use of a small amount of labeled data based on the framework, reducing the labeling cost, and improving the model accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 is an overall block diagram of a real-time steel plate defect detection system according to an embodiment of the present invention;

[0066] Figure 2 It is the improved yolov5 model ECS-yolov5 in the embodiment of the present invention;

[0067] Figure 3 It is the semi-supervised model in the present invention. DETAILED DESCRIPTION

[0068] The present invention is further described in detail below with reference to the accompanying drawings and embodiments:

[0069] like Figure 1 As shown, a steel plate surface defect detection system based on semi-supervised learning includes a video acquisition module, an image detection and marking module, and a defect data storage module:

[0070] The video acquisition module is a camera device, which is fixedly arranged above and below one lateral side of the steel plate conveyor to obtain real-time images of the steel plate surface and transmit the images to the server in real time;

[0071] The image detection and marking module stores a semi-supervised detection model, performs real-time detection on the steel plate surface image acquired by the video acquisition module, and obtains defect information and defect images, wherein the defect information includes defect classification, defect coordinates, and defect quantity;

[0072] The defect data storage module transmits the defect information and defect images obtained by the image detection module to the defect calibration module and stores them, so as to subsequently train the stored semi-supervised detection model to improve the model accuracy.

[0073] Example

[0074] The steel plate defect real-time detection system is implemented. The following steps are to train the detection model, which specifically include the following steps:

[0075] S1. Collect defect images and build a data set;

[0076] Defect images of steel surfaces are collected to construct a dataset. In the present invention, the NEU-DET hot-rolled steel plate surface defect public dataset collected by Northeastern University is used, including six types of defects: cracks (Cr), patches (Pa), scale indentations (Rs), pits (Ps), inclusions (In), and scratches (Sc). There are 300 images of each type of defect, a total of 1,800 images, with a resolution of 200×200.

[0077] S2. Divide the defect image database into a labeled data set and an unlabeled data set. The labeled data set contains all types of defects and the number of each type of defect data is the same. The ratio of the labeled data set to the unlabeled data set is:

[0078] The collected images are divided into labeled data sets and unlabeled data sets, of which a small number of images (1 / 6, 300 images) are classified as labeled data sets, and most of the images (5 / 6, 1500 images) are classified as unlabeled data sets; for the labeled data set, six types of defects need to be included: cracks (Cr), plaques (Pa), scale indentations (Rs), pits (Ps), inclusions (In), and scratches (Sc), and the number of each type is not much different. Ensuring the balance of the data set can effectively improve the performance and accuracy of the target detection model, enable the model to learn the feature information of each category, and reduce model errors and recognition biases.

[0079] S3, divide the labeled data set into a training set (train) and a validation set (val), and perform data augmentation on the training set;

[0080] From the NEU-DET steel plate surface defect public data set, 1 / 6 of 1800 defect images of six types of defects, namely cracks (Cr), plaques (Pa), scale indentations (Rs), pits (Ps), inclusions (In), and scratches (Sc), totaling 300, are taken out and divided into a labeled data set (50 defect images of each type are selected, and the number of images of each type cannot be randomly selected), and the training images are annotated with various defects in the images using labelImg software to generate a .txt file, which contains the corresponding coordinate value information of the defect real box manually annotated by labelImg, as well as the defect label information corresponding to each box; in this embodiment, the training set and the validation set are divided into 90% and 10% according to each type of image, wherein the training set has a total of 270 images and the validation set has a total of 30 images, and the training set is subjected to data enhancement processing.

[0081] S4, establish the improved yolov5 network model ECS-yolov5;

[0082] The yolov5 network model structure has three parts: Backbone, Neck, and Head. The yolov5 network model is improved. The improved network model is as follows Figure 2 As shown:

[0083] S4.1 In the Backbone part, in order to enhance the feature extraction capability of the model, we add an attention layer ECA module to the C3 module, that is, adding the ECA module to the C3 module can better identify image features and enhance the feature extraction capability, that is, replace the original C3 module in the Backbone structure with the newly formed C3ECA module;

[0084] In the Neck part of S4.2, the lightweight upsampling operator CARAFE module is introduced to replace the nearest bilinear upsampling operator in the upsampling module. CARAFE is divided into two main modules, namely the upsampling kernel prediction module and the feature reconstruction module. Assuming the upsampling ratio is σ, given an input feature map of shape H×W×C, we first use the upsampling kernel prediction module to predict the upsampling kernel, and then use the feature reconstruction module to complete the upsampling, and obtain an output feature map of shape σH×σW×C. The CARAFE module has a large receptive field and can better utilize surrounding information; the upsampling kernel should be related to the semantic information of the feature map, and upsampling is performed based on the input content. This module does not introduce too many parameters and calculations, and always remains lightweight;

[0085] S4.3Head is the prediction head network. The Head module has two branches, which are composed of ESE (Effective Squeeze-and-Excitation) Block and convolution layer. These two branches complete the functions of target classification and position regression respectively. The Neck in the yolov5s model outputs three branches, namely the output P3, P4, and P5 three feature maps, and there are three prediction branches, each feature map is input to the Head. The Head contains three detection layers, corresponding to the three feature maps of different sizes obtained in the Neck. YOLOv5 divides the grids on these three feature maps according to the size of the feature map, and presets three anchors with different aspect ratios for each grid on each feature map to predict and regress the target. The Head predicts three boxes respectively, that is, predicts targets of different sizes respectively, and uses SIoU Loss instead of CIou Loss as the regression loss function of the model to improve the regression accuracy of the prediction box; to reduce the impact of the accuracy loss of the neural network model after compression. Finally, the improved YOLOV5 model is obtained.

[0086] In order to improve the regression accuracy of the prediction box and reduce the accuracy loss after model compression, the regression loss function of the yolov5 model is replaced by SIoU from CIoU; the SIoU loss function consists of four parts: angle loss (Angle cost), distance loss (Distance cost), shape loss (Shape cost), and IOU (Intersection over Union) loss.

[0087] The SIoU loss function formula is as follows:

[0088]

[0089] Among them, ∧ is the angle loss, Δ is the distance loss, Ω is the shape loss, and IOU is the intersection-over-union loss; the above losses are all obtained through calculation.

[0090] S5, use ECS-yolov5 as a semi-supervised detection model;

[0091] S5.1 Model initialization stage: Compared with single-stage algorithms such as the YOLO series and two-stage algorithms such as Faster R-CNN, the accuracy is slightly lower than that of traditional two-stage algorithms, but the speed is faster than that of two-stage algorithms. Use the improved yolov5 to train the labeled pictures to improve the accuracy of the model and generate effective pseudo-labels for the subsequent teacher model. That is, in the pre-training stage, use the labeled pictures to send them to ESC-yolov5 for training. At this time, the weight file is yolov5s.pt, and the weight file best.pt of the project is obtained.

[0092] S5.2 Stage of mutual learning between teachers and students

[0093] like Figure 3 As shown in the figure, it represents the improved teacher-student framework. The teacher-student model is two identical models, both of which are improved yolov5 frameworks. The teacher generates pseudo labels for training students and gradually updates its parameters through EMA. The student model is trained with both labeled data sets and pseudo-label data. The specific steps are as follows:

[0094] S5.2.1 Student model training: The labeled data and unlabeled data are enhanced, and the enhanced data is sent to the student model training;

[0095] S5.2.2 Teacher model training: weakly enhance the unlabeled data and send it to the teacher model for inference, set the threshold to generate pseudo labels, and set the threshold method to the dynamic threshold method. The dynamic threshold method is to set an initial threshold first and then adjust it according to the actual situation. The dynamic threshold method can dynamically adjust the detection threshold according to the actual situation to ensure the accuracy and reliability of the detection results;

[0096] S5.2.3 In the pseudo labels generated by the teacher model, the generated pseudo labels are often unbalanced due to sample differences. If they are directly mixed with labeled samples, the model will learn these categories with high bias, affecting the accuracy of the model. To solve this problem, we will introduce a pseudo label balancing strategy in the teacher-student model. The label balancing strategy is introduced to balance the number of pseudo labels generated in each category, and then the pseudo labels are mixed with labeled data to expand the labeled data set;

[0097] S5.2.4 Calculate optimization loss: Student model training This step mainly uses labeled images and unlabeled images to update the student model. The labeled images are trained by the student model to obtain predicted values ​​and compared with the true labels to calculate the classification loss and bounding box regression loss. This part of the loss can be regarded as a supervised loss. For the unlabeled loss, we define it as It can be seen that the optimization loss of the student network can be defined as:

[0098]

[0099] is the supervised loss, is the unsupervised loss, and λ is the coefficient that balances the supervised loss and the unsupervised loss.

[0100] Monitoring loss Contains classification loss Bounding Box Regression Loss and confidence loss The monitoring loss Can be defined as:

[0101]

[0102] The classification loss With confidence loss is the cross entropy loss, and their calculation formula is:

[0103]

[0104]

[0105] Among them, x l represents the labeled sample, y cls With y loc Indicates its label, N L Represents the number of labeled samples. The formula for cross entropy loss is:

[0106]

[0107] Among them, x represents the sample, y represents the label, a represents the predicted output, and n represents the total number of samples.

[0108] In terms of bounding box regression, SIOU loss is used for bounding box regression:

[0109]

[0110] For unlabeled data, we define the unlabeled sample loss as :

[0111]

[0112] in, are pseudo labels generated by the teacher model.

[0113] S5.2.5 Student model update. This step mainly uses labeled samples and unlabeled samples to update the student model. Labeled samples are predicted by the student model and the classification loss is calculated with the real label. Unlabeled samples are first obtained by the teacher model. The pseudo label is optimized by using the pseudo label generated by the teacher, and the difference between the student model prediction value and the pseudo label of the teacher model is calculated as the consistency loss. The update of the student model is shown in the following formula:

[0114]

[0115] Among them, γ is the learning rate, θ s are the parameters of the student model.

[0116] S5.2.6 Teacher model update. This step mainly involves the student model parameters gradually updating the teacher model parameters through EMA. The update of the teacher model parameters can be regarded as the fine-tuning of the teacher model by the student model after each iteration to update the parameters, so that the teacher model can update the model parameters at each step in each epoch:

[0117] θ t ←αθ t +(1-α)θ s

[0118] θ t is the teacher model parameter, θ s is the student model parameter, α is a hyperparameter that determines the speed of parameter transmission and is usually close to 1.

[0119] S5.2.7 Repeat the above steps and test the student model with the test data, and select the student model corresponding to the best test result as the final detection model.

[0120] S6, the video acquisition module collects and processes real-time video, and applies a semi-supervised detection model to achieve real-time defect detection;

[0121] The collected data comes from the videos or photos taken by the monitoring equipment of the steel plate production line. One frame is extracted for a certain number of video frames. The resolution of the collected pictures / videos should be consistent, and the pictures should be clear and the lighting should be normal. The real-time image of the steel plate collected by the image acquisition module is identified and transmitted to the detection system to infer and obtain the classification, location and quantity information of the target defects.

[0122] S7. The defect data storage module transmits the defect information and defect image obtained by the image detection module to the defect calibration module, stores the above detected defect data, and regularly uses new defect data (all unlabeled) to update the semi-supervised detection model parameters, so as to subsequently train the model and improve the model accuracy.

[0123] In summary, the present invention can make the process of steel plate defect detection more convenient and simple, reduce the dependence on a large number of labeled samples, and the model accuracy can become more and more accurate during the training process.

Claims

1. A method for detecting steel plate surface defects based on semi-supervised learning, characterized in that: The following steps are involved: S1. Collect defect images and build a defect image database; S2, dividing the defect image database into a labeled data set and an unlabeled data set; In S2, the labeled data set contains all types of defects and the number of each type of defect data is the same, and the ratio of the labeled data set to the unlabeled data set is 1:5; The defect image data set includes: cracks, plaques, iron oxide scale indentations, pits, inclusions, and scratches; Specifically, 1 / 6 of the 1,800 defect images (a total of 300 images) are taken as the labeled data set, and the training images are labeled with various defects in the images using the labelImg software to generate a .txt file. The txt file contains the corresponding coordinate value information of the real defect boxes manually labeled by labelImg, as well as the defect label information corresponding to each box; S3, divide the labeled data set into a training set and a validation set, and perform data augmentation on the training set; S4, establish the improved yolov5 network model ECS-yolov5; The improved yolov5 network model structure includes Backbone, Neck and Head; S4 specifically includes the following steps: S4.1 In Backbone, add an attention layer ECA module to the C3 module, that is, replace the original C3 module with the newly formed C3ECA module; In S4.2, in Neck, the lightweight upsampling operator CARAFE module is introduced to replace the nearest bilinear upsampling operator in the upsampling module; S4.3 replaces the regression loss function of the yolov5 model from CIoU to SIoU; the SIoU loss function consists of four parts: angle loss ∧, distance loss Δ, shape loss Ω, and IOU loss. The IOU loss is the intersection-over-union loss, which is expressed as follows: The SIoU loss function formula is as follows: Among them, the upsampling operator CARAFE module CARAFE is divided into two main modules, namely the upsampling kernel prediction module and the feature reorganization module; the upsampling ratio is σ, given an input feature map of shape H×W×C, first use the upsampling kernel prediction module to predict the upsampling kernel, and then use the feature reorganization module to complete the upsampling, and obtain an output feature map of shape σH×σW×C; The Head module has two branches, consisting of ESE Block and convolutional layer. These two branches complete the functions of target classification and position regression respectively. The Neck in the yolov5 model outputs three feature maps, P3, P4, and P5, so there are three prediction branches, and each feature map is input into the Head; the Head contains three detection layers, corresponding to the three feature maps of different sizes obtained in the Neck; YOLOv5 divides grids on these three feature maps according to the size of the feature maps, and presets three anchors with different aspect ratios for each grid on each feature map to predict and regress targets; Head has targets of different sizes, and uses SIoU Loss instead of CIou Loss as the regression loss function of the yolov5s model; S5, use ECS-yolov5 as a semi-supervised detection model; S5 specifically includes the following steps: In the initialization phase of the S5.1 model, the labeled dataset is trained with ECS-yolov5 to generate effective pseudo labels for the subsequent teacher model; In the training stage, the labeled images are sent to ESC-yolov5 for training. The weight file at this time is yolov5s.pt, and the weight file best.pt of the project is obtained. S5.2 In the teacher-student mutual learning stage, ECS-yolov5 is used as the teacher model and student model in the semi-supervised detection framework. The teacher model generates pseudo labels for training the student model. The student model gradually updates the parameters of the teacher model through EMA, and updates the student model parameters with the total loss. The student model results are compared and the best student model is selected as the target model for the final detection. S5.2 specifically includes the following steps: S5.2.1 Student model training; The labeled data and unlabeled data are enhanced, and the enhanced data is sent to the student model for training; S5.2.2 Teacher model training; The unlabeled data is weakly enhanced and sent to the teacher model for reasoning. The pseudo labels generated by setting the threshold are set. The threshold setting method is the dynamic threshold method. The dynamic threshold method is to first set an initial threshold and then adjust it according to the actual situation. The dynamic threshold method can dynamically adjust the detection threshold according to the actual situation to ensure the accuracy and reliability of the detection results. S5.2.3 introduces a pseudo-label balancing strategy in the teacher-student model; introduces a pseudo-label balancing strategy to balance the number of pseudo-labels generated in each category, and then mixes the pseudo-labels with the labeled data to expand the labeled data set; S5.2.4 Calculate optimization loss; Student model training This step mainly uses labeled images and unlabeled images to update the student model. The labeled images are trained by the student model to obtain predicted values ​​and compared with the true labels to calculate the classification loss and bounding box regression loss. This part of the loss can be regarded as a supervised loss. For the unlabeled loss, it is defined as The optimization loss of the student model can be defined as: is the supervised loss, is the unsupervised loss, λ is the coefficient that balances the supervised loss and the unsupervised loss; Monitoring loss Contains classification loss Bounding Box Regression Loss and confidence loss The monitoring loss is defined as: The classification loss With confidence loss is the cross entropy loss, and their calculation formula is: Among them, x l represents the labeled sample, y cls With y loc Indicates its label, N L Represents the number of labeled samples; the formula for cross entropy loss is: Among them, x represents the sample, y represents the label, a represents the predicted output, and n represents the total number of samples; In terms of bounding box regression, SIOU loss is used for bounding box regression: For unlabeled data, we define the unlabeled sample loss as in, are pseudo labels generated by the teacher model; S5.2.5 Student model update; The student model is updated using labeled samples and unlabeled samples. The labeled samples are predicted by the student model and the classification loss is calculated with the true label. The unlabeled samples are first obtained by the teacher model with pseudo labels. The student model is optimized by using the pseudo labels generated by the teacher model. The difference between the student model prediction value and the teacher model pseudo label is calculated as the consistency loss. The update of the student model is shown in the following formula: Among them, γ is the learning rate, θs is the parameter of the student model; S5.2.6 Teacher model update; The student model parameters gradually update the teacher model parameters through EMA. The update of the teacher model parameters can be regarded as the fine-tuning of the teacher model by the student model after each iteration to update the parameters, so that the teacher model can update the model parameters at each step in each epoch: i t ←th t +(1-α)θ s θ t is the teacher model parameter, θ s is the student model parameter, α is a hyperparameter that determines the speed of parameter transmission, which is usually close to 1; S5.2.7 Repeat the above steps and use the test data to test the student model, and select the student model corresponding to the best test result as the final detection model; S6, the video acquisition module collects and processes real-time video, and applies a semi-supervised detection model to achieve real-time defect detection; S7. The defect data storage module stores the detected defect data and regularly uses new defect data to update the parameters of the semi-supervised detection model.

2. A steel plate surface defect detection system based on semi-supervised learning, characterized in that: The method for detecting surface defects of steel plates based on semi-supervised learning as claimed in claim 1 comprises a video acquisition module, an image detection and marking module and a defect data storage module: The video acquisition module is a camera device, which is fixedly arranged above and below one lateral side of the steel plate conveying device to obtain real-time images of the steel plate surface and transmit the images to the server in real time; The image detection and marking module stores a semi-supervised detection model, performs real-time detection on the steel plate surface image acquired by the video acquisition module, and obtains defect information and defect images, wherein the defect information includes defect classification, defect coordinates, and defect quantity.