Method and device for measuring average grain size of metal

Through the pre-trained grain boundary segmentation neural network model and feature recalibration module, the problem of insufficient grain boundary connectivity is solved, and the accuracy of metal average grain size measurement and high-connectivity boundary identification are achieved.

CN118691663AInactive Publication Date: 2024-09-24SHENYANG RES INST OF FOUNDRY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411173321.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-09-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing automatic measurement method of metal grain size based on computer vision fails to effectively consider the connectivity of grain boundaries, resulting in inaccurate measurement results.

Method used

The pre-trained grain boundary segmentation neural network model is used, combined with the high-resolution feature extraction module, the grain boundary center feature extraction module and the grain boundary center-guided feature recalibration module. Through the channel and spatial feature recalibration guided by the center feature, cl is used. -Dice loss function improves the connectivity and completeness of grain boundary segmentation.

Benefits of technology

Significantly improves the accuracy and connectivity of grain boundary segmentation, thereby ensuring the accuracy of metal average grain size measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691663A
    Figure CN118691663A
Patent Text Reader

Abstract

The invention provides a metal average grain size measurement method and device, and belongs to the field of metal grain size measurement. Comprising the steps of predicting grain boundary information of a to-be-measured image based on a pre-trained grain boundary segmentation neural network model; wherein the grain boundary segmentation neural network comprises a high-resolution feature extraction module, a grain boundary center feature extraction module and a grain boundary center guided feature re-calibration module; the grain boundary center guided feature re-calibration module CFRM comprises a center feature guided channel feature re-calibration CCR and a spatial feature re-calibration CSR, and the grain boundary center guided feature re-calibration module carries out center feature guided channel feature re-calibration and spatial feature re-calibration based on the grain boundary center feature extraction module; and calculating the average grain size grade based on the product of the grain boundary information and the judgment matrix. The invention provides a method and a device for measuring the average grain size of metal, which can improve the integrity of grain boundary segmentation and ensure the accuracy of the measurement of the average grain size of the metal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of metal grain size measurement, and in particular to a method and device for measuring the average grain size of a metal. Background Art

[0002] The average grain size refers to the average grain size inside the metal material. The size of the metal grain has an important influence on the mechanical properties of the material. Generally speaking, the finer and more uniform the grains are, the higher the strength and toughness of the material will be. Therefore, in order to ensure the mechanical properties of certain materials, the average grain size must be accurately measured. Metallographic inspection is the main means of measuring metal grain size in actual industrial production. Traditional metallographic inspection is to analyze the metal microstructure images collected by the microscope by metallographic inspection experts, which has the disadvantages of unstable measurement results and slow measurement speed.

[0003] In recent years, automatic grain size measurement based on computer vision has received increasing attention. This method uses the powerful feature extraction capability of deep learning to extract grain boundaries through a large amount of training data. However, this type of method does not take into account the connectivity of grain boundaries, and the extracted grain boundaries are broken, resulting in inaccurate measurement of metal grain size. Summary of the invention

[0004] In view of this, the present application provides a method and device for measuring the average grain size of a metal, so as to improve the integrity of grain boundary segmentation and ensure the accuracy of the measurement of the average grain size of the metal.

[0005] Specifically, the present application is implemented through the following technical solutions:

[0006] The first aspect of the present application provides a method for measuring the average grain size of a metal, the method comprising:

[0007] Predicting grain boundary information of the image to be measured based on a pre-trained grain boundary segmentation neural network model, wherein grain boundary connectivity in the grain boundary information is higher than that of an original grain boundary, and the original grain boundary is predicted by an original grain boundary segmentation neural network model that does not include a feature recalibration module guided by a grain boundary center;

[0008] Wherein, the grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module;

[0009] The grain boundary center guided feature recalibration module CFRM includes center feature guided channel feature recalibration CCR and space feature recalibration CSR;

[0010] The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module;

[0011] The average grain size grade is calculated based on the product of the grain boundary information and the judgment matrix.

[0012] A second aspect of the present application provides a device for measuring average grain size of metal, the device comprising a prediction module and a calculation module;

[0013] The prediction module is used to predict the grain boundary information of the image to be measured based on the pre-trained grain boundary segmentation neural network model, the grain boundary connectivity in the grain boundary information is higher than the original grain boundary connectivity, and the original grain boundary is predicted by the original grain boundary segmentation neural network model that does not include the feature recalibration module guided by the grain boundary center;

[0014] Wherein, the grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module;

