Steel surface anomaly detection method based on improved yolov5

By introducing the SPD-Conv module and SCDown module in the yolov5 model, the steel surface abnormality detection method is improved, the problem of micro defect detection and insufficient real-time performance is solved, efficient and accurate abnormality detection is achieved, and product quality and production safety are ensured.

CN119888335APending Publication Date: 2025-04-25DEQING ALPHA INNOVATION RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411956726.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing steel surface abnormality detection technology has shortcomings in micro defect detection and real-time performance, and it is impossible to efficiently and accurately identify and handle various abnormalities on the steel surface.

Method used

Using the steel surface abnormality detection method based on improved yolov5, the fine-grained information retention and feature representation learning efficiency of detection are improved by introducing the SPD-Conv module and the SCDown module, and the calculation cost and number of parameters are reduced through efficient downsampling.

Benefits of technology

It improves the detection ability of tiny abnormalities, improves the real-time and efficiency of detection, and can efficiently and accurately identify and handle various abnormalities on the steel surface, ensuring product quality and production safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888335A_ABST
    Figure CN119888335A_ABST
Patent Text Reader

Abstract

The invention relates to a steel surface anomaly detection method based on improved yolov5, and the method comprises the following steps: 1) collecting data, and marking the position and category of a defect; 2) data preprocessing, which mainly comprises random vertical and horizontal flipping, color gamut distortion, random rotation, size transformation and the like of input data; 3) data set division: randomly dividing the preprocessed data into a training set, a verification set and a test set; 4) performing model training, and performing training verification on the improved yolov5 model by adopting the divided training set and verification set; 5) verifying the model effect, and calculating the performance evaluation index according to the output result of the test set. The method can improve the detection capability of the tiny abnormity, meets the real-time performance, efficiently and accurately identifies and treats various abnormities on the steel surface, and ensures the product quality and the production safety.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of artificial intelligence technology, in particular to a steel surface anomaly detection method based on improved YOLOv5. Background Art

[0002] At present, the steel surface anomaly detection technology mainly includes laser detection method, optical machine vision intelligent detection, computer vision and yolo target detection. The laser detection method uses laser technology to scan the steel surface through a laser sensor. The laser beam emitted by the sensor is irradiated to the steel surface, and the reflected laser signal is received. The change of the reflected signal determines whether there is an abnormality on the steel surface. Its disadvantage is that the equipment cost is high and professional technicians are required to operate and maintain it. Optical machine vision intelligent detection uses a light source to illuminate the steel surface to be tested, and obtains the surface image through a high-speed CCD camera. The image feature vector is extracted through image processing technology, and the surface defects are detected and classified through a classifier. Its disadvantage is that it has high requirements for lighting conditions and cannot accurately detect tiny surface defects. Yolo target detection is a motorized detection based on deep learning. It has achieved great success in steel surface anomaly detection, but it still performs poorly in the difficult task of tiny defects, and the detection speed needs to be improved.

[0003] The detection of steel surface anomalies is not only related to the guarantee of product quality, but also directly related to production safety, normal operation of equipment and the health and safety of end users. With the rapid development of technologies such as computer vision and machine learning, automated detection technology has become a key means to solve this problem.

[0004] Therefore, a steel surface anomaly detection method based on improved YOLOv5 was designed to overcome the above problems. Summary of the invention

[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and to provide a steel surface anomaly detection method based on improved YOLOv5, which can improve the detection capability of tiny anomalies and meet the real-time requirements, efficiently and accurately identify and process various anomalies on the steel surface, and ensure product quality and production safety.

[0006] The present invention is implemented by the following technical scheme: a steel surface anomaly detection method based on improved yolov5, the anomaly detection method comprising the following steps:

[0007] 1) Collect data and mark the defect location and category;

[0008] 2) Data preprocessing, mainly including random vertical and horizontal flipping, color gamut distortion, random rotation, size transformation, etc. of input data;

[0009] 3) Dataset division: randomly divide the preprocessed data into training set, validation set and test set;

[0010] 4) Model training: Use the divided training set and validation set to train and validate the improved yolov5 model;

