A steel surface anomaly detection method based on cascaded group attention
By introducing a deep learning model of cascade group attention mechanism in steel surface defect detection, the problems of low efficiency and low accuracy of existing detection methods are solved, and more efficient and accurate defect detection effects are achieved.
Patent Information
- Application Number
- CN202411945679.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-04
AI Technical Summary
The existing steel surface defect detection methods are inefficient, costly and susceptible to subjective factors, resulting in low detection accuracy, inaccurate identification of all types of surface defects, and low overall working efficiency.
A deep learning model based on cascade group attention is adopted, especially the introduction of cascade group attention mechanism (CGAttention) to improve the model's sensitivity and detection accuracy for subtle changes in complex scenarios.
Through the cascading group attention mechanism, the model's expressiveness and detection accuracy are improved, and more accurate and reliable steel surface defect detection is achieved, suitable for deployment in resource-constrained environments.
Smart Images

Figure CN119762880A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of steel surface defect detection, and specifically to a steel surface anomaly detection method based on cascaded group attention, and more specifically to a method for improving the accuracy of steel surface defect detection by using a deep learning model, especially a cascaded group attention mechanism (CGAttention). Background Art
[0002] With the continuous improvement of industrial automation, the requirements for product quality are becoming increasingly stringent. In the steel production process, surface defects directly affect the quality and service life of the product. Traditional manual inspection methods are inefficient, costly, and easily affected by subjective factors, resulting in low detection accuracy and poor model generalization ability. In addition, existing automatic inspection systems may not be able to accurately identify all types of surface defects, resulting in low overall work efficiency.
[0003] To this end, a steel surface anomaly detection method based on cascaded group attention is designed to overcome the above problems. Summary of the invention
[0004] 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 cascaded group attention. The expressiveness of the model is improved by introducing the cascaded group attention mechanism, thereby achieving more accurate and reliable steel surface defect detection.
[0005] The present invention is implemented by the following technical solution: a steel surface anomaly detection method based on cascade group attention, the detection method comprising the following steps:
[0006] 1) Use monitoring equipment or manual methods to collect abnormal data of various scenes on the steel surface. The data set includes different lighting conditions, angles, and backgrounds to ensure that the model has good generalization ability;
[0007] 2) Label the data and mark the abnormal locations and categories in the images;
[0008] 3) Use the model to train the data to obtain an anomaly detection model;
[0009] 4) After training, test the model’s performance on an independent validation set;
[0010] 5) Deploy the verified model into the actual environment to perform anomaly detection on the steel surface.
[0011] Preferably, the step 2) is specifically as follows:
[0012] Use bounding boxes to select abnormal areas and assign a label to each box to indicate the name of the category.
[0013] Preferably, the step 3) is specifically as follows:
[0014] The model is trained using annotated datasets. During the training process, unprocessed original images are input, and features are gradually extracted through the network to predict possible abnormal locations. The loss function adjusts parameters based on the difference between the model output and the actual annotations, allowing the model to learn the ability to distinguish between normal and abnormal areas.
[0015] Preferably, step 4) is used to evaluate its accuracy and robustness, which helps to discover potential problems and optimize the model structure or hyperparameter settings accordingly. Once it is determined that the model has achieved the expected performance level, it can be deployed in an actual environment for real-time monitoring and automatic identification of new anomalies on the steel surface. At this time, new, unseen images will be sent as input to the trained model, and the model will provide information on whether an anomaly exists and specific positioning information.
[0016] Preferably, the steel anomaly detection model in step 5) specifically includes the following process:
[0017] 1) Input;
[0018] 2) Through the SPD layer, i.e., the space-to-depth layer, it is used to generalize the input image conversion technology to the feature maps inside the CNN and the entire CNN for downsampling;
[0019] 3) After the SPD layer feature transformation, a non-strided convolution layer with stride = 1 is used with a C2C_2C2 filter;
[0020] 4) Then use the Cascaded Group Attention layer and describe it using the formula;
[0021] 5) Output.
[0022] Preferably, the process 2) is specifically as follows:
[0023] Consider an intermediate feature map XXX of size S×S×C1 S×S×C1 S×S×C1, and cut out a series of feature maps as follows:
[0024] f 0,0 =X[0:S:scale,0:S:scale],f 1,0 =X[1:S:scale,0:S:scale],.
[0025] f scale-1,1= X[scale - 1:S:scale, 0:S:scale];
[0026] f 0,1 = X[0:S:scale, 1:S:scale], f 1,1 = X[1:S:scale, 1:S:scale],...
[0027] f scale-1,1 = X[scale - 1:S:scale, 1:S:scale];
[0028] …
[0029] f 0,scale-1 = X[0:S:scale, scale - 11:S:scale], f 1,scale-1 = X[1:S:scale, scale - 1:S:scale],...
[0030] f scale-1,scale-1 = X[scale - 1:S:scale, scale - 1:S:scale];
[0031] Next, connect these sub - feature maps along the channel dimension to obtain a feature map X′X′X′. SPD converts the feature map X(S, S, C1)X(S, S, C_1)X(S, S, C1) into an intermediate feature map X′(S / sacle, S / sacle, scale2C1)X′(S / sacle, S / sacle, scale 2 C_1)X′(S / sacle, S / sacle, scale2C1).
[0032] Preferably, in the non - strided convolution of step 3), C2 < scale2C1, C_2 < scale 2 C_1C2 < scale2C1. Further, X′(S / sacle, S / sacle, scale2C1) is converted to X″(S / sacle, S / sacle, C2), X′(S / sacle, S / sacle, scale 2 C_1) is converted to X″(S / sacle, S / sacle, C_2), X′(S / sacle, S / sacle, scale2C1) is converted to X″(S / sacle, S / sacle, C2).
[0033] Preferably, the formula of step 4) is specifically as follows:
[0034] Among them, X ij is the input feature X i The jth segment, X i =[X i1 ,X i2 ,...,X ih ], 1≤j≤h, h is the total number of attention heads for the input segmentation. and is a projection layer, which is used to map the segmentation of the input features into different subspaces, and W i P is a linear layer that reprojects the concatenated output features back to a space consistent with the input dimension.
[0035] The beneficial effects of the present invention are as follows:
[0036] The present invention adopts the application of cascaded group attention mechanism and introduces CGAttention mechanism in the steel surface defect detection task for the first time, thereby improving the sensitivity of the model to subtle changes in complex scenes.
[0037] The present invention adopts efficient model performance, which is not only small in size but also achieves extremely high detection accuracy and is suitable for deployment in resource-constrained environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a specific flow chart of the present invention.
[0039] Figure 2 It is a flow chart of the steel anomaly detection model in the present invention. DETAILED DESCRIPTION
[0040] 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.
[0041] 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.
[0042] 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 cascade group attention comprises the following steps:
[0043] 1) Use monitoring equipment or manual methods to collect abnormal data on the steel surface or in various scenes. The data set includes different lighting conditions, angles, backgrounds, etc. to ensure that the model has good generalization ability;
[0044] 2) Label the data and mark the abnormal locations and categories in the images;
[0045] 3) Use the model to train the data to obtain an anomaly detection model;
[0046] 4) After training, test the model’s performance on an independent validation set;
[0047] 5) Deploy the verified model into the actual environment to perform anomaly detection on the steel surface.
[0048] The step 2) is specifically: using a bounding box to select the abnormal area, and assigning a label to each box to indicate the name of the category. For the detection task, this means clearly marking all defect locations and their categories (if applicable) in each image.
[0049] The step 3) is specifically as follows: the model is trained using the labeled data set. During the training process, the unprocessed original image is input, and the features are gradually extracted through the network to predict the possible abnormal locations. The loss function adjusts the parameters according to the difference between the model output and the actual annotation, so that the model can learn the ability to distinguish between normal and abnormal areas.
[0050] The step 4) is used to evaluate its accuracy and robustness, which helps to discover potential problems and optimize the model structure or hyperparameter settings accordingly. Once it is determined that the model has achieved the expected performance level, it can be deployed in an actual environment for real-time monitoring and automatic identification of new anomalies on the steel surface. At this time, new, unseen images will be sent as input to the trained model, and the model will provide information on whether there is an anomaly and specific positioning information.
[0051] like Figure 2 As shown, the steel anomaly detection model in step 5) specifically includes the following process:
[0052] 1) Input;
[0053] 2) Through the SPD layer, i.e., the space-to-depth layer, it is used to generalize the input image conversion technology to the CNN (Convolutional Neural Network) and the feature map in the entire CNN for downsampling;
[0054] 3) After the SPD layer feature transformation, a non-strided convolution layer with stride = 1 is used with a C2C_2C2 filter;
[0055] 4) Then use the Cascaded Group Attention layer and describe it using the formula;
[0056] 5) Output.
[0057] The process 2) is specifically as follows:
[0058] Consider an intermediate feature map XXX of size S×S×C1 S×S×C1 S×S×C1, and cut out a series of feature maps as follows:
[0059] f 0,0 =X[0:S:scale,0:S:scale],f 1,0 =X[1:S:scale,0:S:scale],.
[0060] f scale-1,1 =X[scale-1:S:scale,0:S:scale];
[0061] f 0,1 =X[0:S:scale,1:S:scale],f 1,1 =X[1:S:scale,1:S:scale],...,
[0062] f scale-1,1 =X[scale-1:S:scale,1:S:scale];
[0063] …
[0064] f 0,scale-1 =X[0:S:scale,scale-11:S:scale],f 1,scale-1 =X[1:S:scale,scale-1:S:scale],...,
[0065] f scale-1,scale-1 =X[scale-1:S:scale,scale-1:S:scale];
[0066] Next, connect these sub - feature maps along the channel dimension to obtain a feature map \(X'\), and SPD converts the feature map \(X(S,S,C_1)\) into an intermediate feature map \(X'(S / sacle,S / sacle,scale2C_1)\) 2 \(C_1)X'(S / sacle,S / sacle,scale2C_1)\).
[0067] In the non - strided convolution of process 3), \(C_2 < scale2C_1\), \(C_2 < scale\) 2 \(C_1C_2 < scale2C_1\). Further, \(X'(S / sacle,S / sacle,scale2C_1)\) is converted to \(X''(S / sacle,S / sacle,C_2)\), \(X'(S / sacle,S / sacle,scale\) 2 \(C_1)\) is converted to \(X''(S / sacle,S / sacle,C_2)\), \(X'(S / sacle,S / sacle,scale2C_1)\) is converted to \(X''(S / sacle,S / sacle,C_2)\).
[0068] Preferably, the formula of process 4) is specifically as follows:
[0069] Where \(X\) ij is the input feature \(X\) i the \(j\) - th segmented part, \(X\) i \(=[X\) i1 , \(X\) i2 ,..., \(X\) ih , \(1\leq j\leq h\), \(h\) is the total number of attention heads of the input segmentation, and are projection layers used to map the segmentation of the input feature into different sub - spaces, while \(W\) i P is a linear layer that re - projects the concatenated output feature back into a space consistent with the input dimension.
[0070] The design features of the present invention are as follows:
[0071] 1. Data collection and pre - processing: Obtain steel surface image data from the actual production line and perform necessary pre - processing operations, including but not limited to resizing to 640 * 640 pixels, noise removal, and normalization.
[0072] 2. Network structure design: Construct a deep neural network architecture with the CGAttention module as the core, which can effectively capture feature information at different scales and enhance the attention to key areas through cascading.
[0073] 3. Inspection process: Input the steel surface image to be tested into the trained model, and output the prediction results, including whether there are defects and the specific location and type of defects. Take corresponding treatment measures based on the results output by the model.
[0074] 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 cascaded group attention, characterized in that: The detection method comprises the following steps: 1) Use monitoring equipment or manual methods to collect abnormal data of various scenes on the steel surface. The data set includes different lighting conditions, angles, and backgrounds to ensure that the model has good generalization ability; 2) Label the data and mark the abnormal locations and categories in the images; 3) Use the model to train the data to obtain an anomaly detection model; 4) After training, test the model’s performance on an independent validation set; 5) Deploy the verified model into the actual environment to perform anomaly detection on the steel surface.
2. The steel surface anomaly detection method based on cascaded group attention according to claim 1 is characterized in that: The step 2) is specifically as follows: Use bounding boxes to select abnormal areas and assign a label to each box to indicate the name of the category.
3. The steel surface anomaly detection method based on cascaded group attention according to claim 1 is characterized in that: The step 3) is specifically as follows: The model is trained using annotated datasets. During the training process, unprocessed original images are input, and features are gradually extracted through the network to predict possible abnormal locations. The loss function adjusts parameters based on the difference between the model output and the actual annotations, allowing the model to learn the ability to distinguish between normal and abnormal areas.
4. The steel surface anomaly detection method based on cascaded group attention according to claim 1 is characterized in that: The step 4) is used to evaluate its accuracy and robustness, which helps to discover potential problems and optimize the model structure or hyperparameter settings accordingly. Once it is determined that the model has achieved the expected performance level, it can be deployed in an actual environment for real-time monitoring and automatic identification of new anomalies on the steel surface. At this time, new, unseen images will be sent as input to the trained model, and the model will provide information on whether there is an anomaly and specific positioning information.
5. The steel surface anomaly detection method based on cascaded group attention according to claim 1 is characterized in that: The steel anomaly detection model in step 5) specifically includes the following process: 1) Input; 2) Through the SPD layer, i.e., the space-to-depth layer, it is used to generalize the input image conversion technology to the feature maps inside the CNN and the entire CNN for downsampling; 3) After the SPD layer feature transformation, a non-strided convolution layer with stride = 1 is used with a C2C_2C2 filter; 4) Then use the Cascaded Group Attention layer and describe it using the formula; 5) Output.
6. The steel surface anomaly detection method based on cascaded group attention according to claim 5 is characterized in that: The process 2) is specifically as follows: Consider an intermediate feature map XXX of size S×S×C1 S×S×C1 S×S×C1, and cut out a series of feature maps as follows: f 0,0 =X[0:S:scale,0:S:scale],f 1,0 =X[1:S:scale,0:S:scale],. f scale-1,1 =X[scale-1:S:scale,0:S:scale]; f 0,1 =X[0:S:scale,1:S:scale],f 1,1 =X[1:S:scale,1:S:scale],..., f scale-1,1 =X[scale-1:S:scale,1:S:scale]; … f 0,scale-1 =X[0:S:scale,scale-11:S:scale],f 1,scale-1 =X[1:S:scale,scale-1:S:scale],..., f scale-1,scale-1 =X[scale-1:S:scale,scale-1:S:scale]; Next, these sub-feature maps are connected along the channel dimension to obtain a feature map X′X′X′. SPD converts the feature map X(S,S,C1)X(S,S,C_1)X(S,S,C1) into an intermediate feature map X′(S / sacle,S / sacle,scale2C1)X′(S / sacle,S / sacle,scale 2 C_1)X′(S / sacle,S / sacle,scale2C1).
7. The steel surface anomaly detection method based on cascaded group attention according to claim 5, characterized in that: In the process 3) non-strided convolution, C2 < scale2C1, C_2 < scale 2 C_1C2 < scale2C1. Further, X′(S / sacle, S / sacle, scale2C1) is converted to X″(S / sacle, S / sacle, C2), and X′(S / sacle, S / sacle, scale 2 C_1) is converted to X″(S / sacle, S / sacle, C_2), and X′(S / sacle, S / sacle, scale2C1) is converted to X″(S / sacle, S / sacle, C2).
8. The steel surface anomaly detection method based on cascaded group attention according to claim 5, characterized in that: The formula of the process 4) is as follows: Among them, X ij is the input feature X i The jth segment, X i =[X i1 ,X i2 ,...,X ih ], 1≤j≤h, h is the total number of attention heads for the input segmentation, and is a projection layer, which is used to map the segmentation of input features into different subspaces, and is a linear layer that reprojects the concatenated output features back to a space consistent with the input dimension.