[0015] The grain boundary center guided feature recalibration module CFRM includes center feature guided channel feature recalibration CCR and space feature recalibration CSR;

[0016] The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module;

[0017] The calculation module is used to calculate the average grain size grade based on the product of the grain boundary information and the judgment matrix.

[0018] The present application provides a method and device for measuring the average grain size of metals. First, based on a pre-trained grain boundary segmentation neural network model, the grain boundary information of the image to be measured is predicted. The grain boundary connectivity in the grain boundary information is higher than the original grain boundary connectivity. The original grain boundary is predicted by the original grain boundary segmentation neural network model that does not include the grain boundary center-guided feature recalibration module. The grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module. The grain boundary center-guided feature recalibration module CFRM includes a center feature-guided channel feature recalibration CCR and a space feature recalibration CSR. The grain boundary center-guided feature recalibration module performs center feature-guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module. Furthermore, the average grain size grade is calculated based on the product of the grain boundary information and the judgment matrix. In this way, through the pre-trained grain boundary segmentation neural network model, the high-resolution feature extraction module, the grain boundary center feature extraction module, the grain boundary center-guided feature recalibration module and the shared loss function are used together, the accurate center feature is used as the prompt information, and the auxiliary role of channel features and spatial features of multiple types and dimensions in boundary confirmation is considered. The feature information of multiple dimensions and multiple positions is used to accurately identify the grain boundaries inside the metal material. At the same time, the cl-Dice loss function is introduced in the loss function, so that connectivity is used as a constraint condition for segmentation, which can greatly improve the integrity and connectivity of the grain boundary segmentation, thereby ensuring the accuracy of the average grain size measurement of the metal. Specifically, from the perspective of the model structure, when identifying grain boundaries, the central feature is used as an identifier, and the central feature obtained by the grain boundary center feature extraction module is used as the prompt information for the calibration of subsequent modules. The central feature is recalibrated in two dimensions, channel and space, and then the grain boundary information is predicted based on accurate central feature recognition, thereby ensuring the accuracy of grain boundary recognition. Furthermore, from the perspective of the model training method and results, after the grain boundary segmentation network model is pre-trained, the model has the ability to extract higher connectivity boundaries than the ordinary grain boundary segmentation model. At this time, the training method and results cooperate with the structure of the model, which greatly improves the model's ability to identify high connectivity boundaries. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flow chart of Embodiment 1 of the method for measuring the average grain size of metal provided in the present application;

[0020] Figure 2 An original material image collected and a comparison diagram thereof with various grain boundary segmentation models are shown in an exemplary embodiment of the present application;

[0021] Figure 3 This is a partial schematic diagram of the grain size calculation principle shown in an exemplary embodiment of the present application. Figure 4 for Figure 3Schematic diagram of the overall results;

[0022] Figure 4 for Figure 3 Schematic diagram of the overall results;

[0023] Figure 5 A schematic diagram of the structure of the grain boundary segmentation neural network model provided in this application;

[0024] Figure 6 A schematic diagram of the structure of the grain boundary center feature extraction module provided in this application;

[0025] Figure 7 A schematic diagram of the structure of the grain boundary center guided feature recalibration module provided in this application;

[0026] Figure 8 This is a schematic structural diagram of Example 1 of the metal average grain size measurement device provided in the present application. DETAILED DESCRIPTION

[0027] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying 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 implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0028] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0030] The present application provides a method and device for measuring the average grain size of a metal, so as to improve the integrity of grain boundary segmentation and ensure the accuracy of the measurement of the average grain size of the metal.