[0011] 5) Verify the model effect and calculate the performance evaluation index based on the output results of the test set.

[0012] Preferably, the anomaly detection method introduces an SPD-Conv module and a SCDown module, wherein the SPD-Conv module consists of an SPD (space-to-depth) layer and a Conv (non-strided convolution) layer, and the SCDown module consists of two convolution operations.

[0013] Preferably, the space-to-depth layer mainly considers any intermediate feature map X of size S×S×C1, cuts out a series of sub-feature maps, and then connects these sub-feature maps along the channel dimension to obtain a feature map X′, whose spatial dimension is reduced by a scale factor and the channel dimension is increased by a scale factor 2 Factor, space-to-depth converts the feature map X(S, S, C1) into an intermediate feature map

[0014] Preferably, the non-strided convolution layer is added with a non-strided (i.e., stride=1) convolution layer with a C2 filter after the SPD feature transformation layer, where C2 < scale 2 C1, further transformation The reason for using non-strided convolution is to preserve all discriminative feature information as much as possible. If a 3x3 convolution with stride=3 is used, the feature map will be reduced but each pixel will be sampled only once. If stride=2, asymmetric sampling will occur. In general, a stride greater than 1 will result in a non-discriminatory loss of information.

[0015] Preferably, the two convolution operations of the SCDown module, the first convolution operation mainly realizes the channel conversion, and the second convolution operation realizes two times downsampling. First, the channel dimension is adjusted by point convolution, and then the spatial downsampling is performed by depth convolution. The computational cost is O(2HWC 2 +9 / 2HWC), the number of parameters is O(2C 2 +18C) to reduce latency while preserving as much information as possible during the downsampling process.

[0016] The beneficial effects of the present invention are as follows:

[0017] (1) The ability to detect minor anomalies is improved. The present invention introduces the SPD-Conv module to replace each strided convolution and each pooling layer, thereby reducing the loss of fine-grained information and improving the efficiency of feature representation learning, solving the difficult task of minor anomalies.

[0018] (2) Real-time performance: The present invention introduces the SCDown module, which can perform efficient downsampling while reducing the computational cost and the number of parameters, thereby improving the detection speed without reducing the accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is the overall flow chart of the present invention.

[0020] Figure 2 This is the original yolov5 model structure diagram.

[0021] Figure 3 Schematic diagram of the SPD-Conv module.

[0022] Figure 4 This is a schematic diagram of the SCDown module. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to more clearly understand the objectives, technical solutions and advantages of the present invention, the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0024] In the description of the present invention, it is necessary to understand that the orientation or position relationship indicated by the terms such as "up", "down", "left", "right", "inside", "outside", "horizontal" and "vertical" is based on the orientation or position relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention, rather than indicating or implying that the device or original referred to must have a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0025] The present invention will be described in detail below with reference to the accompanying drawings: Figure 1 As shown, a steel surface anomaly detection method based on improved yolov5, the anomaly detection method comprises the following steps:

[0026] 1) Collect data and mark the defect location and category;

[0027] 2) Data preprocessing, mainly including random vertical and horizontal flipping, color gamut distortion, random rotation, size transformation, etc. of input data;

[0028] 3) Dataset division: randomly divide the preprocessed data into training set, validation set and test set;

[0029] 4) Model training: Use the divided training set and validation set to train and validate the improved yolov5 model;

[0030] 5) Verify the model effect and calculate the performance evaluation index based on the output results of the test set.

[0031] like Figure 2 The figure shows the original yolov5 model structure. It mainly includes three parts: Backbone, Neck, and Head. First, the image is input into the Backbone network to extract features, then feature fusion is performed in the Neck part, and finally recognition is made in the Head part.

[0032] like Figure 3-4 As shown, the anomaly detection method introduces an SPD-Conv module and a SCDown module, wherein the SPD-Conv module consists of a space-to-depth (SPD) layer and a non-strided convolution (Conv) layer, and the SCDown module consists of two convolution operations.

