A method, system, and equipment for classifying defects in continuously cast billets based on meta-learning
By using a meta-learning approach, a feature extractor and Mahalanobis distance are trained on a public dataset. Combined with a multi-scale feature fusion module, an image meta-learning classification model is constructed, which solves the problems of low efficiency and low recognition rate in continuous casting billet defect detection and achieves efficient classification under data scarcity.
Patent Information
- Application Number
- CN202411560926.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-04
AI Technical Summary
Existing methods for detecting defects in continuously cast billets rely on manual inspection and rule-based image processing techniques, which suffer from low efficiency and low recognition rates, and are particularly difficult to achieve efficient classification when data is scarce.
A meta-learning-based approach is adopted, which trains a feature extractor using a public image classification dataset and forms a meta-task through meta-learning task assignment. Combined with Mahalanobis distance and multi-scale feature fusion modules, an image meta-learning classification model is constructed to achieve efficient classification of defects in continuously cast billets.
This technology enables efficient classification with a limited number of defect image samples, improving the accuracy and efficiency of defect detection. It can quickly adapt to different types of defects and solves the problem of data scarcity.
Smart Images

Figure CN119313973B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of continuous casting billet defect classification, and relates to a method, system and equipment for continuous casting billet defect classification based on meta-learning. Background Technology
[0002] Continuous casting (CVS) technology is a key process in modern steel production. By directly solidifying high-temperature molten metal into billets of specific shapes, it can significantly improve production efficiency and reduce production costs. However, during continuous casting, the billets are affected by various internal and external factors, resulting in a variety of defects such as cracks, bubbles, inclusions, and shrinkage cavities. These defects not only affect the appearance quality of the billets but may also cause more serious problems during subsequent processing and use, ultimately affecting the mechanical properties and service life of the final product. Therefore, accurate and rapid detection and classification of defects in continuously cast billets are crucial for ensuring steel quality.
[0003] Traditional methods for detecting defects in continuously cast billets mainly rely on manual inspection and rule-based image processing techniques. Manual inspection involves experienced quality control personnel visually inspecting the billet surface to identify defects. This method demands a high level of experience and skill from the inspectors, is susceptible to subjective biases, and is inefficient, struggling to guarantee consistency and accuracy. Rule-based image processing techniques utilize predefined image processing algorithms (such as edge detection and threshold segmentation) to identify and classify defects. While these methods can be effective in specific scenarios, their robustness and generalization capabilities are limited when faced with complex and varied defect types and noise interference, making them difficult to adapt to the diverse needs of actual production.
[0004] With the rapid development of artificial intelligence technology, deep learning, especially Convolutional Neural Networks (CNNs), has achieved remarkable results in the field of image processing. Compared with traditional methods, deep learning-based defect detection methods have advantages such as automatic feature extraction, high accuracy, and strong adaptability. Deep learning models can automatically extract multi-level and multi-scale features from raw images without relying on manually designed features. Deep learning models trained on large-scale data perform excellently in image classification and object detection tasks, achieving high-precision defect identification and classification. Deep learning models can maintain a high recognition rate under different defect types and complex backgrounds, demonstrating good generalization ability.
[0005] However, the effectiveness of deep learning methods heavily relies on large-scale, high-quality labeled datasets. In practical applications, acquiring large amounts of labeled data is often difficult and costly, especially for data containing rare defect types. Therefore, how to achieve efficient defect detection and classification with limited labeled data becomes a pressing problem. Summary of the Invention
[0006] The purpose of this invention is to provide a method, system and equipment for classifying defects in continuous casting billets based on meta-learning, which solves the problems of low efficiency and low recognition rate in existing continuous casting billet defect classification methods.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0008] This invention provides a method for classifying defects in continuously cast billets based on meta-learning, comprising the following steps:
[0009] Step 1: Preprocess the obtained public image classification dataset and the image of the continuous casting billet containing defects, respectively, to obtain the preprocessed public image classification dataset and the image of the continuous casting billet containing defects.
[0010] Step 2: The preprocessed public image classification dataset is randomly assigned to form a meta-task through a meta-learning task, and then input into a preset image meta-learning classification model to obtain a trained image meta-learning classification model. The preset image meta-learning classification model includes a preset feature extractor and a similarity measurement function module.
[0011] Step 3: The preprocessed image of the continuously cast billet containing defects is assigned to a meta-task through meta-learning tasks. The obtained meta-tasks are used to fine-tune the trained image meta-learning classification model to obtain the final image meta-learning classification model.
[0012] Step 4: Use the final image meta-learning classification model to classify the defects in the continuously cast billet to be processed.
[0013] Preferably, in step 2, the preset feature extractor is constructed using the following method:
[0014] The preprocessed public image classification dataset is input into the base class classification model of the input image for processing to obtain the feature fusion map;
[0015] The obtained feature fusion map is input into a fully connected layer to obtain the classification probability;
[0016] The model parameters of the base class classification model are corrected using the obtained classification probabilities, and the corrected base class classification model is used as a preset feature extractor.
[0017] Preferably, the preset feature extractor includes an encoder, which is sequentially connected to a convolutional self-attention module and a multi-scale feature fusion module, wherein:
[0018] The encoder includes four downsampling modules connected in sequence. Each downsampling module includes a convolutional layer, a layer normalization layer, a convolutional layer, a layer normalization layer, a convolutional layer, a layer normalization layer, and a nonlinear activation function connected in sequence.
[0019] The convolutional self-attention module includes a first normalization module, a Token_mixer module, a second normalization module, and a Channel_mixer module connected in sequence.
[0020] The multi-scale feature fusion module includes multiple max pooling layers and multiple stacked layers, wherein the multiple stacked layers are connected in sequence, and the input of each stacked layer is connected to a max pooling layer.
[0021] Preferably, the multi-scale feature fusion module further includes a channel reduction layer, and the initial fused feature map is input to the channel reduction layer to obtain the fused feature map.
[0022] Preferably, the Token_mixer module includes a first branch unit and a second branch unit;
[0023] The first normalized feature map is input into the first branch unit to obtain the mean of the feature map output by the first branch unit and the global context.
[0024] The first normalized feature map and the mean of the feature map are both input into the second branch unit to obtain the similarity between the first branch unit and the second branch unit calculated by the second branch unit, and the similarity is standardized.
[0025] The global context and the standardized similarity are multiplied together.
[0026] The feature map after multiplication is added to the first normalized feature map for a third time.
[0027] Preferably, the Token_mixer module further includes a first DWConv unit and a first Conv unit;
[0028] The feature map after the third addition process is input into the first DWConv unit;
[0029] The feature map output by the first DWConv unit is input into the first Conv layer to obtain the feature map output by the first Conv unit as the initial global context attention feature map.
[0030] Preferably, the Channel_mixer module includes a second Conv unit, a second DWConv unit, a nonlinear activation function unit, a first degenerate function unit, a third Conv unit, and a second degenerate function unit, wherein:
[0031] The second normalized feature map is input into the second Conv unit;
[0032] The feature map output by the second Conv unit is input into the second DWConv unit;
[0033] The feature map output by the second DWConv unit is input into the nonlinear activation function unit;
[0034] The feature map output by the nonlinear activation function unit is input into the first degenerate function unit;
[0035] The feature map output by the first degenerate function unit is input into the third Conv unit;
[0036] The feature map output by the third Conv unit is input to the second degenerate function unit, and the feature map output by the second degenerate function unit is used as the feature map of the channel mixing.
[0037] A defect classification system for continuously cast billets based on meta-learning includes the following steps:
[0038] The image preprocessing unit is used to preprocess the obtained public image classification dataset and the image of the continuous casting billet containing defects, respectively, to obtain the preprocessed public image classification dataset and the image of the continuous casting billet containing defects.
[0039] The image meta-learning classification model construction unit is used to randomly generate meta-tasks by assigning preprocessed public image classification datasets through meta-learning tasks, and input them into a preset image meta-learning classification model to obtain a trained image meta-learning classification model. The preset image meta-learning classification model includes a preset feature extractor and a similarity measurement function module.
[0040] The preprocessed image of the continuously cast billet containing defects is assigned to a meta-learning task to form a meta-task. The obtained meta-tasks are used to fine-tune the trained image meta-learning classification model to obtain the final image meta-learning classification model.
[0041] The defect classification unit is used to classify the defects of the continuous casting billet to be processed using the final image meta-learning classification model.
[0042] A computer device, comprising:
[0043] A processor is used to execute computer programs;
[0044] A computer-readable storage medium storing a computer program that, when executed by the processor, performs the method.
[0045] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method.
[0046] Compared with the prior art, the beneficial effects of the present invention are:
[0047] This invention provides a meta-learning-based method for classifying defects in continuously cast billets. Utilizing meta-learning technology, it achieves efficient classification with a limited number of defect image samples. Meta-learning simulates diverse task scenarios, enabling the model to learn and generalize rapidly under limited data conditions, significantly improving classification efficiency. Compared to traditional methods, this invention does not require a large amount of labeled data. Through initial training on a publicly available image classification dataset and fine-tuning with defect images, the model can efficiently utilize a small number of defect image samples, addressing the data scarcity problem. Furthermore, by employing Mahalanobis distance as a similarity metric, this invention can more accurately measure the distance and similarity between different samples. Mahalanobis distance is a statistical metric that considers data distribution, accurately measuring the distance and similarity between different samples and improving classification performance. Simultaneously, by combining multi-scale feature fusion and convolutional self-attention modules, the model can extract richer and more refined features, thereby improving the accuracy of defect classification. The multi-scale feature fusion module integrates feature information at different scales, while the convolutional self-attention module captures global contextual information, making feature extraction more comprehensive and accurate. The meta-learning model of this invention has the ability to quickly adapt to new tasks. When faced with different types of defects in continuously cast billets, the model maintains high classification performance. Even with scarce data, the model can maintain stable classification results through fine-tuning and further training. This invention not only effectively solves the problem of dependence on large amounts of labeled data in traditional defect detection methods, but also improves the model's classification ability under conditions of few samples. This invention innovatively combines deep learning and meta-learning techniques, which not only improves the accuracy and efficiency of continuously cast billet defect classification, but also provides new technical solutions for defect detection and image classification tasks in other fields. Attached Figure Description
[0048] Figure 1 This is the overall structural design drawing of the continuous casting billet defect classification model of the present invention;
[0049] Figure 2 This is a structural design diagram of the convolutional self-attention module in this invention;
[0050] Figure 3 This is a structural design diagram of the multi-scale feature fusion module in this invention;
[0051] Figure 4 This is a design diagram of the meta-task allocation method described in this invention. Detailed Implementation
[0052] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0053] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0054] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0055] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0056] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0057] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0058] Example 1
[0059] Meta-learning, also known as learning of learning, is a method that improves a model's learning efficiency on new tasks by learning the commonalities and differences between different tasks. Meta-learning trains a model that can quickly adapt to new tasks, enabling it to achieve excellent performance even with a small number of new task samples. This method is particularly suitable for scenarios with scarce data, such as defect classification in continuous casting billets.
[0060] Therefore, the meta-learning-based defect classification method for continuous casting billets provided in this application first trains a powerful image base class classification model using a publicly available image classification dataset, extracting high-quality features through this model. Then, through a meta-learning framework, these features are transferred to the continuous casting billet defect classification task, enabling the model to learn quickly on a small number of defect samples and achieve high-accuracy classification. This method not only effectively solves the problem of data scarcity but also significantly improves the robustness and accuracy of defect classification.
[0061] In summary, the meta-learning-based method for classifying defects in continuously cast billets, by combining the powerful feature extraction capabilities of deep learning with the rapid adaptability of meta-learning, can provide an efficient and reliable solution to the problem of data scarcity in the detection of defects in continuously cast billets, which is of great significance for improving the quality control level of steel production.
[0062] Specifically, see Figures 1 to 4This embodiment provides a meta-learning-based method for classifying defects in continuously cast billets. It constructs a meta-task with a balanced number of defect samples using a meta-task allocation method. Based on a metric-based meta-learning method, it enhances the base class classifier's extraction of global information through a convolutional self-attention mechanism. Furthermore, it uses Mahalanobis distance to measure the similarity between the prototype class and the image feature tensor on the meta-learning classifier. This similarity measure makes the image feature tensor closer to the correctly assigned prototype and further away from other unassigned prototypes, thereby accurately learning the features of defects in continuously cast billets and classifying the defect types. Specifically, it includes the following steps:
[0063] Step 1: Preprocess the publicly available image classification dataset and the image of a continuously cast billet containing defects. In this embodiment, the publicly available image classification dataset used is the Mini_ImageNet dataset. For the image of a continuously cast billet containing defects, a data augmentation method is used to ensure data balance and to ensure that the classification categories meet the minimum requirements of the meta-task classification.
[0064] Preprocessing can include, but is not limited to, sequentially performing image data cleaning, image data augmentation, label generation, and image dataset partitioning. Cleaning the original images removes potential noise, artifacts, or other interfering factors. This can be achieved by applying filtering techniques, removing motion artifacts, or other image processing methods. Clean image data helps the model learn from reality more effectively. For image data augmentation, various data augmentation techniques are applied to increase the diversity and robustness of image data. These techniques include rotation, scaling, flipping, translation, and brightness adjustment, which helps improve the model's generalization ability and mitigate data imbalance problems.
[0065] Step 2: Construct a base class classification model. Train an excellent feature extractor using a publicly available image classification dataset. This step is as follows: Figure 1 , Figure 2 and Figure 3 shown.
[0066] Figure 1 The upper part represents the base class classification model of this application, which includes an encoder, a convolutional self-attention module, and a multi-scale feature fusion module. Specifically, by adding a convolutional self-attention module to the encoder side, global attention of features is calculated. Then, the multi-scale feature fusion module fuses global contextual information with multi-scale features. Finally, a fully connected layer outputs the classification probability of the current image for each class across all categories. The advantage of this structure is that it can process both global and local information simultaneously, helping the model better understand image content and perform accurate segmentation. Furthermore, by incorporating the convolutional self-attention module and the multi-scale feature fusion module, computational cost and model complexity can be reduced, thereby improving the overall classification speed.
[0067] In some embodiments, the encoder is responsible for extracting features from the input raw image and progressively reducing the image resolution. The encoder may consist of four sequentially connected downsampling modules, each including a convolutional layer, a layer normalization layer, a convolutional layer, a layer normalization layer, another convolutional layer, a layer normalization layer, and a non-linear activation function, all connected in sequence. These operations progressively transform the raw image into a high-level feature representation and increase the number of feature channels, facilitating the extraction of local features.
[0068] Specifically, convolutional operations involve sliding a small window (the kernel) across the input data and performing element-wise multiplication and summation to extract local features from the input data. The role of convolutional layers is to learn spatial patterns in the input data, such as edges and textures. By stacking multiple convolutional layers, the model can learn more abstract and complex features.
[0069] Layer normalization layers are a technique used to accelerate the training of deep neural networks. During each mini-batch of training data, a layer normalization layer normalizes the data for each feature channel, making its mean close to 0 and its standard deviation adjusted to 1. This speeds up the training process, helps alleviate the vanishing gradient problem, accelerates convergence, and improves the model's generalization performance. Layer normalization layers can also have a slight regularization effect, helping to prevent overfitting.
[0070] Nonlinear activation functions introduce nonlinear characteristics into neural networks, enabling them to learn complex nonlinear relationships. Commonly used nonlinear activation functions in convolutional neural networks include ReLU, Sigmoid, and Tanh. Among these, ReLU is one of the most frequently used activation functions. It outputs the same value as the input for positive numbers and 0 for negative numbers. This nonlinear transformation allows the neural network to learn nonlinear patterns, increasing its expressive power.
[0071] In some embodiments, the original image is input into the encoder, and after a downsampling operation, intermediate downsampling resolution feature maps output by each non-final layer downsampling module of the encoder and final layer downsampling resolution feature maps output by the final layer downsampling module can be obtained. The intermediate downsampling resolution feature maps typically refer to the feature maps output by the intermediate layers of the encoder, while the final layer downsampling resolution feature maps refer to the feature maps output by the last layer of the encoder.
[0072] Figure 2 This is a schematic diagram of the convolutional self-attention module according to this embodiment, as shown below. Figure 2 As shown, the convolutional self-attention module includes a first normalization module, a Token_mixer module, a second normalization module, and a Channel_mixer module connected in sequence, wherein:
[0073] The first normalization module can be used to perform layer normalization operations on the input feature map, which helps to accelerate training and improve the model's generalization ability. The first normalized feature map is obtained by inputting the intermediate downsampled resolution feature map into the first normalization module.
[0074] By inputting the first normalized feature map into the Token_mixer module, an initial global context attention feature map can be obtained.
[0075] The Token_mixer module provides a rich, multi-layered feature representation for the entire model by calculating the mean of global features, analyzing the similarity between different feature subsets, and preserving feature details, all within the global context. This helps the model better understand images and capture both global structure and local details.
[0076] Each element of the initial global context attention feature map is first added to the corresponding element of the intermediate downsampled resolution feature map to obtain the first added feature map. This feature map contains information from both the initial global context attention feature map and the intermediate downsampled resolution feature map, fusing global and local features.
[0077] The first summed feature map is input into the second normalization module for layer normalization to obtain the second normalized feature map. This step is the same as the first normalization module. In this process, the module can calculate the mean and standard deviation of each channel in the first summed feature map, and then perform layer normalization on the feature map. In this way, each channel in the second normalized feature map will have a similar numerical range, which helps to improve the training stability and generalization ability of the model.
[0078] The second normalized feature map is input into the Channel_mixer module to obtain a channel-mixed feature map. This feature map integrates information from different channels and possesses a higher level of semantic information.
[0079] The Channel_mixer module performs channel-wise fusion and transformation on the input second normalized feature map. Through a series of convolutions and activation functions, the features become more expressive in the channel direction, enabling the model to learn more complex features.
[0080] The channel-blended feature map and the first summed feature map are then summed a second time to obtain the final global contextual attention feature map. The purpose of this step is to integrate local features, global contextual information, and channel features to obtain a more comprehensive feature representation.
[0081] In summary, the design of convolutional self-attention modules aims to ensure that information from the global context is fully integrated into the downsampled feature map, thereby improving the accuracy of target defect detection. This structure is characterized by its ability to capture the relationships between different locations and channels, leading to a better understanding of the image's semantic information and contributing to improved model performance and robustness.
[0082] The Token_mixer module includes a first branch unit and a second branch unit;
[0083] The first normalized feature map is input into the first branch unit to obtain the mean of the feature map output by the first branch unit and the global context.
[0084] The first normalized feature map and the mean of the feature map are both input into the second branch unit to obtain the similarity between the first branch unit and the second branch unit calculated by the second branch unit, and the similarity is standardized.
[0085] The global context and the standardized similarity are multiplied together.
[0086] The feature map after multiplication is added to the first normalized feature map for a third time.
[0087] The Token_mixer module further includes a first DWConv unit and a first Conv unit;
[0088] The feature map after the third addition process is input into the first DWConv unit;
[0089] The feature map output by the first DWConv unit is input into the first Conv layer to obtain the feature map output by the first Conv unit as the initial global context attention feature map.
[0090] The principle is:
[0091] The main function of the Token_mixer module is to compute global information about the input, using this global information and a linear mapping to tokenize the input. Its focus is on computing the global information of the token mixer's input. The process of computing the global information of the input by the token mixer can be divided into five steps:
[0092] The first step is to calculate the mean in the width and height dimensions of the input using the mean operation, thereby obtaining preliminary global information about the input in width and height, which facilitates the subsequent capture of important features in the input.
[0093] The second step involves rearranging the initial global information and input into a multi-head format, calculating the similarity matrix between the two tensors, and using a multi-head attention mechanism to distribute attention to different heads. By calculating the similarity matrix, the model captures the relationship between different heads, thereby enhancing its perception of different features.
[0094] The third step is to calculate the mean and standard deviation of the similarity matrix, further standardizing the similarity matrix. During the standardization process, learnable weights are added, allowing the model to freely control the scaling and translation of the similarity matrix, thereby improving the model's expressive power.
[0095] The fourth step involves feeding the initial global information into a feedforward neural network, which learns more complex global information from the input through linear and nonlinear transformations.
[0096] The fifth step involves multiplying the standardized similarity matrix with the global information. The global information is then used to weight the similarity matrix, allowing it to influence the calculation of each local feature and thus yielding the final global information.
[0097] After the five calculation steps above, the global information of the input is obtained, and then this global information is incorporated into the input through residual connections. The label mixer is stacked twice in the actual experiment to fully learn the global information in the input, thereby enhancing the model's ability to represent global information.
[0098] The Channel_mixer module includes a second Conv unit, a second DWConv unit, a nonlinear activation function unit, a first degenerate function unit, a third Conv unit, and a second degenerate function unit, wherein:
[0099] The second normalized feature map is input into the second Conv unit;
[0100] The feature map output by the second Conv unit is input into the second DWConv unit;
[0101] The feature map output by the second DWConv unit is input into the nonlinear activation function unit;
[0102] The feature map output by the nonlinear activation function unit is input into the first degenerate function unit;
[0103] The feature map output by the first degenerate function unit is input into the third Conv unit;
[0104] The feature map output by the third Conv unit is input to the second degenerate function unit, and the feature map output by the second degenerate function unit is used as the feature map of the channel mixing.
[0105] Figure 3This is a schematic diagram of the multi-scale feature fusion module according to this embodiment, as shown below. Figure 3 As shown, the multi-scale feature fusion module includes multiple max pooling modules and multiple stacking modules, wherein multiple stacking layers are connected in sequence, and the input of each stacking layer is connected to a max pooling layer.
[0106] In some embodiments, the max pooling module can be used to downsample the global context attention feature map to address the scale mismatch fusion problem between the multi-scale global context attention feature map generated by the multi-scale global context module and the low-resolution feature map obtained by normal downsampling. In each max pooling module, each region of the feature map is divided into several sub-regions, and the maximum value in each sub-region is retained while the remaining values are discarded. This reduces the resolution of the feature map, retains the main features, discards secondary features, thereby reducing computational cost while extracting the main information of the features.
[0107] The global context attention feature map is downsampled sequentially using a max-pooling module. After each downsampling, a stacking module stacks feature maps of the same resolution across the channel dimension. The stacking module integrates feature information from different sources. This integration increases feature diversity and expressiveness, helping to capture richer and more complex image features.
[0108] The input global context attention feature map undergoes successive max pooling and dimensional stacking. The feature map output from the last max pooling module and the final downsampled resolution feature map are then stacked by channel dimension in the final stacking module to obtain the initial fused feature map. This initial fused feature map can be a large-channel, low-resolution feature map that integrates different scale information from the global context attention feature map and local features from the final downsampled resolution feature map, thus possessing more comprehensive information.
[0109] Through this design, the multi-scale feature fusion module can effectively combine global and local information to generate a fused feature map. This fused feature map integrates information from different scales and levels, providing richer and more accurate feature representations for subsequent defect detection. This multi-scale feature fusion helps improve the performance of the detection model, making it more robust and capable of generalization.
[0110] The principle is:
[0111] The convolutional self-attention module generates four feature maps with 16, 64, 128, and 256 channels. Before fusing these four feature maps with the ResNet12 output, the multi-scale feature fusion module does not change the number of channels of any feature map. It uses max pooling to downsample the current-level feature map to match the scale of the next-level feature map, and then concatenates them along the channel dimension to generate new feature maps. For example, if the first feature map has 16 channels and the second has 64 channels, fusing them will match the scale of the second feature map, and the number of channels will be the sum of the two (80). This process continues until the feature scale matches the output scale of ResNet12.
[0112] After successive max pooling and channel-axis concatenation operations, a feature map with 464 channels containing multi-scale global information is obtained. This feature map is scale-consistent with the output of ResNet12. This paper also performs channel-axis concatenation on this feature map and the output of ResNet12, as shown in the figure, resulting in a feature map with 976 channels containing both local and global information. However, at this point, the local and global information of the channel-axis concatenated feature map are not truly fused. Therefore, this paper passes this feature map through a simple channel mixer to deeply fuse the local and global information, obtaining the final multi-scale fused feature map.
[0113] The multi-scale feature fusion module, designed through the aforementioned stepwise max-pooling and channel-axis concatenation operations, effectively fuses multi-scale feature information. This results in feature maps with rich expressive power in both local and global information, helping the network to better understand and capture structural and semantic information in images. This paper maintains consistency with the features output by ResNet12 through a channel mixer, ensuring that overall performance is not significantly affected while further deepening the fusion of local and global information. This enhances the representational power of the feature maps and provides more robust feature representations.
[0114] Step 3: Construct the necessary meta-tasks for the meta-learning classification model and train the meta-learning classification model. The meta-learning classification model is as follows: Figure 1 As shown, the meta-task allocation method is as follows: Figure 4 shown.
[0115] Figure 1The lower part is the meta-learning classification model. The base class classification model, through learning and training on a publicly available image classification dataset, has a feature extractor that can effectively extract feature information from images. Combined with the classification probability output by the final fully connected layer, it can basically classify images of different categories. However, the classification results of the base class classification model are based on full training on the publicly available image classification dataset. The inherent limitations of images of continuously cast billets with defects prevent direct training on the base class classification model to obtain ideal classification results. To address this issue, this application removes the final fully connected layer in the base class classification model and directly uses its feature extractor as the feature extractor for the meta-learning classification model, thereby enhancing the meta-learning classification model's ability to extract features from the input.
[0116] The network structure of the meta-learning classification model is basically the same as that of the base classifier. The only difference is that this application does not directly use the feature information extracted from the support set and query set of the meta-task as the classification basis. Instead, it further generates class prototypes from the extracted feature information. Then, through a subsequent similarity metric function, it measures the distance (i.e., similarity) between the class prototypes generated from the query set and the various class prototypes generated from the support set, and uses the similarity score as the basis for classification. Figure 4 As shown, the training of a meta-learning classification model generally consists of three steps: meta-learning task assignment, class prototype extraction and generation, and class prototype similarity measurement.
[0117] Meta-learning task allocation. During the meta-training phase, this embodiment classifies the meta-training set, which is randomly generated from a publicly available image classification dataset, according to its corresponding class labels. When generating meta-tasks, random sampling is performed from the meta-training set. One category, and then from this Random sampling from each category These samples form a meta-task sample set, where... Each sample forms a support set for the meta-task. Each sample forms the query set for the meta-task. For the support set generated by random sampling, this embodiment does not shuffle the order of various types of samples within the support set; that is, the data dimension of the support set is... The first two dimensions represent the total number of N categories, with each category containing K samples. The latter three dimensions represent the number of channels, width, and height of each sample. The order of samples from each category within the support set is not disrupted because the K samples from each category will subsequently be used to generate more representative class prototypes. For query sets generated through random sampling, this invention does not consider the order of samples from each category within the query set; that is, the data dimension of the query set is... The query set has one less data dimension than the support set. This allocation is intended to reduce the impact of sample placement in the query set according to category order when subsequently calculating class prototypes and similarity metrics. In other words, the samples in the query set are staggered, eliminating interference from category clustering. This approach ensures that each sample in the query set is queried independently, further emphasizing the randomness of the query and making the classification accuracy derived by the meta-learning classification model more convincing.
[0118] Class Prototype Extraction and Generation. After meta-learning task allocation, this embodiment obtains many meta-tasks, each with a support set and a query set. Now, feature information needs to be extracted from the samples in the support set and query set, and class prototypes generated. The feature extractor of the meta-learning classification model originates from the base class classification model. Its feature extractor has undergone full classification training on a publicly available image classification dataset. Compared to a feature extractor trained from scratch, the transferred feature extractor has stronger feature extraction capabilities. Analysis of the meta-task allocation shows that the support set has a five-dimensional data dimension, and the query set has a four-dimensional data dimension. Therefore, to ensure normal feature extraction, this embodiment needs to first superimpose the first two dimensions of the support set. Because the feature extractor does not modify the input batch size dimension, there is no need to consider the issue of data order disruption. After the feature extractor finishes, the original data dimensions are restored.
[0119] The reason why this embodiment does not support each category of the set is... The mixing of individual samples is necessary because class prototypes formed from single samples lack generality. In meta-learning tasks, samples from the support set are used to construct class prototypes, which are then used for model adaptation and generalization. However, if only class prototypes formed from single samples are used to calculate similarity with each sample in the query set, the similarity measurement results can be very poor. Since a single sample cannot well represent the features and variations of the entire category, to improve the model's generalization performance on the query set, the resulting class prototypes for each category are mixed. The feature information of each sample is averaged by averaging the values of samples of the same category. By averaging the feature information of each sample, this embodiment can obtain a more representative class prototype, thereby improving the reliability of the subsequent similarity measurement function in measuring the similarity between the class prototype and the feature information of the query set.
[0120] Similarity measurement of class prototypes. A similarity measurement function is generally defined by a distance function or cost function. It is a criterion used to measure the similarity between a feature and its prototype, and is a key basis for metric-based meta-learning methods. Choosing and designing an effective similarity measurement function is crucial, as it directly affects the model's adaptability to new tasks. The samples in the meta-task support set are processed by a feature extractor and mean-based operations to generate... The class prototypes of each category, and the query set generation This is a tensor that condenses the features of the samples. This embodiment requires processing this tensor. Calculate the similarity score between each tensor and each class prototype.
[0121] Common distance functions used for similarity measurement include cosine similarity, Euclidean distance, Manhattan distance, and Mahalanobis distance. Different distance functions have different applications. Mahalanobis distance considers the covariance structure of the data and is suitable for high-dimensional data. It measures the similarity of a data point relative to the dataset as a whole, making it well-suited for calculating the similarity score of a single feature tensor based on the class prototype of continuously cast billet defects. This embodiment uses Mahalanobis distance to measure the similarity between the query set feature tensor and the class prototype.
[0122] However, a necessary prerequisite for calculating the Mahalanobis distance is the ability to compute the inverse of the joint covariance matrix of the query set feature tensor and the class prototype. This requires the invertibility of the joint covariance matrix. This embodiment employs regularization on the joint covariance matrix by adding a very small number multiplied by the identity matrix to it, thus ensuring that the joint covariance matrix is positive definite and avoiding numerical instability, thereby resolving the problem of the joint covariance matrix's non-invertibility. Furthermore, adding an identity matrix to the joint covariance matrix in this embodiment does not change its properties, because the special properties of the identity matrix cause it to function similarly to a zero element in addition. In this way, the similarity between the query set feature tensor and the class prototype can be calculated using the Mahalanobis distance.
[0123] Step 5: Fine-tune and test, the process is as follows:
[0124] Images of continuously cast billets containing defects are used to form new meta-tasks according to a meta-learning task allocation method. This task allocation method simulates different defect classification tasks, enabling the model to adapt to the actual application scenarios of continuously cast billet defect images during fine-tuning.
[0125] Furthermore, the meta-learning classification model is fine-tuned. During fine-tuning, a small number of defect image samples are used to further train and adjust the meta-learning classification model. A portion of samples is randomly selected from images of continuously cast billets containing defects as the support set, and another portion as the query set, forming a new meta-task. The images from the support set and query set are then input into a feature extractor to extract the corresponding feature representations, ensuring the accuracy of subsequent classification. Based on the features of the support set, a prototype vector for each class is generated, representing the central feature of that class.
[0126] Furthermore, the similarity between each sample feature in the query set and the prototype vectors of various classes is calculated using the Mahalanobis distance. Based on the similarity measurement results, the samples in the query set are classified. The classification loss is calculated by comparing the predicted labels and true labels of the query set samples, and optimization algorithms such as gradient descent are used to update the model parameters and reduce the classification loss. During fine-tuning, multiple iterations of optimization gradually improve the model's performance on the defect classification task. Through fine-tuning, the model can further adapt to the characteristics of continuously cast billet defect images, improving classification accuracy and robustness.
[0127] This embodiment provides a method for classifying defects in continuously cast billets based on meta-learning. By combining deep learning and meta-learning techniques, it can significantly improve the efficiency and accuracy of defect classification. The method first trains an initial model using a publicly available image classification dataset, extracting high-quality image features through a convolutional self-attention module and a multi-scale feature fusion module. Subsequently, it uses Mahalanobis distance as a similarity metric to generate class prototypes, and employs meta-learning task assignment to create diverse task scenarios, enhancing the model's generalization ability.
[0128] In practical applications, images of continuously cast billets containing defects are preprocessed to form a new meta-task. By fine-tuning the meta-learning classification model, it is ensured that defect images can be accurately classified even with a small number of samples. The fine-tuning process uses a small number of defect image samples to further train and optimize the model, making it perform better in actual defect classification tasks.
[0129] This embodiment not only effectively solves the problem of data scarcity but also possesses the ability to quickly adapt to new tasks. Its versatility and flexibility make it suitable for defect detection in continuously cast billets and other fields of defect detection and image classification. By improving the technical level and efficiency of defect classification, this invention can significantly enhance quality control in the steel production process, reduce the generation of defective products, and improve production efficiency and product quality, demonstrating broad application prospects and economic benefits.
[0130] Example 2
[0131] A method for classifying defects in continuously cast billets based on meta-learning includes the following steps:
[0132] The image preprocessing unit is used to preprocess the obtained public image classification dataset and the image of the continuous casting billet containing defects, respectively, to obtain the preprocessed public image classification dataset and the image of the continuous casting billet containing defects.
[0133] The image meta-learning classification model construction unit is used to randomly generate meta-tasks by assigning preprocessed public image classification datasets through meta-learning tasks, and input them into a preset image meta-learning classification model to obtain a trained image meta-learning classification model. The preset image meta-learning classification model includes a preset feature extractor and a similarity measurement function module.
[0134] The preprocessed image of the continuously cast billet containing defects is assigned to a meta-learning task to form a meta-task. The obtained meta-tasks are used to fine-tune the trained image meta-learning classification model to obtain the final image meta-learning classification model.
[0135] The defect classification unit is used to classify the defects of the continuous casting billet to be processed using the final image meta-learning classification model.
[0136] Example 3
[0137] This embodiment 3 provides a computer device, including: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of a computer method.
[0138] When the processor executes the computer program, it implements the steps of the computer method described above, or, when the processor executes the computer program, it implements the functions of each module in the system described above.
[0139] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a preset function, the instruction segments describing the execution process of the computer program in the computer device.
[0140] The computer device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above are examples of computer devices and do not constitute a limitation on the computer device; it may include more components than described above, or combine certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.
[0141] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor, or any conventional processor, etc. The processor is the control center of the computer device, connecting various parts of the computer device through various interfaces and lines.
[0142] The memory can be used to store the computer program and / or module, and the processor implements various functions of the computer device by running or executing the computer program and / or module stored in the memory, and by calling the data stored in the memory.
[0143] The memory may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function (such as sound playback, image playback, etc.); the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). Furthermore, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, SmartMediaCards (SMC), Secure Digital (SD) cards, FlashCards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.
[0144] Example 4
[0145] This embodiment 4 also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described.
[0146] If the modules / units integrated in the computer system are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
[0147] Based on this understanding, all or part of the processes in the above-described method can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above-described computer method. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or a preset intermediate form, etc.
[0148] The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0149] It should be noted that the content contained in the computer-readable storage medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.
[0150] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for classifying defects in continuously cast billets based on meta-learning, characterized in that, Includes the following steps: Step 1: Preprocess the obtained public image classification dataset and the image of the continuous casting billet containing defects, respectively, to obtain the preprocessed public image classification dataset and the image of the continuous casting billet containing defects. Step 2: The preprocessed public image classification dataset is randomly assigned to form a meta-task through a meta-learning task, and then input into a preset image meta-learning classification model to obtain a trained image meta-learning classification model. The preset image meta-learning classification model includes a preset feature extractor and a similarity measurement function module. Step 3: The preprocessed image of the continuously cast billet containing defects is assigned to form a meta-task through meta-learning task. The obtained meta-task is combined with a similarity metric function to fine-tune the trained image meta-learning classification model to obtain the final image meta-learning classification model. Step 4: Use the final image meta-learning classification model to classify the defects in the continuously cast billet to be processed; The preset feature extractor includes an encoder, which is sequentially connected to a convolutional self-attention module and a multi-scale feature fusion module, wherein: The encoder includes four downsampling modules connected in sequence. Each downsampling module includes a convolutional layer, a layer normalization layer, a convolutional layer, a layer normalization layer, a convolutional layer, a layer normalization layer, and a nonlinear activation function connected in sequence. The convolutional self-attention module includes a first normalization module, a Token_mixer module, a second normalization module, and a Channel_mixer module connected in sequence. The multi-scale feature fusion module includes multiple max pooling layers and multiple stacked layers, wherein the multiple stacked layers are connected in sequence, and the input of each stacked layer is connected to a max pooling layer. The multi-scale feature fusion module further includes a channel reduction layer, the input of which is the initial fused feature map, to obtain the fused feature map.
2. The method for classifying defects in continuously cast billets based on meta-learning according to claim 1, characterized in that, In step 2, the preset feature extractor is constructed as follows: The preprocessed public image classification dataset is input into the base class classification model of the input image for processing to obtain the feature fusion map; The obtained feature fusion map is input into a fully connected layer to obtain the classification probability; The model parameters of the base class classification model are corrected using the obtained classification probabilities, and the corrected base class classification model is used as a preset feature extractor.
3. The method for classifying defects in continuously cast billets based on meta-learning according to claim 1, characterized in that, The Token_mixer module includes a first branch unit and a second branch unit; The input to the first branch unit is the first normalized feature map, so as to obtain the mean of the feature map output by the first branch unit and the global context; The first normalized feature map and the mean of the feature map are both input into the second branch unit to obtain the similarity between the first branch unit and the second branch unit calculated by the second branch unit, and the similarity is standardized. The global context and the standardized similarity are multiplied together. The feature map after multiplication is added to the first normalized feature map for a third time.
4. The method for classifying defects in continuously cast billets based on meta-learning according to claim 1, characterized in that, The Token_mixer module further includes a first DWConv unit and a first Conv unit; The input to the first DWConv unit is the feature map after the third addition process; The feature map output by the first DWConv unit is input into the first Conv unit to obtain the feature map output by the first Conv unit as the initial global context attention feature map.
5. The method for classifying defects in continuously cast billets based on meta-learning according to claim 1, characterized in that, The Channel_mixer module includes a second Conv unit, a second DWConv unit, a nonlinear activation function unit, a first degenerate function unit, a third Conv unit, and a second degenerate function unit, wherein: The second normalized feature map is input into the second Conv unit; The feature map output by the second Conv unit is input into the second DWConv unit; The feature map output by the second DWConv unit is input into the nonlinear activation function unit; The feature map output by the nonlinear activation function unit is input into the first degenerate function unit; The feature map output by the first degenerate function unit is input into the third Conv unit; The feature map output by the third Conv unit is input into the second degenerate function unit, and the feature map output by the second degenerate function unit is used as the feature map for channel mixing.
6. A continuous casting billet defect classification system based on meta-learning, characterized in that, Based on the classification method described in claim 1, the system includes: The image preprocessing unit is used to preprocess the obtained public image classification dataset and the image of the continuous casting billet containing defects, respectively, to obtain the preprocessed public image classification dataset and the image of the continuous casting billet containing defects. The image meta-learning classification model construction unit is used to randomly generate meta-tasks by assigning preprocessed public image classification datasets through meta-learning tasks, and input them into a preset image meta-learning classification model to obtain a trained image meta-learning classification model. The preset image meta-learning classification model includes a preset feature extractor and a similarity measurement function module. The preprocessed image of the continuously cast billet containing defects is assigned to a meta-task through a meta-learning task. The obtained meta-tasks are combined with a similarity metric function to fine-tune the trained image meta-learning classification model, resulting in the final image meta-learning classification model. The defect classification unit is used to classify the defects of the continuous casting billet to be processed using the final image meta-learning classification model.
7. A computer device, characterized in that, include: A processor is used to execute computer programs; A computer-readable storage medium storing a computer program that, when executed by the processor, performs the method as described in any one of claims 1-5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Defect detection method of continuous casting billet surface image based on depth convolution neural network
CN109215009A
Method for solving video question-answer problems by using multi-granularity convolutional network self-attention context network mechanism
CN110990628A