[0031] The present application provides a training method, a connectivity measurement method and a device for a grain boundary segmentation model. First, the grain boundary information of the image to be measured is predicted based on a pre-trained grain boundary segmentation neural network model. The grain boundary connectivity in the grain boundary information is higher than the original grain boundary connectivity. The original grain boundary is predicted by the original grain boundary segmentation neural network model that does not include the grain boundary center-guided feature recalibration module; wherein the grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module; the grain boundary center-guided feature recalibration module CFRM includes a center feature-guided channel feature recalibration CCR and a space feature recalibration CSR, and the grain boundary center-guided feature recalibration module performs center feature-guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module; and then, the average grain size grade is calculated based on the product of the grain boundary information and the judgment matrix. In this way, through the pre-trained grain boundary segmentation neural network model, the high-resolution feature extraction module, the grain boundary center feature extraction module, the grain boundary center-guided feature recalibration module and the shared loss function are used together, the accurate center feature is used as the prompt information, and the auxiliary role of channel features and spatial features of multiple types and dimensions in boundary confirmation is considered. The feature information of multiple dimensions and multiple positions is used to accurately identify the grain boundaries inside the metal material. At the same time, the cl-Dice loss function is introduced in the loss function, so that connectivity is used as a constraint condition for segmentation, which can greatly improve the integrity and connectivity of the grain boundary segmentation, thereby ensuring the accuracy of the average grain size measurement of the metal. Specifically, from the perspective of the model structure, when identifying grain boundaries, the center feature is used as an identifier, and the center feature obtained by the grain boundary center feature extraction module is used as the prompt information for the subsequent module calibration. The center feature is recalibrated in two dimensions, channel and space, and then the grain boundary information is predicted based on accurate center feature recognition, thereby ensuring the accuracy of grain boundary recognition; further, from the perspective of the model training method and results, after the grain boundary segmentation network model is pre-trained, the model has the ability to extract higher connectivity boundaries than the ordinary grain boundary segmentation model. At this time, the training method and results cooperate with the structure of the model, which greatly improves the model's ability to identify high connectivity boundaries. Specific embodiments are given below to introduce the technical solution of the present application in detail.

[0032] Figure 1 This is a flow chart of Example 1 of the metal average grain size measurement method provided in this application. Please refer to Figure 1 , the method provided in this embodiment may include:

[0033] S101. Predicting grain boundary information of an image to be measured based on a pre-trained grain boundary segmentation neural network model, wherein grain boundary connectivity in the grain boundary information is higher than that of an original grain boundary, and the original grain boundary is predicted by an original grain boundary segmentation neural network model that does not include a feature recalibration module guided by the grain boundary center.

[0034] Among them, the grain boundary segmentation neural network includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module; the grain boundary center-guided feature recalibration module CFRM includes center feature-guided channel feature recalibration CCR and space feature recalibration CSR, and the grain boundary center-guided feature recalibration module performs center feature-guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module.

[0035] It should be noted that before obtaining the pre-trained grain boundary segmentation neural network model, it is necessary to construct a data set for grain boundary segmentation, and then train the grain boundary segmentation neural network based on the constructed data set for grain boundary segmentation. Specifically, the method for constructing a data set for grain boundary segmentation is to collect a certain number of original material images based on an inverted microscope, and perform pixel-level grain boundary annotation on each original material image to form a corresponding grain boundary segmentation annotation image, wherein the grayscale of 0 in the annotated image represents a non-grain boundary area, and the grayscale of 1 represents a grain boundary area. Figure 2 This is a comparison diagram of the collected original material image and each grain boundary segmentation model shown in an exemplary embodiment of the present application. Please refer to Figure 2 , Image is the original material image (input), Label represents the result after manual annotation of the original material image (true value), DANet represents the result obtained using the DANet (DualAttention Network) model, Unet represents the result obtained using the Unet (U-type network) model, HRNet represents the result obtained using the HRNet (High-Resolution Network) model, and Ours represents the result obtained using the method of this application (the pre-trained grain boundary segmentation neural network model provided in this application). Among them, the closer the result in Ours is to the result in Label, the better the actual effect is (the more accurate the grain boundary segmentation result is). At this time, based on the more accurate grain boundary segmentation result, the grain size calculation will be more accurate.

[0036] Specifically, the principle of grain size calculation is as follows:

[0037] Figure 3 This is a partial schematic diagram of the grain size calculation principle shown in an exemplary embodiment of the present application. Figure 4 for Figure 3 Please also refer to Figure 3 and Figure 4 ,exist Figure 3 In the algorithm, the grain size grade is divided based on the number of intersections of the grain boundary segmentation result (Predicted mask, which is the result output by the model after processing the input image, specifically the grain boundary segmentation result here) and the circular test lines (Circular test lines, specifically three concentric rings). The more the number of intersections, the denser the grain size and the higher the calculation accuracy. In addition, the connectivity of the segmentation results should be guaranteed, otherwise the calculation results will be inaccurate. For example, if the connectivity is not guaranteed at the place where the intersection should exist, the intersection will be missing here, resulting in inaccurate calculation results. The high-resolution feature extraction module and grain boundary center feature extraction module mentioned below are all for ensuring connectivity.