[0033] The space-to-depth layer mainly considers any intermediate feature map X of size S×S×C1, cuts out a series of sub-feature maps, and then connects these sub-feature maps along the channel dimension to obtain a feature map X′, whose spatial dimension is reduced by a scale factor and the channel dimension is increased by a scale factor 2 Factor, space-to-depth converts the feature map X(S, S, C1) into an intermediate feature map

[0034] The non-strided convolution layer adds a non-strided (i.e., stride=1) convolution layer with a C2 filter after the SPD feature transformation layer, where C2 < scale 2 C1, further transformation The reason for using non-strided convolution is to preserve all discriminative feature information as much as possible. If a 3x3 convolution with stride=3 is used, the feature map will be reduced but each pixel will be sampled only once. If stride=2, asymmetric sampling will occur. In general, a stride greater than 1 will result in a non-discriminatory loss of information.

[0035] The two convolution operations of the SCDown module, the first convolution operation mainly realizes the channel conversion, and the second convolution operation realizes two times downsampling. Yolov5 uses a regular 3x3 convolution with a stride of 2 to simultaneously realize spatial downsampling (from HxW to H / 2xW / 2) and channel conversion (from C to 2C). This introduces a non-negligible computational cost O(9 / 2HWC 2 ) and the number of parameters O(18C 2 ). In contrast, the SCDown module can perform more efficient downsampling. Specifically, it first uses point convolution to adjust the channel dimension, and then uses depth convolution to perform spatial downsampling. This reduces the computational cost to O(2HWC 2 +9 / 2HWC) and the number of parameters is reduced to O(2C 2 +18C). While preserving the information in the downsampling process to the maximum extent, the latency is reduced. In contrast, the SCDown module can perform more efficient downsampling. Specifically, it first uses point convolution to adjust the channel dimension, and then uses depth convolution to perform spatial downsampling. This reduces the computational cost to O(2HWC 2 +9 / 2HWC) and the number of parameters is reduced to O(2C 2 +18C). Reduce latency while preserving as much information as possible during the downsampling process.

[0036] Anyone familiar with the technology may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A steel surface anomaly detection method based on improved yolov5, characterized in that: The anomaly detection method comprises the following steps: 1) Collect data and mark the defect location and category; 2) Data preprocessing, mainly including random vertical and horizontal flipping, color gamut distortion, random rotation, and size transformation of input data; 3) Dataset division: randomly divide the preprocessed data into training set, validation set and test set; 4) Model training: Use the divided training set and validation set to train and validate the improved yolov5 model; 5) Verify the model effect and calculate the performance evaluation index based on the output results of the test set.

2. The steel surface anomaly detection method based on improved yolov5 according to claim 1 is characterized in that: The anomaly detection method introduces an SPD-Conv module and a SCDown module, wherein the SPD-Conv module consists of an SPD layer and a Conv layer, and the SCDown module consists of two convolution operations.

3. The steel surface anomaly detection method based on improved yolov5 according to claim 2 is characterized in that: The space-to-depth layer mainly considers any intermediate feature map X of size S×S×C1, cuts out a series of sub-feature maps, and then connects these sub-feature maps along the channel dimension to obtain a feature map X′, whose spatial dimension is reduced by a scale factor and the channel dimension is increased by a scale factor 2 Factor, SPD converts the feature map X(S, S, C1) into an intermediate feature map 4. The steel surface anomaly detection method based on improved yolov5 according to claim 2 is characterized in that: The Conv layer adds a non-strided convolution layer with a C2 filter after the SPD layer, where C2 < scale 2 C1, further transformation If stride=2, asymmetric sampling will occur.

5. The steel surface anomaly detection method based on improved yolov5 according to claim 2 is characterized in that: The two convolution operations of the SCDown module, the first convolution operation mainly realizes channel conversion, and the second convolution operation realizes two times downsampling. First, point convolution is used to adjust the channel dimension, and then depth convolution is used for spatial downsampling. The computational cost is O(2HWC 2 +9 / 2HWC), the number of parameters is O(2C 2 +18C) to reduce latency while preserving as much information as possible during the downsampling process.