Method and system for detecting nonmetallic inclusions in steel based on background reconstruction
Through the detection method based on background reconstruction, the difference between the reconstructed image and the original image after removing inclusions is generated, combined with unsupervised training and post-processing modules, the problem of low detection accuracy of non-metal inclusions in steel in the prior art is solved, and efficient and robust detection effect is achieved.
Patent Information
- Application Number
- CN202510478908.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-07-25
AI Technical Summary
The detection methods for non-metal inclusions in steel in the prior art rely on supervised learning, and are limited by the quality and scale of labeled data, resulting in low detection accuracy and susceptible to background interference, making it difficult to achieve efficient and objective quality inspection.
The detection method based on background reconstruction is adopted, and the difference between the reconstructed image and the original image after removing inclusions is calculated, combined with unsupervised training and post-processing modules, the detection results are optimized to reduce noise and misjudgment probability.
It improves the accuracy and efficiency of detection, reduces dependence on labeled data, enhances the robustness and adaptability of the algorithm, and is suitable for inclusion detection in complex backgrounds.
Smart Images

Figure CN120374572A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of non-metallic inclusions detection, and particularly to a method and system for detecting non-metallic inclusions in steel based on background reconstruction. Background Art
[0002] The detection of non-metallic inclusions in steel is a core link for evaluating the internal quality of steel, directly affecting the judgment of product performance and process improvement. In the scenario of manual detection, the detection efficiency and result consistency are limited by the experience level of the operator, and there is an efficiency bottleneck in large-scale sample analysis. How to achieve efficient and objective automated detection has become a technical requirement urgently to be broken through in this field.
[0003] Computer vision technology provides a new direction for solving the above requirements. In related technologies, detection methods based on supervised learning are widely adopted: for example, using neural networks to locate punctiform inclusions, using the segmentation algorithm based on MaskR-CNN to achieve multi-category detection, and using a step-by-step recognition strategy combining a segmentation network and a classification model. These methods train the model to recognize the morphological features of inclusions through labeled data, and some literatures also improve the detection accuracy by optimizing the network structure.
[0004] However, the performance of the supervised learning method is limited by the quality and scale of the labeled data. Since the labeling of inclusions requires professional metallurgical knowledge, the data labeling cost is high and the cycle is long, and the samples of some types of inclusions are scarce in actual production, resulting in a significant decline in the detection ability of the model for low-frequency samples. In addition, the detection method based on convolutional neural network relies on local texture features and is prone to false detection when there are scratches or contaminants on the surface of the specimen. How to construct a detection method with low labeling dependence and strong anti-interference ability has become a key technical problem for optimizing the solution. Summary of the Invention
[0005] This application provides a method and system for detecting non-metallic inclusions in steel based on background reconstruction to solve the problem that the detection method of non-metallic inclusions in steel is difficult to meet the high-precision and high-efficiency quality inspection requirements.
[0006] The first aspect of this application provides a method for detecting non-metallic inclusions in steel based on background reconstruction, including:
[0007] Obtain an input image to be detected;
[0008] Input the input image into a background reconstruction module to generate a reconstructed image after removing inclusions;
[0009] Calculate the difference between the input image and the reconstructed image to obtain a detection result image containing inclusions;
[0010] Process the detection result image through a post-processing module to output the detection result of inclusions.
[0011] The above detection method generates a reconstructed image without inclusions through a background reconstruction module, and performs difference calculation in combination with the original input image, which can effectively distinguish the background information from the target area of inclusions. The model is based on unsupervised training, which can alleviate the detection errors caused by insufficient and unbalanced target samples. The post-processing module optimizes the preliminary detection results to further reduce the noise and false judgment probability and improve the integrity of the inclusion contour. The entire process improves the detection accuracy through a phased processing mechanism while maintaining the algorithm operation efficiency, solving the problem that the detection method of non-metallic inclusions in steel is difficult to meet the quality inspection requirements of high precision and high efficiency.
[0012] Optionally, the training method of the background reconstruction module includes:
[0013] Obtain an input image and a corresponding input mask, where the input mask is used to mark the inclusion area through a binary matrix;
[0014] Overlay a randomly generated inclusion template image on the input image through an inclusion generation module to generate a simulated image and a corresponding inclusion mask;
[0015] Input the simulated image and the inclusion mask into a background reconstruction network to generate a reconstructed image;
[0016] Input the input image, the input mask, and the inclusion mask into a loss calculation module to output a reconstruction loss.
[0017] The above training method can enhance the diversity and coverage of training data and improve the model's recognition ability for inclusions of different forms by obtaining real input images and their mask marking data and combining the method of randomly generating simulated inclusions; input the simulated image and the mask jointly into the background reconstruction network, and optimize the extraction accuracy of the background features of the network by comparing the differences between the real background and the simulated inclusion area, reducing the risk of overfitting; based on the multi-dimensional loss calculation of real input images, original masks, and generated masks, effectively balance the ability of background preservation and inclusion removal, making the reconstruction result more in line with the actual scenario requirements and providing an accurate background reference basis for subsequent detection.
[0018] Optionally, the step of overlaying a randomly generated inclusion template image on the input image through an inclusion generation module to generate a simulated image and a corresponding inclusion mask includes:
[0019] Randomly select multiple inclusion template images and corresponding inclusion masks from an inclusion library;
[0020] Randomly select multiple positions in the input image for adding the inclusion template image;
[0021] Add the inclusion template image to the corresponding position in the input image and update the input mask to output a simulated image and the corresponding inclusion mask.
[0022] By randomly selecting template images from the inclusion library and combining with the background features of the input image, the above steps can generate simulated inclusion samples with diverse positions and morphological distributions, improving the model's adaptability to complex scenarios; dynamically adjusting the inclusion distribution based on the random position superposition mechanism, enhancing the spatial coverage of the training data, and reducing the learning bias caused by fixed patterns; clarifying the inclusion superposition area through synchronous mask update, making the fusion of the simulated image and the real background more in line with the actual reconstruction requirements, assisting the model to accurately distinguish the background and inclusion features, and providing a highly robust training data basis for the subsequent reconstruction network.
[0023] Optionally, the calculation formula for the simulated image is:
[0024]
[0025] where, I1 is the input image; P is the position transformation function; I J is the inclusion template image; k is the number of inclusions added.
[0026] Optionally, the calculation formula for the inclusion mask is:
[0027]
[0028] where, M1 is the input mask; P is the position transformation function; M J is the inclusion mask; k is the number of inclusions added.
[0029] Optionally, the calculation formula for the loss calculation module is:
[0030] L1 = M1 × (1 - M2) × ||I1 - I3|| d ;
[0031] L2 = M2 × ||I1 - I3|| d ;
[0032] L = W1 × L1 + W2 × L2;
[0033] where, L1 is the background preservation loss; L2 is the inclusion removal loss; L is the reconstruction loss; W1, W2 are preset weight coefficients, ||·|| d is the distance function; I1 is the input image; I3 is the reconstructed image; M1 is the input mask; M2 is the inclusion mask.
[0034] Optionally, the steps of processing the detection result image by the post-processing module to output the inclusion detection result include:
[0035] Threshold the detected result image to obtain inclusion information;
[0036] Extract the regions and positions corresponding to each inclusion in the inclusion information by the connected component method;
[0037] Classify each inclusion based on a preset physical and chemical inspection rule or a classification neural network;
[0038] Calculate grading indexes for each inclusion to obtain parameter indexes of the inclusions;
[0039] Output the inclusion detection result according to the regions and positions, classifications, and parameter indexes of the inclusions corresponding to each inclusion.
[0040] The above steps clearly distinguish inclusions from the background area through thresholding processing, and combine the connected component analysis method to extract the positions and morphological features of each inclusion, which can improve the positioning accuracy and regional integrity of the detection result; based on the dual classification mechanism of a preset rule or a classification network, enhance the discrimination ability of different types of inclusions and improve the reliability of parameter grading; quantify parameters such as the size and distribution of inclusions through grading index calculation, provide standardized data support for material property evaluation, so that the final detection result covers spatial, category, and quantification dimension information at the same time, and improves the comprehensive reference value of the detection report.
[0041] The second aspect of this application provides a non-metallic inclusion detection system in steel based on background reconstruction, which is applicable to the non-metallic inclusion detection method in steel based on background reconstruction described in the first aspect. The system includes:
[0042] An image acquisition module for acquiring an input image to be detected;
[0043] A background reconstruction module for generating a reconstructed image after removing inclusions;
[0044] A difference calculation module for calculating the difference between the input image and the reconstructed image to obtain a detection result image containing inclusions;
[0045] A post-processing module for processing the detection result image to output an inclusion detection result.
[0046] The above system obtains the original specimen data through the image acquisition module, generates a background reference image without inclusions by combining with the background reconstruction module, and accurately extracts the inclusion distribution characteristics by using the difference calculation module to reduce the interference of background texture on detection; the post-processing module optimizes the detection results based on the morphological analysis and classification mechanism, suppresses noise and improves the accuracy of inclusion classification and parameter calculation; each module collaborates to optimize the process, enhances the stability and interpretability of the detection results while maintaining the operation efficiency, and provides a quantifiable and highly robust inclusion analysis solution for industrial quality inspection scenarios.
[0047] Optionally, the background reconstruction module includes an encoder, an attention module, and a decoder;
[0048] The encoder is composed of several neural network layers with downsampling, which is used to reduce the image dimension and extract the effective features of the image. Each feature represents the main information within a certain area range of the image;
[0049] The attention module takes the output features of the encoder as input and is composed of several Transformer encoding layers. It uses the self-attention mechanism to perform global reconstruction based on the image features and fits the background features of the inclusion area;
[0050] The decoder contains several neural network layers with upsampling, which is used to reconstruct the background image without inclusions from the output features of the attention module.
[0051] The background reconstruction module extracts multi-level regional features through the downsampling structure of the encoder, retains the effective information of the image and compresses redundant data, providing a feature expression with high semantic density for subsequent processing; the attention module uses the self-attention mechanism to perform correlation modeling on the global features, enhances the model's ability to identify background texture and inclusion areas, and improves the fitting accuracy of background features under complex backgrounds; the decoder gradually restores the image spatial resolution through upsampling operations, combines the global features output by the attention module with the local features of the encoder, and realizes the accurate reconstruction of the background image, providing a highly consistent reference benchmark for inclusion detection and reducing the reconstruction error caused by the loss of local features.
[0052] Optionally, the non-metallic inclusion detection system in steel based on background reconstruction further includes an offline training module, and the offline training module includes:
[0053] A data augmentation unit, which is used to generate training samples by randomly superimposing inclusion templates;
[0054] A loss calculation unit, which is used to calculate the reconstruction loss according to the background retention loss and the inclusion removal loss;
[0055] A parameter optimization unit, which is used to update the neural network parameters through the backpropagation algorithm.
[0056] The offline training module randomly generates inclusion superposition samples through a data augmentation unit to expand the morphology and distribution diversity of training data, alleviating the limitation of the model generalization ability caused by insufficient real samples; combines a dual-constraint mechanism of background preservation loss and inclusion removal loss to balance the restoration accuracy of background features and the suppression effect of inclusion regions by the model, reducing the feature learning bias caused by a single loss function; the parameter optimization unit dynamically adjusts the network weights based on the backpropagation algorithm, enabling the model to gradually adapt to the distribution law of complex samples during the iteration process, improving the robustness of background reconstruction, and providing a pre-trained model foundation with stronger adaptability for actual detection scenarios.
[0057] As can be seen from the above technical solutions, the present application provides a method and system for detecting non-metallic inclusions in steel based on background reconstruction. The method includes: obtaining an input image to be detected; inputting the input image into a background reconstruction module to generate a reconstructed image after removing inclusions; calculating the difference between the input image and the reconstructed image to obtain a detection result image containing inclusions; and processing the detection result image through a post-processing module to output an inclusion detection result. The method has low requirements for data annotation and is not affected by the imbalance of inclusion sample categories. The algorithm has stronger adaptability and robustness, solving the problem that the method for detecting non-metallic inclusions in steel is difficult to meet the quality inspection requirements of high precision and high efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0059] Figure 1 It is a schematic flowchart of the method for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiment of the present application;
[0060] Figure 2 It is a schematic diagram of the detection effect of the method for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiment of the present application;
[0061] Figure 3 It is a schematic flowchart of the inference process of the system for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiment of the present application;
[0062] Figure 4 It is a schematic flowchart of the training process of the background reconstruction module in the method for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiment of the present application;
[0063] Figure 5Schematic diagram of the processing flow of the inclusion generation module in the method for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiments of the present application;
[0064] Figure 6 Schematic diagram of the structure of the background reconstruction module in the system for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiments of the present application;
[0065] Figure 7 Schematic diagram of the working process of the loss calculation module in the method for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiments of the present application;
[0066] Figure 8 Schematic diagram of the processing flow of the post-processing module in the method for detecting non-metallic inclusions in steel based on background reconstruction provided by the embodiments of the present application. Detailed implementation manners
[0067] The embodiments will be described in detail below, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following embodiments do not represent all the implementation manners consistent with the present application. They are only examples of the systems and methods consistent with some aspects of the present application.
[0068] The detection of non-metallic inclusions in steel, as an important content of metallographic inspection, is a key link in evaluating the internal quality of steel products and has attracted much attention in the steel industry. The related detection methods rely heavily on manual operation and empirical judgment, and there are problems such as high labor intensity, low detection efficiency, strong detection subjectivity, and difficulty in ensuring the consistency of detection results.
[0069] With the development of artificial intelligence technology, researchers have applied computer vision technology to the detection of non-metallic inclusions. For example, neural networks are used for detecting punctiform non-metallic inclusions; a segmentation algorithm based on MaskRCNN is used to detect various types of inclusions in images. To further improve the detection accuracy, the segmentation algorithm is also used to detect inclusions, and then a classification model is used to identify the types of inclusions.
[0070] The above methods are all based on supervised learning and require a large amount of labeled data of inclusions for model training. The quantity and quality of the labeled data will affect the performance of the model. The labeling of inclusions requires the labelers to have certain professional knowledge, and the labeling is difficult, costly, and time-consuming. In addition, some types of inclusions are less likely to appear in production, and it is difficult to collect samples. The imbalance of data samples will cause the model to tend to detect common types, and the detection ability for inclusions with less data is poor. In addition, most of these related detection or segmentation algorithms use convolutional networks and detect based on the local texture information of the image, and are easily affected by interference objects such as scratches and dirt.
[0071] To solve the problem that the detection methods for non-metallic inclusions in steel are difficult to meet the quality inspection requirements of high precision and high efficiency, refer to Figure 1 - Figure 2 , some embodiments of the present application provide a detection method for non-metallic inclusions in steel based on background reconstruction, including:
[0072] S100: Obtain the input image I1 to be detected.
[0073] S200: Input the input image I1 into the background reconstruction module to generate a reconstructed image I3 after removing inclusions.
[0074] S300: Calculate the difference between the input image I1 and the reconstructed image I3 to obtain a detection result image R containing inclusions.
[0075] Specifically, subtract the input image I1 from the reconstructed image I3, and the resulting difference image corresponds to the detection result image R of inclusions.
[0076] S400: Process the detection result image R through a post-processing module to output the inclusion detection result.
[0077] It should be understood that the present invention uses an unsupervised method to learn the background information in the image, and the reconstructed image I3 does not contain the state of inclusions. The post-processing module can be used to calculate the grading indexes such as the inclusion category, length, and width in the detection result image R.
[0078] The above detection method generates a reconstructed image without inclusions through the background reconstruction module, combines the original input image for difference calculation, can effectively distinguish the background information from the inclusion target area, and the model is based on unsupervised training, which can alleviate the detection errors caused by insufficient and unbalanced target samples; the post-processing module optimizes the preliminary detection result, further reduces the noise and misjudgment probability, and improves the integrity of the inclusion contour; the entire process improves the detection accuracy through a staged processing mechanism, while maintaining the algorithm operation efficiency, and solves the problem that the detection methods for non-metallic inclusions in steel are difficult to meet the quality inspection requirements of high precision and high efficiency.
[0079] Considering that it is difficult to obtain a sample completely without inclusions in actual production, it is necessary to use an image with inclusions (i.e., the input image I1) to train the background reconstruction module. In some embodiments, refer to Figure 4 , the training method of the background reconstruction module includes:
[0080] Obtain the input image I1 and the corresponding input mask M1.
[0081] It should be understood that the input mask M1 is used to exclude the influence of the inclusion area. The input mask M1 is a binary matrix with the same size as the input image I1, which is used to mark the pixel points in the image. In the input image I1, if the point (i, j) at a certain position belongs to the inclusion, then M1(i, j) = 1; otherwise, M1(i, j) = 0. M1 can be calculated based on the annotation of the inclusion. The requirement for the fitting degree of the input mask M1 to the inclusion contour is not high. The main purpose is to exclude the influence of the existing inclusions in the image on the calculation of the background reconstruction loss.
[0082] The inclusion generation module superimposes a randomly generated inclusion template image on the input image I1 to generate a simulated image I2 and the corresponding inclusion mask M2.
[0083] It should be understood that I1 and M1 are input into the inclusion generation module, and inclusions are randomly added to the input image I1 to obtain a simulated image I2. The inclusion mask M2 is used to record the position information of the added inclusions. M2(i, j) = 1 indicates that an inclusion is added at this position, and M2(i, j) = 0 indicates that no inclusion is added at this position. The inclusion information added in I2 and M2 will be used to train the background reconstruction network to learn the ability to remove inclusions and reconstruct the background.
[0084] The simulated image I2 and the inclusion mask M2 are input into the background reconstruction network to generate a reconstructed image I3.
[0085] It should be understood that the background reconstruction network is used to remove the inclusions in the simulated image I2 and perform background filling to generate a reconstructed image I3 after removing the inclusions.
[0086] The input image I1, the input mask M1, and the inclusion mask M2 are input into the loss calculation module to output the reconstruction loss L.
[0087] It should be understood that the above loss calculation includes two parts: the information retention ability of the background area and the removal ability of the inclusion area.
[0088] The above training method can enhance the diversity and coverage of training data and improve the model's recognition ability for inclusions of different forms by obtaining real input images and their mask marking data and combining the method of randomly generating simulated inclusions; by jointly inputting the simulated image and the mask into the background reconstruction network, the extraction accuracy of the background features of the network is optimized by comparing the differences between the real background and the simulated inclusion area, reducing the risk of overfitting; based on the multi-dimensional loss calculation of real input images, original masks, and generated masks, the ability to balance background retention and inclusion removal is effectively achieved, making the reconstruction result more in line with the actual scene requirements and providing an accurate background reference basis for subsequent detection.
[0089] In some embodiments, referring to Figure 5 , the steps of generating a simulated image I2 and a corresponding inclusion mask M2 by superimposing a randomly generated inclusion template image on the input image I1 by an inclusion generation module include:
[0090] Randomly select k inclusion template images from an inclusion library and the corresponding inclusion masks
[0091] Randomly select k positions in the input image I1 for adding the inclusion template images.
[0092] Add the inclusion template images to the corresponding positions in the input image I1 and update the input mask M1 to output the simulated image I2 and the corresponding inclusion mask M2.
[0093] The above steps can generate simulated inclusion samples with diverse positions and morphological distributions by randomly selecting template images from the inclusion library and combining with the background features of the input image, improving the model's adaptability to complex scenarios; dynamically adjusting the inclusion distribution based on the random position superposition mechanism, enhancing the spatial coverage of the training data, and reducing the learning bias caused by fixed patterns; clearly defining the inclusion superposition area through mask synchronous update, making the fusion of the simulated image and the real background more in line with the actual reconstruction requirements, assisting the model to accurately distinguish the background and inclusion features, and providing a highly robust training data basis for the subsequent reconstruction network.
[0094] In some embodiments, the calculation formula for the simulated image I2 is:
[0095]
[0096] where I1 is the input image; P is a position transformation function; I J is the inclusion template image; and k is the number of inclusions added.
[0097] It should be understood that the position transformation function is used to transform the inclusion template image and the inclusion mask to the specified positions. Specifically, it can be implemented by methods such as translation transformation and affine transformation.
[0098] In some embodiments, the calculation formula for the inclusion mask M2 is:
[0099]
[0100] where M1 is the input mask; P is a position transformation function; M J is the inclusion mask; and k is the number of inclusions added.
[0101] In some embodiments, referring toFigure 7 , the calculation formula of the loss calculation module is:
[0102] L1 = M1 × (1 - M2) × ||I1 - I3|| d ;
[0103] L2 = M2 × ||I1 - I3|| d ;
[0104] L = W1 × L1 + W2 × L2;
[0105] Wherein, L1 is the background retention loss; L2 is the inclusion removal loss; L is the reconstruction loss; W1 and W2 are preset weight coefficients, and ||·|| d is the distance function; I1 is the input image; I3 is the reconstructed image; M1 is the input mask; M2 is the inclusion mask.
[0106] It should be understood that the loss calculation module calculates the reconstruction loss based on the input image I1, the input mask M1, the inclusion mask M2, and the reconstructed image I3. Among them, the background retention loss L1 enables the model to change the information of the background area as little as possible during the reconstruction process, and the inclusion removal loss L2 enables the model to remove the inclusion information as well as possible during the reconstruction process and reconstruct the background of the inclusion area. W1 and W2 are used to adjust the proportion of these two losses in the total loss.
[0107] In some embodiments, referring to Figure 8 , the steps of processing the detection result image R by the post-processing module to output the inclusion detection result include:
[0108] Threshold the detection result image R to obtain inclusion information.
[0109] Extract the regions and positions corresponding to each inclusion in the inclusion information by the connected component method.
[0110] Classify each inclusion based on preset physical and chemical inspection rules or classification neural networks.
[0111] Calculate the grading index for each inclusion to obtain the parameter index of the inclusion.
[0112] Output the inclusion detection result according to the regions and positions, classifications, and parameter indexes of each inclusion.
[0113] It should be understood that the grading index calculation can calculate the length and width corresponding to the inclusion according to relevant national and industry standards for subsequent metallographic grading.
[0114] The above steps clearly distinguish inclusions from the background area through thresholding, and combine the connected component analysis method to extract the position and morphological characteristics of each inclusion, which can improve the positioning accuracy and regional integrity of the detection results; based on the dual classification mechanism of preset rules or classification networks, the ability to distinguish different types of inclusions is enhanced, and the reliability of parameter grading is improved; by calculating grading indicators, parameters such as the size and distribution of inclusions are quantified, providing standardized data support for material property evaluation, so that the final detection results cover spatial, category, and quantification dimension information at the same time, and the comprehensive reference value of the detection report is improved.
[0115] Some embodiments of the present application also provide a detection system for non-metallic inclusions in steel based on background reconstruction. Refer to Figure 3 , which is applicable to the detection method for non-metallic inclusions in steel based on background reconstruction described in the above embodiments. The system includes:
[0116] An image acquisition module for acquiring an input image I1 to be detected.
[0117] A background reconstruction module for generating a reconstructed image I3 after removing inclusions.
[0118] A difference calculation module for calculating the difference between the input image I1 and the reconstructed image I3 to obtain a detection result image R containing inclusions.
[0119] A post-processing module for processing the detection result image R to output the inclusion detection result.
[0120] The above system acquires the original specimen data through the image acquisition module, generates a background reference image without inclusions in combination with the background reconstruction module, accurately extracts the inclusion distribution characteristics by using the difference calculation module, and reduces the interference of background texture on the detection; the post-processing module optimizes the detection results based on morphological analysis and classification mechanisms, suppresses noise and improves the accuracy of inclusion classification and parameter calculation; each module collaborates to optimize the process during the processing stage, enhancing the stability and interpretability of the detection results while maintaining the operation efficiency, and providing a quantifiable and highly robust inclusion analysis scheme for industrial quality inspection scenarios.
[0121] In some embodiments, refer to Figure 6 , the background reconstruction module includes an encoder, an attention module, and a decoder.
[0122] The encoder consists of several neural network layers with downsampling, and is used to reduce the image dimension and extract the effective features of the image. Each feature represents the main information within a certain area range of the image.
[0123] The attention module takes the output features of the encoder as input, consists of several Transformer encoding layers, uses the self-attention mechanism to perform global reconstruction based on the image features, and fits the background features of the inclusion area.
[0124] The decoder contains several upsampling neural network layers for reconstructing the background image without inclusions from the output features of the attention module.
[0125] It should be understood that a background reconstruction network is provided inside the background reconstruction module. Among them, the neural network layers of the encoder can select neural network structures such as convolutional layers and fully connected layers. The structure of the decoder is opposite to that of the encoder.
[0126] The background reconstruction module extracts multi-level regional features through the downsampling structure of the encoder, retains the effective information of the image and compresses redundant data, providing a feature expression with high semantic density for subsequent processing; the attention module uses the self-attention mechanism to perform correlation modeling on the global features, enhances the model's ability to identify background textures and inclusion areas, and improves the fitting accuracy of background features under complex backgrounds; the decoder gradually restores the image spatial resolution through upsampling operations, combines the global features output by the attention module with the local features of the encoder, realizes the accurate reconstruction of the background image, provides a highly consistent reference benchmark for inclusion detection, and reduces the reconstruction error caused by the loss of local features.
[0127] In some embodiments, the non-metallic inclusion detection system based on background reconstruction further includes an offline training module, and the offline training module includes:
[0128] A data augmentation unit for generating training samples by randomly superimposing inclusion templates.
[0129] A loss calculation unit for calculating the reconstruction loss according to the background preservation loss and the inclusion removal loss.
[0130] A parameter optimization unit for updating the neural network parameters through the backpropagation algorithm.
[0131] The offline training module randomly generates inclusion superimposed samples through the data augmentation unit, expands the morphology and distribution diversity of the training data, and alleviates the limitation of the model generalization ability caused by insufficient real samples; combines the dual constraint mechanism of the background preservation loss and the inclusion removal loss, balances the reduction accuracy of the background features and the suppression effect of the inclusion area of the model, and reduces the feature learning deviation caused by a single loss function; the parameter optimization unit dynamically adjusts the network weights based on the backpropagation algorithm, enables the model to gradually adapt to the distribution law of complex samples during the iteration process, improves the robustness of background reconstruction, and provides a pre-training model foundation with stronger adaptability for the actual detection scenario.
[0132] As can be seen from the above technical solutions, the embodiments of the present application provide a method and system for detecting non-metallic inclusions in steel based on background reconstruction. The method includes: obtaining an input image to be detected; inputting the input image into a background reconstruction module to generate a reconstructed image after removing inclusions; calculating the difference between the input image and the reconstructed image to obtain a detection result image containing inclusions; and processing the detection result image through a post-processing module to output an inclusion detection result. This method has low requirements for data annotation and is not affected by the imbalance of inclusion sample categories. The algorithm has stronger adaptability and robustness, solving the problem that the method for detecting non-metallic inclusions in steel is difficult to meet the high-precision and high-efficiency quality inspection requirements.
[0133] For the similar parts between the embodiments provided in the present application, reference can be made to each other. The specific embodiments provided above are only several examples under the general concept of the present application and do not constitute a limitation on the protection scope of the present application. For those skilled in the art, any other embodiments extended based on the solution of the present application without creative efforts belong to the protection scope of the present application.
Claims
1. A method for detecting non-metallic inclusions in steel based on background reconstruction, characterized in that, Including: Obtain the input image to be detected; Input the input image into the background reconstruction module to generate a reconstructed image after removing inclusions; Calculate the difference between the input image and the reconstructed image to obtain a detection result image containing inclusions; Process the detection result image through a post-processing module to output an inclusion detection result.
2. The method for detecting non-metallic inclusions in steel based on background reconstruction according to claim 1, wherein The training method of the background reconstruction module includes: Obtain an input image and a corresponding input mask, where the input mask is used to mark the inclusion area through a binary matrix; Overlay a randomly generated inclusion template image on the input image through an inclusion generation module to generate a simulated image and a corresponding inclusion mask; Input the simulated image and the inclusion mask into the background reconstruction network to generate a reconstructed image; Input the input image, the input mask, and the inclusion mask into the loss calculation module to output a reconstruction loss.
3. The method for detecting non-metallic inclusions in steel based on background reconstruction according to claim 2, wherein The step of overlaying a randomly generated inclusion template image on the input image through an inclusion generation module to generate a simulated image and a corresponding inclusion mask includes: Randomly select multiple inclusion template images and corresponding inclusion masks from an inclusion library; Randomly select multiple positions in the input image for adding the inclusion template image; Add the inclusion template image to the corresponding position in the input image and update the input mask to output a simulated image and a corresponding inclusion mask.
4. The method for detecting non-metallic inclusions in steel based on background reconstruction according to claim 3, wherein The calculation formula of the simulated image is: Among them, I1 is the input image; P is the position transformation function; I J is the inclusion template image; k is the number of inclusions added.
5. The method for detecting non-metallic inclusions in steel based on background reconstruction according to claim 3, wherein The calculation formula of the inclusion mask is: Among them, M1 is the input mask; P is the position transformation function; M J is the inclusion mask; k is the number of inclusions added.
6. The method for detecting non-metallic inclusions in steel based on background reconstruction according to claim 2, characterized in that The calculation formula of the loss calculation module is: L1 = M1 × (1 - M2) × ||I1 - I3|| d ; L2 = M2 × ||I1 - I3|| d ; L = W1×L1 + W2×L2; Among them, L1 is the background retention loss; L2 is the inclusion removal loss; L is the reconstruction loss; W1 and W2 are preset weight coefficients, and ||·|| d is the distance function; I1 is the input image; I3 is the reconstructed image; M1 is the input mask; M2 is the inclusion mask.
7. The method for detecting non-metallic inclusions in steel based on background reconstruction according to claim 1, characterized in that The step of processing the detection result image through a post-processing module to output an inclusion detection result includes: Threshold the detection result image to obtain inclusion information; Extract the regions and positions corresponding to each inclusion in the inclusion information through a connected component method; Classify each inclusion based on a preset physical and chemical inspection rule or a classification neural network; Calculate the grading index for each inclusion to obtain the parameter index of the inclusion; Output the inclusion detection result according to the regions and positions, classification, and parameter index of each inclusion.
8. A non-metallic inclusion detection system in steel based on background reconstruction, characterized in that, Applicable to the method for detecting non-metallic inclusions in steel based on background reconstruction according to any one of claims 1-7, the system includes: An image acquisition module for obtaining the input image to be detected; A background reconstruction module for generating a reconstructed image after removing inclusions; A difference calculation module for calculating the difference between the input image and the reconstructed image to obtain a detection result image containing inclusions; A post-processing module for processing the detection result image to output an inclusion detection result.
9. The non-metallic inclusion detection system in steel based on background reconstruction according to claim 8, characterized in that The background reconstruction module includes an encoder, an attention module, and a decoder; The encoder is composed of several neural network layers with downsampling, and is used to reduce the image dimension and extract the effective features of the image. Each feature represents the main information within a certain area range of the image; The attention module takes the output features of the encoder as input, consists of several Transformer encoding layers, uses the self-attention mechanism to perform global reconstruction based on the image features, and fits the background features of the inclusion area; The decoder includes several upsampling neural network layers for reconstructing the background image without inclusions from the output features of the attention module.
10. The non-metallic inclusion detection system in steel based on background reconstruction according to claim 8, characterized in that, It further includes an offline training module, and the offline training module includes: A data augmentation unit for generating training samples by randomly superimposing inclusion templates; A loss calculation unit for calculating the reconstruction loss according to the background preservation loss and the inclusion removal loss; A parameter optimization unit for updating the neural network parameters through the backpropagation algorithm.