[0038] Figure 5 For the structural diagram of the grain boundary segmentation neural network model provided in this application, please refer to Figure 5 Specifically, the grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module; the high-resolution feature extraction module extracts image information; the image information is input into the grain boundary center feature extraction module for feature extraction to obtain a center feature; according to the center feature, the feature recalibration module guided by the grain boundary center prompts the center feature-guided channel feature recalibration and spatial feature recalibration. Among them, the high-resolution feature extraction module is used to extract the features of the data in the above-mentioned dataset. In specific implementation, the high-resolution feature extraction module uses HRNet pre-trained by ImageNet as the feature extraction network. Furthermore, HRNet18 in the HRNet series is selected as the feature extraction network to balance the accuracy and inference speed of the feature extraction network.

[0039] It should be noted that the grain boundary segmentation neural network model also includes a grain boundary center feature extraction module, and the grain boundary center feature extraction module extracts the center feature of the input image based on a tree structure convolution layer. Figure 6 For the schematic diagram of the grain boundary center feature extraction module provided for this application, please refer to Figure 6 The grain boundary center feature extraction module extracts the center feature of the input image based on the tree structure convolution layer, including:

[0040] (1) The input image is input to the tree-structured convolutional layer.

[0041] (2) Extract multiple intermediate features of the input image based on the tree-structured convolutional layer.

[0042] (3) Multiple intermediate features of each layer are fused and passed to the convolutional layer of the previous layer until the central feature of the input image is obtained.

[0043] Please continue to refer to Figure 6 The grain boundary center feature extraction module extracts the center feature of the input image based on the tree structure convolution layer, and specifically includes:

[0044] (1) The grain boundary center feature extraction module has a tree structure, including a plurality of first designated processing layers with the same structure.

[0045] (2) After receiving the high-resolution feature map of the input image, the grain boundary center feature extraction module obtains a plurality of intermediate features based on a first designated processing layer; the first designated processing layer includes a convolution layer, a group normalization (GroupNormalization) and an activation function layer.

[0046] For example, in one embodiment, the high-resolution feature maps of the last three stages extracted by the high-resolution extraction module are labeled as F1, F2 and F3, respectively, and input into the tree-structured convolutional layer, and then these three high-resolution feature maps are respectively passed through a convolutional layer with a convolution kernel of 3×3 and a channel number that is twice the number of channels of the input feature map, group normalization and Relu activation function to obtain the first-level intermediate features.

[0047] (3) Adding two adjacent intermediate features among the plurality of intermediate features and passing the added result through the first designated processing layer to obtain a plurality of intermediate features of the previous level, and so on to obtain intermediate features of the next higher level until the current number of intermediate features is 2 and then stopping.

[0048] Specifically, combining the above example, adjacent first-level intermediate features are added in pairs by element-by-element addition, and the results of the addition are passed through a convolution layer with a convolution kernel of 3×3 and a channel number that is twice the number of channels of the input feature map, group normalization, and ReLU activation function to obtain two second-level intermediate features.

[0049] (4) When the number of intermediate features is 2, the final central feature is obtained through a second specified processing; the second specified processing includes a convolution layer, group normalization, and an activation function.

[0050] Furthermore, the two secondary intermediate features are added element-by-element, and the final central feature is obtained through a convolution layer with a convolution kernel of 3×3 and 1 channel, group normalization and sigmoid activation function.

[0051] It should also be noted that the final central feature can be recorded as PM, and the central feature PM is supervised by the downsampling result of the label image during the grain boundary segmentation model training process.

[0052] It should also be noted that the grain boundary segmentation neural network also includes a grain boundary center-guided feature recalibration module, which performs center-feature-guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module. Figure 7 For the structural diagram of the grain boundary center guided feature recalibration module provided in this application, please refer to Figure 7 The grain boundary center-guided feature recalibration module includes a center feature-guided channel feature recalibration CCR and a spatial feature recalibration CSR, wherein the center feature-guided channel feature recalibration CCR re-predicts the probability of the center feature based on the center feature mask to recalibrate the channel feature, which means that CCR uses the center feature mask as a guide to re-predict the probability of the center feature to better accurately calibrate the channel feature. In this process, more attention is paid to the information of the center feature, and other information is filtered to make the network more connected. The spatial feature recalibration CSR uses the correlation between the grain boundary mask and the center feature to recalibrate the spatial feature, which means that CSR uses the correlation between the grain boundary mask and the center feature to recalibrate the spatial feature to further improve the accuracy and robustness of the spatial feature.

