Slab Surface Quality Detection System and Method Based on Deep Learning
Through the combination of multi-level preprocessing technology and deep learning models, the problems of noise interference, uneven light and large changes in defect scales of slab surface quality detection systems are solved, and high accuracy and robustness detection is achieved, and the model is optimized to adapt to the dynamic changes in the production environment through incremental learning and federated learning.
Patent Information
- Application Number
- CN202510362834.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-03-26
AI Technical Summary
The existing deep learning-based slab surface quality detection system faces problems such as noise interference, uneven lighting, large defect scale changes, and insufficient data, and it is difficult to adaptively update to adapt to dynamic changes in the production environment.
Multi-stage preprocessing techniques, including adaptive non-local mean filtering, CLAHE, Laplace edge enhancement and Gamma correction, remove noise, equalize lighting and enhance defect edges. Combining ResNet and SE modules, local features are extracted, global information is extracted using Swin Transformer, defects are classified through full connection layer, and models are optimized through incremental learning, transfer learning and federated learning.
It significantly improves the accuracy and robustness of detection, realizes intelligent self-learning and continuous optimization, can adapt to defects in different sizes and forms, reduces production risks, and improves the overall operating efficiency of the production line.
Smart Images

Figure CN119888379B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial inspection, and particularly to a slab surface quality inspection system and method based on deep learning. Background Art
[0002] In the production process of modern iron and steel industry, as an important intermediate product of hot-rolled steel, the surface quality of slabs directly affects the performance and market competitiveness of the final products. However, due to the complexity of the production environment, the slab surface is often affected by defects such as cracks, scratches, inclusions, pits, etc. If not detected and corresponding measures are not taken in time, it will not only lead to product scrap and resource waste, but also may cause potential safety hazards. At present, traditional slab surface detection methods mainly rely on manual visual inspection or rule-based machine vision detection. However, manual detection has problems such as strong subjectivity, low efficiency, and easy fatigue, while traditional machine vision methods are often limited by fixed feature extraction methods and are difficult to adapt to different types and complex-shaped defects. In recent years, deep learning technology has made breakthrough progress in the field of computer vision, providing a new solution for industrial inspection. The slab surface defect detection method based on deep learning can automatically learn features and achieve high-precision and high-robustness defect recognition in complex backgrounds.
[0003] The Chinese patent application with the publication number CN115358977A discloses a carbon fiber surface defect detection method based on deep learning, including using a convolutional layer to extract carbon fiber features from the original image, filtering background information, and generating multiple feature maps; sending the multiple feature maps into an encoder module for encoding; after encoding the feature maps, using a backbone network to extract and fuse high-level and low-level carbon fiber defect features to generate multi-scale feature maps; sending the multi-scale feature maps generated by the backbone network into a decoder module for decoding; fusing the feature maps generated after decoding by the decoder with the result feature maps after preliminary convolution for the classification and regression prediction of carbon fiber defects; outputting the results of classification prediction and regression prediction. This invention reduces the interference of human subjectivity, which contributes greatly to improving the production speed of large carbon fiber bundles, ensuring the quality of carbon fiber products, and reducing the work intensity of laborers.
[0004] However, the existing deep learning-based detection systems still face many challenges, such as noise interference, uneven illumination, large variations in defect scales, insufficient generalization ability caused by insufficient data, etc. In addition, traditional deep learning methods are difficult to adaptively update in the face of dynamic changes in the production environment, resulting in a gradual decline in model performance. Therefore, how to combine advanced image preprocessing techniques, multi-scale feature fusion mechanisms, intelligent incremental learning strategies, and real-time feedback optimization to improve the accuracy, adaptability, and scalability of slab surface quality inspection has become a key problem to be solved urgently. Summary of the Invention
[0005] The object of the present invention is to propose a slab surface quality detection system and method based on deep learning for the problems existing in the background technology.
[0006] The technical solution of the present invention: A slab surface quality detection method based on deep learning includes the following specific implementation steps:
[0007] S1. Collect slab surface data;
[0008] S2. Based on adaptive non-local mean filtering for denoising, use global redundant information to remove noise from each pixel, combine adaptive histogram equalization to equalize illumination and Laplacian operator to enhance edges, optimize contrast through Gamma correction, and perform Z-score normalization, and generate binary matching codes;
[0009] S3. Use binary matching codes for data screening, construct a hybrid anomaly detection model, combine ResNet and SE modules to extract local features, perform local and global feature matching, and use Swin Transformer to extract global information, fuse multi-scale features, classify defects through a fully connected layer, and output {defect category, target bounding box position, defect confidence};
[0010] S4. Based on deep learning inference, obtain the defect category, optimize the classification result through confidence fusion, use the adaptive position correction algorithm to improve the defect localization accuracy, and generate a detection report by combining the defect category and localization information;
[0011] S5. Analyze the defect type and severity, automatically evaluate the slab quality, and formulate decision-making suggestions;
[0012] S6. Through incremental learning and knowledge distillation, use transfer learning to fine-tune the pre-trained model to optimize the recognition of new defects, and use federated learning to share the optimized hybrid anomaly detection model among multiple production lines;
[0013] S7. Visualize and display the slab surface data, detection report, and decision-making suggestions.
[0014] Preferably, the denoising process of adaptive non-local mean filtering is as follows:
[0015] S21. Convert the collected slab surface data into a grayscale image I(x,y), extract a fixed-size image block centered on each pixel point (x,y), that is, the neighborhood block, denoted as N{x,y}: N{x,y}={I(x + l x ,y + l y )|l x ,l y ∈[-k,k]};
[0016] Among them, k is the radius of the neighborhood block, and k is a positive integer; l x represents the horizontal offset; l y represents the vertical offset;
[0017] S22. Calculate the local mean and variance within the image block:
[0018] ;
[0019] ;
[0020] Among them, μ(x, y) represents the average gray value of the image block N(x, y); reflects the local noise level and detail complexity within the image block N(x, y);
[0021] S23. Design the adaptive parameter h(x, y): h(x, y) = s×σ(x, y) + h 0 ;
[0022] ;
[0023] In the formula, s represents the adjustment factor proportional to the noise level; σ(x, y) represents the local standard deviation; h 0 represents the basic smoothing parameter;
[0024] S24. Within a larger search window centered on the current pixel (x, y), perform image block similarity measurement for each candidate pixel (i, j) ∈ Ω(i, j): ;
[0025] ;
[0026] Among them, represents the Gaussian weight function; σ G is a preset parameter, σ G = k / 2; Ω represents the search area; represents the similarity measurement;
[0027] S25. Use the adaptive parameter h(x, y) to convert the distance into the weight w(x, y, i, j):
[0028] ;
[0029] ;
[0030] In the formula, Z(x, y) represents the normalization factor;
[0031] S26. Calculate the denoised gray value of the current pixel (x, y) as the weighted average of all candidate pixels within the search window, and output the denoised image data I'(x, y): .
[0032] Preferably, the generation process of the binary matching code is as follows:
[0033] S31. Convert the processed image data into binary data data;
[0034] S32. Select a random number r ∈ , and calculate the auxiliary code Ac = g r mod p;
[0035] where g is the generator of the predefined group G; G is a subgroup of the predefined group of order q; p is a predefined large prime number, satisfying that q is a factor of p - 1;
[0036] S33. Based on the matching code CM = H(data||Ac||P 1 ||P 2 ) mod q;
[0037] where || is the concatenation operation; P 1 is a predefined unary auxiliary code, P 1 = g a mod p; P 2 is a predefined binary auxiliary code, P 2 = g b mod p; a, b are predefined random components, a, b ∈ ; H is a predefined hash function;
[0038] S34. Calculate the unary code C 1 = r - a·CM (mod q), calculate the binary code C 2 = r - b·CM (mod q);
[0039] S35. Generate the binary matching code CⅡM = (CM, C 1 , C 2 ).
[0040] Preferably, the screening process of using the binary matching code for data screening is as follows:
[0041] S41. Convert the image data into binary data data';
[0042] S42. Calculate the unary screening code Co: , calculate the binary screening code Ct: ;
[0043] S43. If Co = Ct, it indicates that the received image data passes the primary screening; otherwise, an alarm is immediately issued.
[0044] S44. Calculate the reference code CS = H(data'||Co||P 1 ||P 2 ) mod q;
[0045] S45. If CS = CM, it indicates that the received image data meets the specifications; otherwise, an alarm is immediately issued.
[0046] Preferably, the detection process of the hybrid anomaly detection model is as follows:
[0047] S51. Input the processed image data into the ResNet+SE network for preliminary feature extraction, and use ResNe to extract the feature map F of the l-th layer (l) , and use the SE module to adjust the weights of the features of each channel:
[0048] ;
[0049] ;
[0050] In the formula, F (l) represents the feature map of the l-th layer; W (l) and b (l) represent the convolution kernel and bias respectively; Pool() represents the global average pooling operation; W 1 , W 2 represent the weights of the fully connected layer; S c represents the SE attention weight; represents the enhanced local feature;
[0051] S52. Construct an adaptive feature enhancement unit AFE to adaptively adjust the local features, and send the features F AFE after being adjusted by AFE into the Swin Transformer to extract global information, and divide F AFE into several windows, and calculate the self-attention independently for each window to extract the global features F tran of different scales;
[0052] S53. Obtain the global features F tran of the same scale, weighted-fuse the global scale and the enhanced local features to generate the fused feature F fusion , and use the fused feature F fusionFeed into the fully connected layer for defect classification and output the probabilities P of different defect categories;
[0053] S54. Use multi-scale confidence fusion to calculate the confidence C: , and output {defect category P, target bounding box position Bounding Box, defect confidence C};
[0054] In the formula, C i represents the defect confidence of the i-th scale; represents the weight corresponding to the i-th scale.
[0055] Preferably, the adjustment process for adaptively adjusting local features is as follows:
[0056] S61. Calculate the similarity between the local feature F SE and the global feature F global :
[0057] ;
[0058] In the formula, F global represents the global feature; S represents the similarity matrix between the local feature and the global feature; T represents the matrix transpose operation;
[0059] S62. Calculate the feature adjustment weight W AFE : W AFE = softmax(S);
[0060] S63. Calculate the enhanced feature F AFE : .
[0061] Preferably, for the global feature F global In the first round of inference, first use global average pooling on the local feature F SE to obtain the initial global feature: ;
[0062] Among them, is used as the pseudo-global feature; GAP() represents the global average pooling operation.
[0063] Preferably, the optimization process for optimizing the classification result is as follows:
[0064] S81. Extract the predefined confidence threshold C threshold , and exclude the detection results with confidence lower than the confidence threshold C threshold ;
[0065] S82. Based on the defect category P, combine the defect category and the confidence through a confidence weighting strategy to improve the reliability of classification: P' = P·C;
[0066] Among them, P′ is the finally weighted defect category vector; C is the defect confidence level;
[0067] S83. Determine the final category of the defect by maximizing the weighted category probability P': P final = argmax(P');
[0068] Among them, P final represents the finally determined defect category;
[0069] S84. Adopt an adaptive position correction algorithm to finely adjust the positioning result based on the defect confidence level C:
[0070] ;
[0071] ;
[0072] In the formula, Δx and Δy respectively represent the correction amounts of the bounding box in the x and y directions; α and β represent scaling factors, respectively adjusting the correction amplitudes in the x and y directions; (x min , y min ) and (x max , y max ) respectively represent the upper left and lower right coordinates of the surface defect;
[0073] S85. Update the located defect position to BBox:
[0074] BBox = [(x min - Δx, y min - Δy), (x max + Δx, y max + Δy)].
[0075] The technical solution of the present invention: A slab surface quality detection system based on deep learning, which is used to execute the above-mentioned slab surface quality detection method based on deep learning, includes:
[0076] An image acquisition module, which is used to acquire slab surface data;
[0077] A slab surface data preprocessing module, which is used to perform image enhancement, noise removal, and normalization operations;
[0078] A deep learning detection module, which is used to perform defect recognition based on a deep learning model, that is, to construct a hybrid anomaly detection model;
[0079] An anomaly analysis module, which is used to perform intelligent analysis in combination with the defect type, size, and morphology, and provide quality evaluation;
[0080] The real-time feedback and alarm module is used to automatically trigger the alarm mechanism and provide adjustment suggestions to the production line control system after detecting defects;
[0081] The cloud storage and optimization module is used to optimize the identification of new defects by incremental learning and knowledge distillation, and fine-tune the pre-trained model using transfer learning. It also shares the optimized hybrid anomaly detection model among multiple production lines using federated learning;
[0082] The user interaction terminal visually displays the slab surface data, as well as the detected abnormal information and decision-making suggestions.
[0083] Compared with the prior art, the above technical solutions of the present invention have the following beneficial technical effects:
[0084] The present invention designs a method that, through multi-level preprocessing, advanced deep learning detection technology, and a closed-loop self-learning mechanism, not only achieves significant breakthroughs technically but also has the potential for practical implementation and promotion in industrial applications, demonstrating significant beneficial technical effects:
[0085] (1) Improve detection accuracy and robustness: Real-time collect the slab surface images through high-resolution industrial cameras, line-scan cameras, and laser sensors, and combine preprocessing methods such as adaptive non-local mean filtering, CLAHE, Laplacian edge enhancement, Gamma correction, and Z-score normalization to effectively suppress noise, balance illumination, and enhance the edges of key defects, making the images input into the deep learning model have higher clarity and consistency, ensuring that the model can still work stably in complex industrial environments and greatly improving the detection accuracy and robustness;
[0086] (2) Achieve intelligent self-learning and continuous optimization: By introducing incremental learning, transfer learning, and federated learning mechanisms, the system can automatically update and optimize the model when facing continuously changing new defect samples, solving the problem of "catastrophic forgetting" that traditional models are prone to when dealing with new data. It not only maintains a high recognition ability for existing defect knowledge but also can adapt to new types of defects that appear in the production process, thus ensuring long-term stable and efficient detection performance;
[0087] (3) Multi-scale feature fusion, taking into account both small and large-area defects: Adopt the adaptive feature enhancement (AFE) and attention-guided multi-scale fusion (AGMSF) strategies to effectively connect local details and global context information, enabling the simultaneous capture of small cracks and large-area damages, making the detection system more adaptable and accurate when dealing with defects of different sizes and shapes;
[0088] (4) Real-time feedback and closed-loop control: Realize the whole-process real-time monitoring from data acquisition, processing, defect identification to anomaly analysis and automatic feedback. The detection results can be immediately transmitted to the production control system, and according to the preset rules, trigger alarms or adjust production parameters, thus realizing automated quality control and closed-loop optimization, reducing production risks caused by lag or mistakes in manual judgment, and improving the overall operation efficiency of the production line;
[0089] (5) Ensure anti-interference and state consistency of information during transmission: Through generating binary matching codes and related digital screening mechanisms, perform matching verification on image data to ensure anti-interference and state consistency of the data during transmission. This mechanism not only enhances the security of the system but also provides a reliable data basis for subsequent model training and optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] Figure 1 It is a system architecture diagram of a slab surface quality detection system based on deep learning proposed by the present invention;
[0091] Figure 2 It is a method flow chart of a slab surface quality detection method based on deep learning proposed by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0092] Example 1, as Figure 1 shown, a slab surface quality detection system based on deep learning proposed by the present invention includes: an image acquisition module, a slab surface data preprocessing module, a deep learning detection module, an anomaly analysis module, a real-time feedback and alarm module, a cloud storage and optimization module, and a user interaction terminal.
[0093] The image acquisition module uses a high-resolution industrial camera to acquire high-definition images of the slab surface;
[0094] The slab surface data preprocessing module includes image enhancement, noise removal, and normalization operations to improve the detection robustness;
[0095] The deep learning detection module performs defect identification based on a deep learning model;
[0096] The anomaly analysis module performs intelligent analysis in combination with the defect type, size, and morphology and provides quality assessment;
[0097] The real-time feedback and alarm module automatically triggers an alarm mechanism after detecting a defect and provides adjustment suggestions to the production line control system;
[0098] The cloud storage and optimization module optimizes new defect identification by using incremental learning and knowledge distillation, fine-tuning the pre-trained model through transfer learning, and sharing the optimized hybrid anomaly detection model among multiple production lines by using federated learning;
[0099] The user interaction terminal visually displays the slab surface data, and also displays the detected abnormal information and decision-making suggestions.
[0100] Embodiment 2, as Figure 2 shown, a slab surface quality detection method based on deep learning proposed by the present invention is applied to a slab surface quality detection system based on deep learning proposed in Embodiment 1. The specific implementation steps are as follows:
[0101] S1. Arrange high-resolution industrial cameras, line-scan cameras, and laser sensors on the slab production line to collect slab surface images in real time, and combine light sources to optimize illumination to reduce ambient light interference;
[0102] The image acquisition module aggregates the collected slab surface image data and transmits the slab surface image data to the slab surface data preprocessing module.
[0103] S2. The slab surface data preprocessing module performs preprocessing operations such as noise removal, illumination equalization, grayscale conversion, edge enhancement, and contrast adjustment on the collected slab surface image data to improve the image quality, and performs standardization and normalization processing on the image to ensure that the data distributions input to the deep learning model are consistent. The specific implementation process is as follows:
[0104] S21. Based on the Adaptive Non-Local Means (ANLM) method, it is used for noise removal of the slab surface image. Combining non-local means filtering, local statistical characteristics are introduced to adaptively adjust the filtering parameters, so as to better retain edges and details while suppressing noise. Specifically:
[0105] S2101. Convert the collected slab surface image data into a grayscale image I(x, y), and extract a fixed-size image block (neighborhood block) centered on each pixel point (x, y), denoted as N{x,y}:
[0106] N{x,y}={I(x+l x ,y+l y )|l x ,l y ∈[-k,k]};
[0107] Among them, k (a positive integer) is the radius of the neighborhood block, and its size determines the area range for calculating local statistical information; l x represents the horizontal offset; l y represents the vertical offset;
[0108] S2102. Calculate the local mean and variance within the image block:
[0109] ;
[0110] ;
[0111] Among them, μ(x, y) represents the average gray value of the image block N(x, y); It reflects the local noise level and detail complexity in this area;
[0112] S2103. The smoothing parameter h in traditional non-local mean filtering has an important impact on noise removal and detail preservation. To enable the filter to automatically adjust according to the noise characteristics of different regions, an adaptive parameter h(x, y) is designed:
[0113] h(x, y) = s × σ(x, y) + h 0 ;
[0114] ;
[0115] In the formula, s represents a regulation factor proportional to the noise level; σ(x, y) represents the local standard deviation; h 0 represents the basic smoothing parameter, which is used to ensure a certain smoothing effect in low-noise regions;
[0116] S2104. In a relatively large search window centered on the current pixel (x, y) (assuming the search window size is (2R + 1) × (2R + 1), where R is the search radius), for each candidate pixel (i, j) ∈ Ω(i, j) (Ω represents the search area), image block similarity measurement is performed, and the weighted Euclidean distance is used as the similarity measurement :
[0117] ;
[0118] ;
[0119] In the formula, represents the Gaussian weight function; σ G is a preset parameter, σ G = k / 2;
[0120] S2105. Use the adaptive parameter h(x, y) to convert the distance into a weight w(x, y, i, j):
[0121] ;
[0122] ;
[0123] In the formula, Z(x, y) represents the normalization factor, which ensures that the sum of all weights is 1;
[0124] S2106. Calculate the denoised grayscale value of the current pixel (x, y) as the weighted average of all candidate pixels within the search window, and output the denoised image data I'(x, y): ;
[0125] Accordingly, use the global redundancy information to remove noise from each pixel and adaptively adjust the smoothness degree, so as to perform strong smoothing in high-noise areas and retain more structural information in areas with rich details;
[0126] S22. Since the uneven illumination in the acquisition environment may cause overexposure or underexposure in local areas, affecting the accuracy of defect detection, the adaptive histogram equalization (CLAHE, Contrast Limited Adaptive Histogram Equalization) method is used to perform normalization adjustment on the illumination. The calculation process is as follows:
[0127] ;
[0128] In the formula, I eq (x, y) represents the pixel value of the image after illumination equalization; I min , I max represent the minimum and maximum pixel values within the local window respectively;
[0129] S23. To highlight the defect contours on the slab surface, the Laplacian Operator is used for edge enhancement. The calculation formula is as follows:
[0130] ;
[0131] ;
[0132] In the formula, represents the Laplacian; I edge (x, y) represents the image after edge enhancement;
[0133] Accordingly, highlight the edges of defects such as cracks and scratches, making it easier for the deep learning model to detect the target features;
[0134] S24. Since some defects may have a low contrast with the background and are not easy to detect, the Gamma correction method is used for contrast enhancement. The adjustment formula is as follows:
[0135] ;
[0136] In the formula, I gamma(x, y) represents the pixel value after Gamma correction; γ represents the Gamma value, which is set to 0.5 ≤ γ ≤ 2.5 in this embodiment. When γ < 1, the contrast of the dark part is enhanced, and when γ > 1, the highlight area is compressed;
[0137] Accordingly, the visual effect of the image is optimized, making the defect area more obvious and improving the detection accuracy;
[0138] S25. To improve the stability of the deep learning model, it is necessary to normalize the pixel values to a fixed range. The Z-score normalization method is adopted, and the calculation formula is as follows:
[0139] ;
[0140] ;
[0141] ;
[0142] In the formula, μ represents the mean of the image; σ represents the standard deviation of the image; M and N respectively represent the number of rows and columns of the image, that is, the height and width of the image. Specifically: M: the number of pixel rows in the image, representing the vertical size of the image; N: the number of pixel columns in the image, representing the horizontal size of the image;
[0143] S26. Output the processed image data , which is the processed image data Generate a binary matching code, and the generation process is as follows:
[0144] S2601. Convert the processed image data into binary data data;
[0145] S2602. Select a random number r ∈ , and calculate the auxiliary code Ac = g r mod p;
[0146] Among them, g is the generator of the predefined group G; G is a subgroup of order q of the predefined group ; p is a predefined large prime number, satisfying that q is a factor of p - 1;
[0147] S2603. Based on the matching code CM = H(data || Ac || P 1 ||P 2 ) mod q;
[0148] Among them, || is the concatenation operation; P 1 is a predefined unary auxiliary code, P 1 = g a mod p; P 2 is a predefined binary auxiliary code, P2 = g b mod p; a, b are predefined random components, a, b ∈ ; H is a predefined hash function;
[0149] S2604. Calculate the unary code C 1 = r - a·CM (mod q);
[0150] S2605. Calculate the binary code C 2 = r - b·CM (mod q);
[0151] S2606. Generate the binary matching code CⅡM = (CM, C 1 , C 2 );
[0152] S27. Transmit {the binary matching code CⅡM = (CM, C 1 , C 2 ), the processed image data } to the deep learning detection module.
[0153] S3. The deep learning detection module constructs a hybrid anomaly detection model, introducing an Adaptive Feature Enhancement (AFE) mechanism and an Attention-Guided Multi-Scale Fusion (AGMSF) strategy to make full use of the local feature extraction ability of CNN and the global context modeling ability of Transformer. Specifically:
[0154] S31. Receive {the binary matching code CⅡM = (CM, C 1 , C 2 ), the processed image data }, extract the binary matching code CⅡM = (CM, C 1 , C 2 ) and the processed image data , and use the binary matching code CⅡM = (CM, C 1 , C 2 ) to conduct digital image screening. The screening process is as follows:
[0155] S3101. Convert the received image data into binary data data';
[0156] S3102. Calculate the unary screening code Co: , calculate the binary screening code Ct: ;
[0157] S3103. If Co = Ct, it indicates that the received image data passes the primary screening; otherwise, an alarm is immediately issued.
[0158] S3104. Calculate the reference code CS = H(data'||Co||P 1 ||P 2 ) mod q;
[0159] S3105. If CS = CM, it indicates that the received image data complies with the specification; otherwise, an alarm is immediately issued.
[0160] S32. Extract the processed image data , and input the processed image data into the ResNet+SE (Squeeze-and-Excitation) network for preliminary feature extraction, learn local texture features, and enhance the importance of features through the SE module. The specific process is as follows:
[0161] S3201. Feature extraction by the convolutional layer: ;
[0162] In the formula, F (l) represents the feature map of the l-th layer; W (l) and b (l) represent the convolutional kernel and the bias respectively;
[0163] S3202. Channel attention enhancement (SE module): Adjust the weights of the features of each channel to enhance the key features:
[0164] ;
[0165] ;
[0166] In the formula, Pool() represents the global average pooling operation; W 1 , W 2 represent the weights of the fully connected layer; S c represents the channel attention weight; represents the enhanced feature;
[0167] S33. There is a distribution deviation between the local features F SE extracted by the CNN and the global features required by the subsequent Transformer. Therefore, an AFE unit is constructed to adaptively adjust the local features to match the input of the Transformer. Specifically:
[0168] S3301. Calculate the local feature F SE and the global feature Fglobal Similarity between:
[0169] ;
[0170] In the formula, F global represents the global feature (extracted by the subsequent Transformer model); S represents the similarity matrix between the local feature and the global feature; T represents the matrix transpose operation;
[0171] It should be noted that during the first-round inference, the AFE needs to calculate the similarity between the local feature F SE and the global feature F global , but at this time F global has not been generated yet. To solve this problem, global average pooling (Global Average Pooling, GAP) is first used to approximate the initial global feature: ;
[0172] where, as the pseudo-global feature, provides preliminary global information;
[0173] S3302. Calculate the feature adjustment weight W AFE : W AFE =softmax(S);
[0174] This weight is used to adjust the local feature to make it more conform to the global feature distribution, reduce the deviation between the local feature and the global feature, and enhance the detection ability;
[0175] S3303. Calculate the enhanced feature F AFE :
[0176] ;
[0177] Accordingly: Dynamically adjust the local feature to make it more conform to the distribution of the global feature and improve the overall performance of the model;
[0178] S34. The feature F AFE after being adjusted by the AFE is fed into the Swin Transformer to extract global information. The Swin Transformer can learn features at different scales through a sliding window mechanism and can capture long-range information more accurately. Specifically:
[0179] S3401. Window partitioning: Divide F AFE into multiple windows, and each window independently calculates self-attention:
[0180] ;
[0181] Where Q, K, and V represent the query, key, and value matrices respectively; d k represents the dimension of the key vector;
[0182] S3402. Hierarchical feature extraction: Extract global features F at different scales through multiple Transformer blocks, that is, F tran ; global
[0183] S35. The surface defects of the slab may have different scales. Relying solely on features of a single scale may not be sufficient to detect all defects. Therefore, an attention-guided multi-scale fusion (AGMSF) mechanism is constructed to perform weighted fusion on features of different scales. Specifically:
[0184] S3501. Obtain global features F of the same scale, that is, multi-scale features: small-scale features (suitable for fine cracks), medium-scale features (suitable for medium defects), and large-scale features (suitable for large-area damage); tran ;
[0185] S3502. Calculate the attention weight: W scale = softmax(MLP(F tran ));
[0186] Where W scale represents the multi-scale weight, that is, the importance assignment to features of different scales. Each scale feature will be weighted according to its contribution to the final classification. The larger the weight, the more important the scale feature plays in defect classification; MLP() represents the Multi-Layer Perceptron, which is used here to further process the feature F passing through the Transformer network tran and output the weight of each scale. MLP consists of several fully connected layers and can learn the non-linear relationship between scale features;
[0187] S3503. Weightedly fuse features of different scales to generate the fused feature F fusion ;
[0188] Accordingly, the detection accuracy is improved, making the model more sensitive to defects of different scales;
[0189] S36. Send the fused feature F fusion into the fully connected layer for defect classification: ;
[0190] where P represents the probability of different defect categories; W fc represents the weight of the fully connected layer; b fc represents the bias;
[0191] S37. Calculate the confidence C using multi-scale confidence fusion: ;
[0192] where C i represents the defect confidence of the i-th scale; represents the weight corresponding to the i-th scale;
[0193] S38. Output {defect category P, target bounding box position Bounding Box, defect confidence C}, and transmit it to the anomaly analysis module.
[0194] S4. Based on {defect category P, target bounding box position Bounding Box, defect confidence C}, the anomaly analysis module performs defect classification and localization by integrating this information, accurately determining the defect type, location, and its confidence, while improving the accuracy, robustness, and real-time performance of detection. Specifically:
[0195] S41. Through deep learning model inference, the obtained defect category P is the result of classifying each detected defect, and the multi-dimensional confidence fusion technology is used to optimize the classification result by combining the correlation between the confidence C and the category. Specifically:
[0196] S4101. Extract the predefined confidence threshold C threshold , and exclude the detection results with confidence lower than this threshold;
[0197] S4102. Based on the defect category P, combine the defect category and the confidence through the confidence weighted strategy to improve the reliability of classification: P' = P · C;
[0198] where P′ is the final weighted defect category vector; C is the defect confidence, that is, the reliability of defect location and category detection;
[0199] S4103. Determine the final category of the defect by maximizing the weighted category probability P': P final = argmax(P');
[0200] where P final represents the finally determined defect category;
[0201] Accordingly: By combining the defect confidence and the category probability, and eliminating some misclassifications with high confidence through weighting, the overall classification accuracy is improved;
[0202] S42. When locating defects, accurately confirm the defect positions according to the Bounding Box inferred by the model. The Bounding Box is in the form of [(x min , y min ), (x max , y max )]. (x min , y min ) and (x max , y max ) respectively represent the upper left and lower right coordinates of the surface defect. To improve the positioning accuracy, use the Adaptive Localization Correction algorithm to fine-tune the positioning result based on the defect confidence C:
[0203] ;
[0204] ;
[0205] In the formula, Δx and Δy respectively represent the correction amounts of the bounding box in the x and y directions; α and β represent the scaling factors, which respectively adjust the correction amplitudes in the x and y directions.
[0206] Update the located defect position to BBox:
[0207] BBox = [(x min - Δx, y min - Δy), (x max + Δx, y max + Δy)];
[0208] Accordingly: Through adaptive position correction, reduce errors and optimize the positioning accuracy to complete the precise positioning of high-confidence defects;
[0209] S43. Combine the defect category and the defect position to output the final detection result. Generate a complete defect detection report Report by integrating the category probability P final of the defect and the bounding box position BBox. Report = {Defect category: P final ; Defect position: BBox; Confidence: C};
[0210] S44. Transmit the defect detection report Report to the real-time feedback and alarm module and the cloud storage and optimization module.
[0211] S5. The real-time feedback and alarm module automatically evaluates the quality of the slab according to the defect type and severity, and combines the production standards to make corresponding decisions:
[0212] If the defect is a minor surface defect (including but not limited to small scratches), automatically determine whether it can be repaired by subsequent processes (including but not limited to polishing, spraying);
[0213] If the defect affects structural safety (including but not limited to severe cracks), immediately send an alarm and recommend adjusting production parameters;
[0214] If the defect exceeds the set acceptable range, automatically mark the slab as non - conforming and recommend scrapping or rework.
[0215] S6. The cloud storage and optimization module stores the detection results. Combining historical detection data, it uses transfer learning and incremental learning to optimize the hybrid anomaly detection model to adapt to newly emerging defect types. At the same time, the system adopts federated learning or cloud training technology to continuously improve the detection accuracy of the model without affecting production. Specifically:
[0216] S61. Since new defect types may appear on the slab surface with changes in production conditions, to avoid the problem of catastrophic forgetting, that is, the learning of new data causes the model to forget old knowledge, incremental learning is introduced and combined with the knowledge distillation method to enable the model to maintain a high detection accuracy for original defects while learning new defect types:
[0217] Define the current model as , whose parameters are θ t , and the goal is to optimize the model when new defect samples D new arrive without forgetting old knowledge:
[0218] L total =L new +λL distill ;
[0219] ;
[0220] ;
[0221] Among them, L total represents the total loss of the model in the current iteration, which is used to measure the comprehensive error of new data learning and old knowledge retention; L new represents the loss function based on new defect data; L distill represents the knowledge distillation loss, which uses KL divergence to measure the difference between the outputs of the new model and the old model, preventing the model from forgetting old knowledge when learning new knowledge; λ represents the trade - off factor, which is used to adjust the ratio between the new loss and the distillation loss to ensure that the model can adapt to new data and maintain memory of previous knowledge; N' represents the total number of new defect data samples; xi represents the input image data of the i-th new sample; y i represents the corresponding true defect category label of the i-th sample, and one-hot encoding is adopted in this embodiment; represents the current model (with parameters θ t ) for the input x i prediction probability, reflecting the model's judgment on various categories; P old (x i ) represents the prediction probability distribution output by the old model (previous version) for the sample x i , which is used as a "soft label"; P new (x i ) represents the prediction probability distribution output by the current model for the sample x i , which is used to compare with the old model to ensure that the new model does not deviate from the original judgment when learning new knowledge;
[0222] S62. Since the amount of new defect sample data is small, it is costly to directly train the hybrid anomaly detection model from scratch. Therefore, transfer learning is used for optimization. A pre-trained model (Pretrained Model) is adopted and fine-tuned (Fine-Tuning) on the existing defect data set. The fine-tuning strategy is: freeze the first few layers of the feature extraction layer and only optimize the classification layer (assuming that the parameters of the hybrid anomaly detection model consist of the feature extraction layer and the classification layer); and perform a small amount of training on the new data set to prevent overfitting;
[0223] S63. Since slab production may be distributed in multiple factories and the defect types of different production lines may vary, federated learning (Federated Learning, FL) is adopted. The model is updated through the federated average algorithm (FedAvg). Local models are trained on several devices, and model fusion is performed in the cloud to ensure that different production lines share the optimized intelligent detection model.
[0224] S7. The user interaction terminal visually displays the slab surface data, detection reports, and decision-making suggestions.
[0225] The embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited thereto. Various changes can be made without departing from the spirit of the present invention within the knowledge scope of those skilled in the art to which the present invention pertains.
Claims
1. A slab surface quality detection method based on deep learning, characterized in that: The specific implementation steps include the following: S1. Collect slab surface data; S2, based on adaptive non-local mean filtering denoising, using global redundant information to remove noise from each pixel, combining adaptive histogram equalization to balance illumination and Laplacian operator to enhance edges, optimizing contrast through Gamma correction, performing Z-score normalization, and generating binary matching codes; S3. Use binary matching codes to screen data, build a hybrid anomaly detection model, combine ResNet and SE modules to extract local features, and match local and global features. Use Swin Transformer to extract global information, fuse multi-scale features, classify defects through the fully connected layer, and output {defect category, target bounding box location, defect confidence}; S4. Obtain defect categories based on deep learning reasoning, optimize classification results through confidence fusion, use adaptive position correction algorithm to improve defect location accuracy, and generate inspection reports based on defect categories and location information; S5. Analyze defect types and severity, automatically evaluate slab quality, and make decision recommendations; S6. Through incremental learning and knowledge distillation, transfer learning is used to fine-tune the pre-trained model to optimize new defect recognition, and federated learning is used to share the optimized hybrid anomaly detection model among multiple production lines; S7. Visual display of slab surface data, test reports and decision recommendations.
2. A slab surface quality detection method based on deep learning according to claim 1, characterized in that: The denoising process of adaptive non-local mean filtering denoising is as follows: S21, convert the collected slab surface data into a grayscale image I(x,y), extract a fixed-size image block centered on any pixel point (x,y), i.e., a neighborhood block, denoted as N{x,y}: N{x,y}={I(x+l x ,y+l y )|l x ,l y ∈[-k,k]}; Where k is the radius of the neighborhood block, k is a positive integer; l x Indicates the lateral offset; l y Indicates the longitudinal offset; S22. Calculate the local mean and variance within the image block: ; ; Wherein, μ(x,y) represents the average gray value of the image block N(x,y); It reflects the local noise level and detail complexity within the image block N(x,y); S23, design adaptive parameters h(x,y): h(x,y)=s×σ(x,y)+h0; ; Where s represents the adjustment factor proportional to the noise level; σ(x,y) represents the local standard deviation; h0 represents the basic smoothing parameter; S24. In a larger search window centered on the current pixel (x, y), perform image block similarity measurement on each candidate pixel (i, j) ∈ Ω(i, j): ; ; in, represents the Gaussian weight function; σ G is the preset parameter, σ G =k / 2; Ω represents the search area; represents a similarity measure; S25. Use the adaptive parameter h(x,y) to convert the distance into weight w(x,y,i,j): ; ; Where Z(x,y) represents the normalization factor; S26, calculate the denoised grayscale value of the current pixel (x, y) as the weighted average of all candidate pixels in the search window, and output the denoised image data I'(x, y): .
3. The slab surface quality detection method based on deep learning according to claim 1 is characterized in that: The binary matching code generation process is as follows: S31, the processed image data Convert to binary data data; S32, select a random number r∈ , calculate the auxiliary code Ac=g r mod p; Where g is the generator of the predefined group G; G is the predefined group A subgroup of order q; p is a predefined large prime number such that q is a factor of p-1; S33, based on the matching code CM=H(data||Ac||P1||P2) mod q; Among them, || is a concatenation operation; P1 is a predefined unary auxiliary code, P1=g a mod p; P2 is a predefined binary auxiliary code, P2=g b mod p; a, b are predefined random components, a, b∈ ; H is a predefined hash function; S34, calculating the unary code C1=ra·CM (mod q), calculating the binary code C2=rb·CM (mod q); S35. Generate a binary matching code CⅡM=(CM, C1, C2).
4. The method for detecting slab surface quality based on deep learning according to claim 3 is characterized in that: The screening process for data screening using binary matching codes is as follows: S41, image data Convert to binary data data'; S42, calculate the unary screening code Co: , calculate the binary screening code Ct: ; S43. If Co=Ct, it means that the received image data If the primary screening is passed, an alarm will be given immediately; otherwise, S44, calculate the reference code CS = H (data'||Co||P1||P2) mod q; S45. If CS=CM, it means the received image data If it complies with the regulations, an alarm will be given immediately.
5. The slab surface quality detection method based on deep learning according to claim 1 is characterized in that: The detection process of the hybrid anomaly detection model is as follows: S51, the processed image data Input ResNet+SE network for preliminary feature extraction, and use ResNet to extract the feature map F of the lth layer (l) , and use the SE module to adjust the weight of the features of each channel: ; ; In the formula, F (l) represents the feature map of layer l; W (l) and b (l) Respectively represent convolution kernel and bias; Pool() represents global average pooling operation; W1 and W2 represent the weights of the fully connected layer; S c represents SE attention weight; Represents the enhanced local features; S52, construct an adaptive feature enhancement unit AFE, adaptively adjust the local features, and convert the features F adjusted by AFE into AFE Swin Transformer is used to extract global information, and F AFE Divide into several windows, each window independently calculates self-attention, and extracts global features F of different scales tran ; S53, obtain the global feature F of the same scale tran , weighted fusion of global scale and enhanced local features to generate fusion feature F fusion , the fusion feature F fusion Send it to the fully connected layer for defect classification and output the probability P of different defect categories; S54. Calculate the confidence C by using multi-scale confidence fusion: , output {defect category P, target bounding box location Bounding Box, defect confidence C}; In the formula, C i represents the defect confidence level of the i-th scale; Represents the weight corresponding to the i-th level scale.
6. A slab surface quality detection method based on deep learning according to claim 5, characterized in that: The process of adaptively adjusting local features is as follows: S61. Calculate local feature F SE and the global feature F global The similarity between: ; In the formula, F global represents the global feature; S represents the similarity matrix between local features and global features; T represents the matrix transposition operation; S62, calculate feature adjustment weight W AFE :W AFE =softmax(S); S63. Calculate the enhanced feature F AFE : .
7. A slab surface quality detection method based on deep learning according to claim 6, characterized in that: Global feature F global In the first round of reasoning, the local feature F SE Use global average pooling to get the initial global features: ; in, As a pseudo-global feature; GAP() represents a global average pooling operation.
8. The method for detecting slab surface quality based on deep learning according to claim 1, characterized in that: The optimization process for optimizing classification results is as follows: S81. Extracting a predefined confidence threshold C threshold , exclude the confidence level lower than the confidence threshold C threshold The test results; S82. Based on the defect category P, the defect category and the confidence are combined through a confidence weighting strategy to improve the reliability of classification: P'=P·C; Among them, P′ is the final weighted defect category vector; C is the defect confidence; S83. Determine the final category of the defect by maximizing the weighted category probability P': P final =argmax(P'); Among them, P final Indicates the defect category finally determined; S84, using the adaptive position correction algorithm, fine-tuning the positioning result based on the defect confidence C: ; ; Where Δx and Δy represent the correction amount of the bounding box in the x and y directions respectively; α and β represent the scaling factors, which adjust the correction amplitude in the x and y directions respectively; (x min ,y min ) and (x max ,y max ) represent the coordinates of the upper left corner and lower right corner of the defect; S85. Update the located defect position to BBox: BBox=[(x min -Δx,y min -Δy),(x max +Δx,y max +Δy)]。 9. A slab surface quality detection system based on deep learning, which is used to execute a slab surface quality detection method based on deep learning according to any one of claims 1 to 8, characterized in that: include: Image acquisition module, used to collect slab surface data; Slab surface data preprocessing module, used for image enhancement, noise removal, and normalization operations; Deep learning detection module, which is used to identify defects based on deep learning models, i.e., building a hybrid anomaly detection model; Abnormal analysis module, which is used to conduct intelligent analysis based on defect type, size, and shape, and provide quality assessment; Real-time feedback and alarm module, which is used to automatically trigger the alarm mechanism after detecting defects and provide adjustment suggestions to the production line control system; Cloud storage and optimization module, which is used to optimize new defect identification by fine-tuning pre-trained models through incremental learning and knowledge distillation, and to share optimized hybrid anomaly detection models across multiple production lines using federated learning; The user interaction terminal visualizes the slab surface data and displays detected anomaly information and decision suggestions.
Citation Information
Patent Citations
Carbon filament surface defect detection method based on deep learning
CN115358977A
Casting surface defect detection method and system based on improved DETR
CN117314837A
Optical detection method for apparent defects of flexible production line
CN119477862A