[0053] Among them, channel feature (Crystal Channel Feature) and spatial feature (Crystal Spatial Feature) refer to two different types of features used to describe the structure or characteristics of metal materials in grain boundary segmentation or metal material structure analysis. Channel features generally refer to features related to channels or structures inside metal materials. These features may include information such as density distribution, lattice structure, atomic arrangement or defects in the structure of metal materials inside the metal material. Channel features can be used to characterize the microstructural features inside the metal material. Spatial features generally refer to features related to the position, shape and distribution of metal grains in three-dimensional space. These features may include information such as the shape, size, position, orientation of metal grains or spatial relationship with other grains. Spatial features can be used to describe the arrangement and distribution of metal grains in space. The method provided by the present invention can calibrate metal grain features of different dimensions and directions, namely channel features and spatial features, based on the prompt of the central feature, so as to accurately identify the state inside the metal, provide a basis for accurate segmentation, and thus improve the accuracy and efficiency of segmentation.

[0054] Please continue to refer to Figure 7 The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module, including:

[0055] (1) Receiving the center feature extracted by the grain boundary center feature extraction module, wherein the center feature is a multi-scale feature of the grain boundary center region.

[0056] Specifically, the extracted multi-scale features are recorded as , where (k=1:4), h and are the height and width of the input image respectively, and C is the number of channels.

[0057] (2) Average pooling the central features to compress the features at each scale.

[0058] Specifically, through pseudo-mask average pooling compression It should be noted that, compared with the global average pooling, the method in this embodiment only focuses on the region of interest (the center region of the grain boundary) and does not consider the characteristics of other regions.

[0059] In specific implementation, pseudo-mask average pooling can be expressed by the following formula:

[0060] ;

[0061] Among them, PM is the central feature, h and are the height and width of the input image, respectively. is the extracted multi-scale features.

[0062] (3) The compressed features are input into the fully connected layer, and the output of the fully connected layer is converted into a probability distribution through the Softmax function.

[0063] Specifically, combined with the above compression results, Input to two fully connected layers, and convert the output of the fully connected layer into a probability distribution through the Softmax function. The calculation process is:

[0064] ;

[0065] Among them, R is the Relu activation function. and are the weights of the two fully connected layers. yes Transformation result through CCR.

[0066] Please continue to refer to Figure 7 The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module, and further includes:

[0067] The spatial features are recalibrated using the correlation between the grain boundary mask and the central features.

[0068] It should be noted that the mask in the center area of ​​the grain boundary Grain boundary mask A subset of and The correlation between them can be as follows:

[0069] ;

[0070] The recalibration of the spatial features includes: multiplying the channel feature recalibration result guided by the central feature with the sum of the central feature and the unit matrix, simulating the Boolean union operation, so as to obtain the final feature representation after CSR transformation.

[0071] Specifically, the final feature representation after CSR transformation is as follows:

[0072] ;

[0073] in, For Through the transformation result of CCR, PM is the central feature, for The transformation result through CSR.

[0074] The method provided by the present invention utilizes the extraction and operation of the mask prompt feature of the central feature, thereby improving the accuracy of the model in identifying the internal structure of the metal, and further improving the accuracy of the grain boundary segmentation of the model.

[0075] The pre-training process of the grain boundary segmentation neural network model is explained below. Specifically, the pre-training process of the grain boundary segmentation neural network model includes: constructing a common loss function according to the structure of the grain boundary segmentation neural network model; training the grain boundary segmentation neural network model according to the common loss function and training samples; the common loss function at least includes: a central feature Dice loss function and a cl-Dice loss function based on the output of the grain boundary center-guided feature recalibration module, which are used to evaluate the central feature calibration accuracy of the features output by the grain boundary center-guided feature recalibration module and the connectivity of grain boundary segmentation, respectively.

[0076] Wherein, the training of the grain boundary segmentation neural network model according to the common loss function and the training samples includes: inputting the image to be predicted into the grain boundary segmentation neural network model to be trained based on the training samples; calculating the center feature Dice loss function and the cl-Dice loss function according to the output of the feature recalibration module guided by the grain boundary center (the two loss functions will be different at different stages, wherein the Dice loss function is Figure 5PM stage in the process, cl-Dice loss function is in the final output stage); calculate pixel-level loss function and structure-level loss function according to the output of the grain boundary segmentation neural network model; comprehensively calculate all loss functions and evaluation functions to obtain the value of the common loss function; train the grain boundary segmentation neural network model based on the value of the common loss function of adjacent rounds.

[0077] The training method provided by the present invention can achieve high connectivity segmentation by constraining the model with a loss function, and at the same time, accurately identify features and skeletons during the training process through correction of feature extraction and prompting of skeleton topology, thereby improving the accuracy of feature extraction and recalibration during the training process, thereby improving the efficiency of training.

[0078] Specifically, the central feature Dice loss function is:

[0079] ;

[0080] in, , represents the weight of each loss function, represents the central feature Dice loss function, PM is the central feature, and for and The central skeleton, To monitor the characteristics of the center Tags, Tags ∈{0,1}, Output for the network.

[0081] ;

[0082] Among them, PM is the central feature, To monitor the characteristics of the center .

[0083] The cl-Dice loss function is:

[0084] ;

[0085] in,

[0086] ;

[0087] in, and for and The central skeleton of the label ∈{0,1}, Output for the network.

[0088] It should also be noted that the common loss function also includes a pixel-level cross entropy loss function and a structural similarity loss function;

[0089] The pixel-level cross entropy loss function at least includes:

[0090] The grain boundary segmentation neural network predicts a pixel-wise cross entropy loss between the output and the label of the input sample as well as a pixel-wise cross entropy loss between the center feature and the label used to supervise the center feature.

[0091] Assume that the network output is , tagged as ∈{0,1}, used to supervise the central feature The label is Specifically, the calculation of the above binary pixel-level cross entropy loss can be as follows:

[0092] ;

[0093] Furthermore, It is a pixel-level cross entropy loss function widely used in image binary segmentation. is the weighted sum of the two-stage losses, Represents the weight of each loss function:

[0094] ;

[0095] The structural similarity loss function at least includes:

[0096] (1) Calculate the structural similarity index loss between the network output and the label, and calculate the structural similarity loss between the central feature and the label used to supervise the central feature.

[0097] Specifically, the structural similarity loss function constrains the output of the network in terms of image structural similarity through the SSIM loss function, where the SSIM loss function is defined as:

[0098] ;

[0099] in , and , are the mean and standard deviation of the network output and labels, respectively. is their covariance. and is a constant (a very small constant) that avoids the divisor being 0.

[0100] (2) The above two structural similarity losses are weighted and summed according to the weights to obtain the structural similarity loss function.

[0101] Specifically, the structural similarity loss function is as follows:

[0102] ;

[0103] in, is the structural loss function, is the structural similarity index loss between the network output and the label, is the structural similarity loss between the center feature and the label used to supervise the center feature, Represents the weight of each loss function.

[0104] In summary, the common loss function for constructing the grain boundary center feature extraction module and the grain boundary segmentation neural network can be expressed as:

[0105] ;

[0106] in, is the pixel-level cross entropy loss function, It is the structural loss function and the central feature Dice loss function.

[0107] S102, calculating an average grain size grade based on the product of the grain boundary information and a judgment matrix.

[0108] Specifically, the average grain size grade is calculated based on the product of the grain boundary information and the judgment matrix, including:

[0109] (1) Inputting an original image into a trained grain boundary segmentation model to obtain a grain boundary segmentation result output by the grain boundary segmentation model.

[0110] (2) Binarizing the grain boundary segmentation result.

[0111] Specifically, by performing threshold processing on the network output, the final predicted grain boundary binarized image is obtained.

[0112] (3) Construct a concentric circle matrix of the same size based on the binarized image.

[0113] It should be noted that a zero matrix of the same size as the binarized image is constructed, and three concentric circles are drawn in the matrix. The elements in the zero matrix become 1 at the positions where the concentric circles pass.

[0114] (4) Calculate the Boolean AND result of the concentric circle matrix and the binarized image to obtain the final matrix.

[0115] Specifically, the concentric circle matrix is ​​multiplied by the binarized image.

[0116] (5) Performing a connected domain analysis on the final matrix and calculating the number of connected domains therein.

[0117] (6) Calculating the average grain size grade of the image according to the number of connected domains.

[0118] It should be noted that the number of connected domains in the final matrix is ​​the number of intersections between the grain boundaries and the concentric rings. Based on the number of intersections, the average grain size grade of the image can be calculated according to the test standard ASTM E112-96.

[0119] The present embodiment provides a method for measuring the average grain size of metals. First, based on a pre-trained grain boundary segmentation neural network model, the grain boundary information of the image to be measured is predicted. The grain boundary connectivity in the grain boundary information is higher than the original grain boundary connectivity. The original grain boundary is predicted by the original grain boundary segmentation neural network model that does not include the grain boundary center-guided feature recalibration module. The grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module. The grain boundary center-guided feature recalibration module CFRM includes a center feature-guided channel feature recalibration CCR and a space feature recalibration CSR. The grain boundary center-guided feature recalibration module performs center feature-guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module. Furthermore, the average grain size grade is calculated based on the product of the grain boundary information and the judgment matrix. In this way, through the pre-trained grain boundary segmentation neural network model, the high-resolution feature extraction module, the grain boundary center feature extraction module, the grain boundary center-guided feature recalibration module and the shared loss function are used together, the accurate center feature is used as the prompt information, and the auxiliary role of channel features and spatial features of multiple types and dimensions in boundary confirmation is considered. The feature information of multiple dimensions and multiple positions is used to accurately identify the grain boundaries inside the metal material. At the same time, the cl-Dice loss function is introduced in the loss function, so that connectivity is used as a constraint condition for segmentation, which can greatly improve the integrity and connectivity of the grain boundary segmentation, thereby ensuring the accuracy of the average grain size measurement of the metal. Specifically, from the perspective of the model structure, when identifying grain boundaries, the central feature is used as an identifier, and the central feature obtained by the grain boundary center feature extraction module is used as the prompt information for the calibration of subsequent modules. The central feature is recalibrated in two dimensions, channel and space, and then the grain boundary information is predicted based on accurate central feature recognition, thereby ensuring the accuracy of grain boundary recognition. Furthermore, from the perspective of the model training method and results, after the grain boundary segmentation network model is pre-trained, the model has the ability to extract higher connectivity boundaries than the ordinary grain boundary segmentation model. At this time, the training method and results cooperate with the structure of the model, which greatly improves the model's ability to identify high connectivity boundaries.

[0120] Corresponding to the aforementioned embodiment of a method for measuring an average grain size of a metal, the present application also provides an embodiment of a device for measuring an average grain size of a metal.

[0121] Figure 8 This is a schematic diagram of the structure of the first embodiment of the metal average grain size measurement device provided by this application. Figure 8 The device provided in this embodiment includes a prediction module 810 and a calculation module 820; wherein,

[0122] The prediction module 810 is used to predict the grain boundary information of the image to be measured based on the pre-trained grain boundary segmentation neural network model, the grain boundary connectivity in the grain boundary information is higher than the original grain boundary connectivity, and the original grain boundary is predicted by the original grain boundary segmentation neural network model that does not include the feature recalibration module guided by the grain boundary center;

[0123] Wherein, the grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module;

[0124] The grain boundary center guided feature recalibration module CFRM includes center feature guided channel feature recalibration CCR and space feature recalibration CSR.

[0125] The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module;

[0126] The calculation module 820 is used to calculate the average grain size grade based on the product of the grain boundary information and the judgment matrix. Figure 1 The steps, specific implementation principles and implementation processes of the method embodiment shown are similar and will not be repeated here.

[0127] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0128] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0129] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for measuring the average grain size of a metal, characterized in that: The method comprises: Predicting grain boundary information of the image to be measured based on a pre-trained grain boundary segmentation neural network model, wherein grain boundary connectivity in the grain boundary information is higher than that of an original grain boundary, and the original grain boundary is predicted by an original grain boundary segmentation neural network model that does not include a feature recalibration module guided by a grain boundary center; Wherein, the grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module; The grain boundary center guided feature recalibration module CFRM includes center feature guided channel feature recalibration CCR and space feature recalibration CSR; The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module; Calculating an average grain size grade based on the product of the grain boundary information and the judgment matrix; The calculating the average grain size grade based on the product of the grain boundary information and the judgment matrix includes: Inputting the image to be predicted into the pre-trained grain boundary segmentation model, and obtaining the grain boundary segmentation result output by the grain boundary segmentation model; Binarizing the grain boundary segmentation result; Construct a concentric circle matrix of the same size based on the binarized image; Calculating the Boolean AND result of the concentric circle matrix and the binarized image as a final matrix; Performing a connected domain analysis on the final matrix to calculate the number of connected domains therein; The average grain size grade of the image is calculated according to the number of the connected domains.

2. The method according to claim 1, characterized in that The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module, including: Receiving the center feature extracted by the grain boundary center feature extraction module, wherein the center feature is a multi-scale feature of the grain boundary center area; Average pooling the central features to compress the features of each scale; The compressed features are input into the fully connected layer, and the output of the fully connected layer is converted into a probability distribution through the Softmax function.

3. The method according to claim 1, characterized in that The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module, including: The spatial features are recalibrated using the correlation between the grain boundary mask and the central features; The recalibration of the spatial features includes: multiplying the channel feature recalibration result guided by the central feature with the sum of the central feature and the unit matrix, simulating the Boolean union operation, so as to obtain the final feature representation after CSR transformation.

4. The method according to claim 1, characterized in that: The grain boundary center feature extraction module extracts the center feature of the input image based on the tree structure convolution layer, including: The input image is input into the tree structure convolution layer; Extract multiple intermediate features of the input image based on the tree-structured convolutional layer; Multiple intermediate features of each layer are fused and passed to the convolutional layer of the previous layer until the central feature of the input image is obtained.

5. The method according to claim 1, characterized in that The pre-training comprises: Constructing a common loss function according to the structure of the grain boundary segmentation neural network model; Training the grain boundary segmentation neural network model according to the shared loss function and training samples; The shared loss function includes at least: a central feature Dice loss function and a cl-Dice loss function based on the output of the grain boundary center-guided feature recalibration module, which are used to evaluate the central feature calibration accuracy of the features output by the grain boundary center-guided feature recalibration module and the connectivity of the grain boundary segmentation, respectively.

6. The method according to claim 5, characterized in that The step of training the grain boundary segmentation neural network model according to the common loss function and the training samples comprises: Inputting the image to be predicted into the grain boundary segmentation neural network model to be trained based on the training sample; Calculate the center feature Dice loss function and the cl-Dice loss function according to the output of the grain boundary center guided feature recalibration module; Calculating a pixel-level loss function and a structure-level loss function according to the output of the grain boundary segmentation neural network model; All loss functions and evaluation functions are calculated comprehensively to obtain the value of the common loss function; The grain boundary segmentation neural network model is trained based on the value of the common loss function of adjacent rounds.

7. The method according to claim 1, characterized in that The grain boundary segmentation neural network model includes: Extract image information based on high-resolution feature extraction module; Inputting the image information into the grain boundary center feature extraction module to extract features and obtain center features; A feature recalibration module guided by the center feature at the grain boundary center performs channel feature recalibration and space feature recalibration guided by the center feature according to the center feature.

8. The method according to claim 5, characterized in that The shared loss function also includes a pixel-level cross entropy loss function and a structural similarity loss function; The pixel-level cross entropy loss function at least includes: The pixel-level cross entropy loss between the grain boundary segmentation neural network prediction output and the label of the input sample and the pixel-level cross entropy loss between the center feature and the label used to supervise the center feature; The structural similarity loss function at least includes: Calculate the structural similarity index loss between the network output and the label and calculate the structural similarity loss between the central feature and the label used to supervise the central feature; The above two structural similarity losses are weighted and summed according to the weights to obtain the structural similarity loss function.

9. A device for measuring average grain size of metal, characterized in that: The device includes a prediction module and a calculation module; The prediction module is used to predict the grain boundary information of the image to be measured based on the pre-trained grain boundary segmentation neural network model, the grain boundary connectivity in the grain boundary information is higher than the original grain boundary connectivity, and the original grain boundary is predicted by the original grain boundary segmentation neural network model that does not include the feature recalibration module guided by the grain boundary center; Wherein, the grain boundary segmentation neural network model includes a high-resolution feature extraction module, a grain boundary center feature extraction module, and a grain boundary center-guided feature recalibration module; The grain boundary center guided feature recalibration module CFRM includes center feature guided channel feature recalibration CCR and space feature recalibration CSR; The grain boundary center guided feature recalibration module performs center feature guided channel feature recalibration and space feature recalibration based on the grain boundary center feature extraction module; The calculation module is used to calculate the average grain size grade based on the product of the grain boundary information and the judgment matrix; The calculating the average grain size grade based on the product of the grain boundary information and the judgment matrix includes: Inputting the image to be predicted into the pre-trained grain boundary segmentation model, and obtaining the grain boundary segmentation result output by the grain boundary segmentation model; Binarizing the grain boundary segmentation result; Construct a concentric circle matrix of the same size based on the binarized image; Calculating the Boolean AND result of the concentric circle matrix and the binarized image as a final matrix; Performing a connected domain analysis on the final matrix to calculate the number of connected domains therein; The average grain size grade of the image is calculated according to the number of the connected domains.

Citation Information

Patent Citations

  • Metallographic grain boundary extraction and communication method based on deep learning

    CN113506240A

  • Metallographic structure grain size grade identification method

    CN118379257A

  • Method and apparatus for analyzing microstructure of material

    WO2022061922A1