A method and system for quantitatively analyzing the phase content of the microstructure of a metallic material
By using deep learning image classification and segmentation technology, a microstructure database and model were established, which solved the problem of insufficient applicability of traditional metallographic analysis methods. This enabled efficient and accurate analysis of the microstructure phase content of multi-phase metallic materials, improving the reliability of material performance evaluation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA NAT PETROLEUM CORP
- Filing Date
- 2022-11-30
- Publication Date
- 2026-08-04
AI Technical Summary
Traditional metallographic analysis methods rely on subjective experience and have poor applicability. They are difficult to accurately and quantitatively analyze the microstructure of metal materials with multiple phases or insignificant light and dark contrasts, resulting in insufficient evaluation of the material performance of key load-bearing components and affecting product reliability.
Deep learning image classification and segmentation techniques are employed to establish a microstructure database and model. Intelligent qualitative and quantitative analysis is performed through overview models and expert models, including convolutional neural networks and Transformer structures. Combined with grayscale distribution and semantic segmentation methods, the microstructure features of metallic materials are automatically identified and extracted.
It enables efficient and accurate microstructure phase content analysis of complex-shaped metallic materials, reduces manual intervention, improves the applicability and accuracy of the analysis, and supports the material performance evaluation of key load-bearing components.
Smart Images

Figure CN118116514B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence, and specifically relates to a method for quantitative analysis of the phase content of microstructure in metallic materials. Background Technology
[0002] The microstructure of a material is crucial in determining its composition, manufacturing process, and properties. Metallographic analysis, using a metallographic microscope to observe, identify, and analyze the internal microstructure of metallic materials and quantitatively analyze the relative content and uniformity of its constituent phases, is a vital means of determining whether the phase composition is abnormal and whether the phase distribution is uniform. The phase composition and distribution determine the material's microstructural characteristics, which are the key medium connecting its composition, manufacturing process, and properties. Analyzing and characterizing the microstructure of materials is essential for optimizing manufacturing processes, ensuring product quality, and improving product performance. Traditional metallographic analysis methods include sample preparation, microscopic observation, image acquisition, and manual analysis.
[0003] Manual analysis mainly includes microstructure type identification, relative content analysis of constituent phases, and metallographic determination and grading. Microstructure type identification involves analyzing the geometric shape, distribution, color, and other characteristics of phases in a microscopic image to determine their category. This work requires highly specialized metallographic technicians, and the analysis may be subject to their subjectivity, affecting the accuracy of the results. Relative content analysis of constituent phases uses computer image processing methods to adjust the contrast and brightness of the microscopic image, making the light and dark characteristics between different constituent phases more prominent. Then, binary segmentation is used to calculate the area occupied by each constituent phase to obtain relative content information. This method is not only time-consuming and labor-intensive but also only applicable to two-phase microstructures with significant light and dark contrast, such as carbon ferrite + pearlite (F+P) or austenitic stainless steel austenite + ferrite (A+F). For multi-phase microstructures or microstructures with insignificant light and dark contrast, such as bainite + ferrite (B+F) in steel or tempered sorbite + bainite (S+B), the above method is no longer applicable. Therefore, quantitative analysis of phase composition is currently only applicable to some materials, and such analysis is difficult to achieve for most metallic materials. However, during the service of products or equipment, the material properties of their critical load-bearing components determine their reliability. When failure occurs, the material of critical load-bearing components is often the first to fail. Therefore, when evaluating the quality of product materials, analyzing the structure, content, and uniformity of phase composition in critical load-bearing components is an important means of preventing failure. Current phase content analysis methods suffer from poor applicability and low efficiency, resulting in a lack of relevant quantitative and statistical metallographic analysis. Therefore, a new method is needed that is widely applicable, independent of subjective experience, and highly efficient and accurate for the identification of the microstructure and quantitative analysis of phase composition in metallic materials.
[0004] With the development of robotics, artificial intelligence, and computer technology, emerging technologies such as industrial robots and industrial artificial intelligence are gradually being applied to manufacturing. Compared with traditional manufacturing systems that rely heavily on manual labor, these new technologies offer advantages such as labor savings, high efficiency, stable performance, and the ability to operate for extended periods. Furthermore, deep learning image classification and segmentation techniques can effectively identify and extract the constituent phases of microscopic structures with complex morphologies, colors, and interfaces, demonstrating enormous application potential. Summary of the Invention
[0005] To address the above problems, the present invention provides a method for quantitative analysis of the phase content in the microstructure of metallic materials, comprising: Establishment of a microscopic tissue database; An overview of model building, training, and deployment; The construction, training, and deployment of expert models; Intelligent qualitative and quantitative analysis of the microstructure of metallic materials based on overview models and expert models.
[0006] Its further preferred technical solution is as follows: the types of microstructures include: Organizational structure type; Tissue imaging type; Organizational distribution type; A further preferred technical solution is as follows: The definition of the structure type is: in metallography, the major category of structure is defined according to the different characteristics of the microstructure morphology, phase composition, relative quantity, size and distribution of this type of metal material, i.e., the structure type, denoted as C0; A further preferred technical solution is as follows: the definition of the tissue image type is: the category information defined according to the contrast between different phases in the microscopic image, denoted as C1=1, 2.
[0007] A further preferred technical solution is as follows: the tissue distribution type is defined as follows: for the microstructure determined by category C0, a corresponding category is defined according to the distribution characteristics of each constituent phase, denoted as C2=0, 1, 2; For microstructures where C1=1, the distribution type of all constituent phases is C2=0; C2=1 indicates that this phase is the dominant phase, has no obvious boundary, and is diffusely distributed throughout the entire image field of view; C2=2 indicates that this phase is a minor phase, which is dispersed among the major phases and has relatively obvious phase boundaries. The distribution area has closed graphical characteristics.
[0008] A further preferred technical solution is as follows: the overview model is composed of a convolutional neural network or a Transformer structure with image classification function, which performs feature extraction and classification on the input microscopic tissue image to determine its constituent type C0.
[0009] A further preferred technical solution is as follows: the expert model locates and extracts the location, morphology and distribution area of different constituent phases in a specific C0 category tissue; depending on the tissue C1 category, the expert model has two types. When C1=1, the first expert model is built based on the adaptive image segmentation method of gray distribution. When C1=2, a semantic segmentation model is built based on a convolutional neural network or Transformer structure. This is the second expert model.
[0010] A further preferred technical solution is as follows: The steps for building the first expert model are as follows: The input microscopic tissue image is converted to grayscale, and its brightness and contrast are adjusted to make the contrast between light and dark phases significant; with a size of The window with The input image is sampled using a step size to obtain the sampling result, where This represents the total number of samples. Upsample each sample in the sampling results to increase its size. The grayscale distribution function is obtained by performing grayscale statistics on the upsampled samples. , where g is the grayscale value; The steps to build the second expert model are as follows: Sample search: Retrieve samples with C1=2 from the directory containing the original data and store them in the directory. They are stored according to their C0 category values in the first directory named " In the subdirectory of ""; For a certain C0 category, " The catalog is used to sample all samples within it using a sliding window with a certain step size, resulting in a sample of size [size missing]. The training samples, and all sampling results form a sample set. The sample names have the following format:
[0011] right Sample set: Create a set of category labels, whose names have the following format:
[0012] The above formula indicates that when the C2 category value of a certain component phase is 2, a category label is established for that component phase; All C2=2 constituent category labels constitute a label set; definition For each category label, the feature value is calculated according to the following formula. Assign a value; Phase labeling: for Each name is " ":
[0013] The newly generated image after annotation is stored as an annotation map in " The subdirectory is named " The image number is consistent with the original sample.
[0014] A further preferred technical solution is as follows: the steps of the intelligent qualitative and quantitative analysis method for the microstructure of metallic materials are as follows: Intelligent identification of microscopic tissue composition based on overview model: The preprocessed image is input into the overview model to obtain the C0 category prediction value of the image to be analyzed; Tissue composition category analysis: Input the output C0 category prediction value into the microscopic tissue database to obtain the C1 category value, P vector and C2 category value corresponding to the C0 category prediction value; When C1=1, the first expert model is invoked; when C1=2, the second expert model is invoked. Intelligent extraction of phase content based on the first or second expert model: The microscopic tissue image to be analyzed is converted to grayscale by inputting the overview model; The input image is sampled using a step-size window, and the position of each sample is recorded to obtain the sampling result and the position index; The sampling results are sequentially input into the first or second expert model to obtain the segmentation map of the constituent phases; The segmented images are stitched together according to the position index to obtain a phase composition feature map; Phase content calculation and statistical analysis: Based on the obtained phase composition feature map, calculate the number of pixels occupied by different composition phases, and then calculate the relative content of each composition phase; The content of each component phase is determined by the mean, the homogeneity of each component phase is determined by the standard deviation, and the homogeneity difference between different component phases is obtained by the coefficient of variation.
[0015] Its further preferred technical solution includes: Microstructure data module: used to identify the type of microstructure in an image; Overview model module: used for qualitative analysis of microstructures; Expert model module: Used for quantitative analysis of microstructures.
[0016] The beneficial effects of this invention are: This invention solves the problems of traditional metallographic analysis, such as reliance on subjective experience, lack of widely applicable and highly accurate quantitative analysis technology for phase content, and insufficient statistical analysis of metallographic structures.
[0017] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This diagram illustrates the overall technical roadmap of the algorithm of this invention. Figure 2 The data structure diagram of the microstructure database of the present invention is shown; Figure 3 A schematic diagram of the structure of the overview recognition model of the present invention is shown; Figure 4 This diagram illustrates the structure and analysis process of the Type I expert model of this invention. Figure 5 A schematic diagram illustrating the principle of the triangular segmentation method of the present invention is shown; Figure 6 This invention illustrates the structure and analysis process of a Type II expert model. Figure 7 A schematic diagram of the data structure of the training dataset for the Type II expert model of this invention is shown. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Example 1: A method for quantitative analysis of the phase content in the microstructure of metallic materials, the overall technical route of which is as follows: Figure 1 As shown, the specific steps include: Step 1: Establishing a Microstructure Database. A microstructure database is established for a specific type of metallic material to be analyzed. This includes the following sub-steps: Sub-step 1: Establish the definition of microstructure composition, specifically including the following definitions: Definition 1. Microstructure Type. In metallography, a major category of microstructure is defined based on the different characteristics of the microstructure morphology, phase composition, relative quantity, size, and distribution of a type of metallic material. It is denoted as C0, and all constituent phases within it are written as component vectors. ; Definition 2. Tissue Image Type. Based on the contrast between different phases (tissues) in a microscopic image, this category information is denoted as C1=1 and C1=2. C1=1 indicates that there is significant contrast between the constituent phases of this type of microstructure, and the constituent phases have clear boundaries; this type of tissue is generally a two-phase tissue. C1=2 indicates that the brightness and grayscale characteristics of the constituent phases of this type of microstructure are similar, there is no significant contrast, and the constituent phases have relatively clear boundaries; this type of tissue can be a two-phase or multi-phase structure. Definition 3. Tissue Distribution Type. For microstructures defined by category C0, a corresponding category is defined based on the distribution characteristics of each constituent phase, denoted as C2=0, 1, and 2. It is stipulated that the distribution type of all constituent phases of microstructures with C1=1 is C2=0; when C2=1, it represents that the constituent phase is the dominant phase, characterized by the absence of clear boundaries, diffuse distribution throughout the entire field of view of the microscopic image, and determination of the overall geometric characteristics of the microstructure in the image; when C2=2, it represents that the constituent phase is the minor phase, characterized by a dispersed distribution among the dominant phases with relatively clear phase boundaries, and the distribution area exhibits closed graphical characteristics.
[0022] Sub-step 2, Quantitative description method of microstructure: According to the definition described in sub-step 1, microstructure has three categories of characteristic values, namely C0, C1, and C2. For a certain metallic material, its microstructure has the following characteristics: Figure 2 The category information structure shown.
[0023] Sub-step 3: Based on the methods described in sub-steps 1 and 2, establish the mapping relationship between the microstructure image, component vector, and category label of the metallic material to be analyzed, forming a " "database.
[0024] Step 2: Building, training, and deploying the overview model. The overview model consists of a convolutional neural network or Transformer structure with image classification capabilities. It extracts features and classifies the input microscopic tissue image, determines its composition type, and outputs a type label prediction value iC0. Specifically, it includes the following sub-steps: Sub-step 1: Overview The model structure mainly includes a feature extraction layer and a classifier. Taking a convolutional neural network as an example, it specifically includes: a) The feature extraction layer consists of an array of several convolutional-downsampling layers, such as... Figure 3As shown. The convolutional layer (Conv) utilizes a size of... The convolution kernel extracts features from the image through convolution operations, obtaining a three-dimensional ( The feature map is structured as follows. The downsampling layer reduces the feature map size through operations such as max pooling, average pooling, or large stride convolution. Simultaneously, it condenses and abstracts typical features. Pooling layers are generally located after two convolutional layers, forming a convolution-convolution-pooling block structure. For deeper networks, a pooling layer is usually added after multiple convolution-convolutional structures in each block for feature abstraction; b) The classifier mainly consists of multi-layer fully connected neural networks, used to classify the feature extraction results, and finally outputs the probability of the current input image belonging to the category through the softmax function.
[0025] Sub-step 2, Overview of Model Training Set Construction, specifically includes: a) Image Preprocessing. Brightness and contrast are adjusted for all microscopic tissue images in the microscopic tissue database described in step one to ensure clear main microscopic tissue features and significant differences between different phases. The processed images are then resized to a fixed size. Stored in the computer under the name " Under the directory of "; b) Classify and label microscopic tissue images with different C0 values. Establish a category label set, where each label has the following format: (1) Establish" "The directory and a series of subdirectories are named sequentially according to the format specified in formula (1) to form a labeled folder. Randomly read " Images in the directory are stored sequentially according to their C0 value in folders named... In the annotation folder, rename the images in each category annotation folder according to the format "C0-image number" to complete the data annotation; c) Perform data augmentation by transforming the training samples in each subdirectory through flipping, rotating, cropping, and scaling to generate augmented samples. The sample size in each subdirectory after augmentation should be no less than 500; d) Create subdirectories "total data", "training", "validation", and "testing" in the "Training Dataset" directory, and store the original samples and augmented samples from all annotation folders in the "total data" subdirectory. Select data in a ratio of (7~8):(1~2):(1~2) to form the training set, validation set, and test set, and store them in the "training", "validation", and "testing" subdirectories respectively. Rename the data in the above subdirectories, adding the dataset type to the original name, with the naming format "". The new names are stored in text files named "training", "validation", or "testing", forming a tag document.
[0026] Sub-step 3: Overview of Model Training and Deployment. a) Model Training. Train the model built in Step 1 using the training and validation sets constructed in Step 2. The training set provides data for the model to learn features, and the validation set tests the model's prediction accuracy after each training cycle. Training uses an adaptive gradient optimizer (AdamW) with a global learning rate of 0.00001. Adjust parameters such as the L2 regularization coefficient and batch size based on the training results, ultimately maximizing the accuracy (≥90%) on the test set after multiple training cycles. Save the trained model in the "model" directory of the data storage array for predicting the boiling state of the solution; b) Model Deployment. Store the trained model-related files in a folder named "model" for use during analysis.
[0027] Step 3: Building, training, and deploying the expert model. The expert model locates and extracts the position, morphology, and distribution area of different constituent phases within a specific C0 category organization. Depending on the organization's C1 category, the expert model has two different types: Type 1: When C1=1, an expert model is built based on an adaptive image segmentation method with gray-level distribution. The model structure and analysis process are as follows: Figure 4 As shown, it includes the following sub-steps: Sub-step 1: Convert the input microscopic tissue image to grayscale, adjusting its brightness and contrast to maximize the contrast between light and dark areas. (The image is sized as follows.) The window with The step size is relative to the input image ( Sampling was performed to obtain the sampling results. ,in This represents the total number of samples.
[0028] Substep 2: Perform bilinear interpolation upsampling on each sample in S0 to expand its size to... The grayscale distribution function is obtained by performing grayscale statistics on the upsampled samples. , where g is the grayscale value. For Perform morphological analysis. The steps are as follows: ① Perform peak and valley point detection and calculate the maximum peak value. and the second largest peak ratio ② Morphological analysis. If Then determine It exhibits a unimodal distribution; conversely, it is determined that... It exhibits a bimodal distribution.
[0029] Sub-step 3: For unimodal grayscale distribution, calculate according to the method described in sub-step 4. Segmentation threshold For bimodal grayscale distributions, calculate according to the method described in substep 5. Segmentation threshold .
[0030] Sub-step 4: Calculate the local segmentation threshold using the Otsu's method. Assume there exists a threshold T that divides all pixels in the image into two classes: less than T and greater than T. The means of these two classes are m1 and m2, respectively, and the global mean of the image is mG. The probabilities of a pixel being classified as less than T and greater than T are p1 and p2, respectively. For a given gray level gk, calculate the threshold value of the gray level located at... The proportion of pixels at each gray level gx to the total number of pixels, p(gx): (2) in, The grayscale value is The number of pixels. Then p1 can be written as: (3) m1 and m2 can be written as: (4) The inter-class variance is calculated using equations (3) and (4): (5) It can be seen that the variance between classes is represented by gray levels. The function, for ,beg make Then the segmentation threshold can be determined. .
[0031] Sub-step 5: Calculate the local segmentation threshold using the trigonometric method. The main process is as follows: Figure 4 As shown, the specific steps include: ① Determining the grayscale histogram domain ; ② Calculation The maximum value and its corresponding gray level (Maximum peak point); ③ Detect whether the maximum peak is on the bright side (the side with the larger grayscale value), otherwise flip; ④ Connection point and (Denote this as point B), forming a straight line AB. Calculate the value of each point on the grayscale curve. Distance to line AB ,like Figure 5 As shown; ⑤ Take the gray value corresponding to the point on the grayscale curve that is the largest distance from AB as the segmentation threshold T.
[0032] Sub-step 6: The threshold calculated according to the method described in sub-step 4 or sub-step 5. right Perform binary segmentation to obtain the segmentation result. .
[0033] Sub-step 7: Perform binary segmentation on all samples in S0 according to the methods described in sub-steps 2 to 6 to obtain a binary image set B0. Arrange the samples in B0 sequentially according to the sampling order and position in S0 to form a tissue distribution feature map as the output result.
[0034] Type 2: When C1=2, a semantic segmentation model is built based on a convolutional neural network or Transformer structure as an expert model. The model structure and analysis process are as follows: Figure 6 As shown, it includes the following sub-steps: Sub-step 1: Model building. The main structure is an encoder-decoder structure, such as... Figure 6 As shown in the diagram, the encoder has a structure similar to the feature extraction layer described in substep 1(a) of step two, and the decoder consists of a series of convolution-convolution-upsampling layers. The upsampling layer amplifies the feature map in the H and W dimensions through operations such as transposed convolution and bilinear interpolation, which is the reverse of the downsampling process. By concatenating multiple convolution-convolution-upsampling layers, the H and W dimensions of the feature map are restored to the input size. Through the above structure, the microscopic image of the input model undergoes feature extraction by the encoder and feature restoration by the decoder, achieving pixel-by-pixel classification of the input image and outputting the classification result, i.e., the semantic segmentation feature map.
[0035] Sub-step 2, training dataset setup, specifically includes: a) Sample search. The step two, titled "..." Retrieve samples with C1=2 from the directory and store them in the directory. Under the directory, store them separately according to their C0 category values. The directory is named " In the subdirectory of ""; b) For a certain C0 category, " The catalog is used to sample all samples within it using a sliding window with a certain step size, resulting in a sample of size [size missing]. The training samples, and all sampling results form a sample set. The sample names have the following format; (6) c) For Sample set. Create a category label set with the following name format: (7) Equation (8) indicates that when the C2 category value of a certain component phase is 2, a category label is established for that component phase. All component phase category labels with C2=2 constitute a label set. Definition For the feature value corresponding to each category label, according to equation (9) Assign a value; d) Phase labeling. For Each name is " " (8) For the sample (image number j), the polygonal lasso tool is used to delineate the region containing the constituent phases corresponding to each category label, forming a labeled region. All pixels within the labeled region are then labeled with the category label value. Note that when the sample to be labeled does not contain the constituent phase that needs to be labeled, all pixel values are set to 0 as the labeling result; when the sample to be labeled is entirely composed of the constituent phase that needs to be labeled, all pixel values are set to the corresponding values. Value. The newly generated image after annotation is stored as the annotation map in " The subdirectory is named " Note that the image number should be consistent with the original sample; e) Perform data augmentation, such as flipping, rotating, cropping, and scaling, to augment the data. The training samples and corresponding labeled images in the catalog are transformed to generate augmented samples and corresponding augmented labeled images. The sample size in each sub-catalog after augmentation is no less than 500. f) In " Create subdirectories named "total data", "training", "validation", and "testing" within the directory. Store all original samples / original labeled images and augmented samples / augmented labeled images in the "total data" subdirectory. Select data in a ratio of (7~8):(1~2):(1~2) to form the training set, validation set, and test set, and store them in the "training", "validation", and "testing" subdirectories respectively. Rename the data in the above subdirectories, adding the dataset type to the original name, with the naming format "". "and" "Store the new names in text files named "training", "validation", or "testing" to form a tag document; g) For all C0 categories, " "Execute steps b) to f) in the directory to complete the construction of the training dataset for the type two expert model. The dataset file structure is as follows..." Figure 7 As shown.
[0036] Sub-step 3: Overview of model training and deployment.
[0037] a) Model Training. The model built in Substep 1 is trained using the training and validation sets constructed in Substep 2. The training set provides data for the model to learn features, while the validation set tests the model's prediction accuracy at the end of each training cycle. Training employs an adaptive gradient optimizer with a certain global learning rate. Parameters such as the L2 regularization coefficient and batch size are adjusted based on the training results, ultimately maximizing the average pixel precision on the test set after multiple training cycles. The pixel precision for each category label is defined as: Pixel precision = Number of correctly classified pixels / Total number of pixels; the average pixel precision is the average of the pixel precision for all category labels. b) Model deployment. Store the trained model's related files in a folder named "model" for later use during analysis.
[0038] Step 4: Execute the overall algorithm flow to achieve intelligent qualitative and quantitative analysis of the microstructure of the metallic material to be analyzed, specifically including the following sub-steps: Sub-step 1: Image preprocessing. First, the brightness and contrast of the raw images acquired by the microscope are adjusted to clearly define the main microscopic tissue features and highlight the differences between different phases. Second, image reshaping is performed to resize the image to a fixed size. , obtain the input data .
[0039] Sub-step 2: Intelligent identification of microscopic tissue composition based on the overview model. Input I0 into the overview model described in step 2 to obtain the C0 category prediction value of the image to be analyzed.
[0040] Sub-step 3: Tissue Composition Category Analysis. Input the predicted C0 category value output from sub-step 2 into the microscopic tissue database described in step one, and analyze it according to… "The mapping process yields the C1 category value, P vector, and C2 category value corresponding to the predicted C0 category value. Based on the C1 and C2 category values, the type 1 or type 2 expert model corresponding to the predicted C0 category is invoked according to the method described in step three."
[0041] Sub-step 4: Intelligent phase content extraction based on expert models. Specifically, this includes: ① Converting the microscopic tissue image to be analyzed from the input overview model to grayscale, adjusting its brightness and contrast to maximize the contrast between light and dark phases. (The text then abruptly shifts to a different topic: "With a size of...") The window with The step size is the input image (size is ). Sampling is performed and the location of each sample is recorded to obtain the sampling results. and position index, where ① The total number of samples; ② Input the samples in S0 sequentially into the expert model called in substep 3 to obtain the segmentation map of the constituent phases. ③ According to the position index The segmentation maps in the image are stitched together to obtain a phase composition feature map, which gives the region where each composition phase in the C0 predicted category of substep 2 is located.
[0042] Sub-step 5: Phase content calculation and statistical analysis. Based on the phase composition feature map obtained in sub-step 4, calculate the number of pixels occupied by different composition phases, and then calculate the relative content of each composition phase.
[0043] Sub-step 6: Collect N microscopic tissue images of area S from different locations on the same sample. Predict the tissue C0 category of each image and calculate the relative content of the constituent phases according to the methods described in sub-steps 1 to 5. Perform statistical analysis according to the following steps: ① Let the number of constituent phase categories in the i-th image be... Then the component vectors and relative contents corresponding to all images can be written as: (9) Where i represents the image number. ① Represents the sequence number of the constituent phase resolved in the i-th image; ② Merge identical constituent phases. Merge identical constituent phases in the constituent vector P, count the total number of non-repeating constituent phase categories, denoted as M, and denote the merged constituent vector as . Based on the statistics of different phase compositions, the original phase P and the combined phase compositions were established. mapping relationship ③ Statistical analysis. For a specific merged component... First, calculate the mean of its relative content according to formula (10). (10) in, for according to The corresponding original phase obtained by mapping, for The corresponding original phase number. Similarly, the relative content standard deviation can be written as... (11) Note that in the above calculations, when a certain primary phase is absent in a particular image, its corresponding relative content should be calculated as 0. Subsequently, the coefficient of variation is calculated according to equation (12).
[0044] (12) Finally, the content of each component phase is determined based on the mean, the homogeneity of each component phase is determined based on the standard deviation, and the homogeneity difference between different component phases is determined based on the coefficient of variation.
[0045] Example 2: Analysis of steel for oil pipes.
[0046] Step 1: Establishment of the Microstructure Database. A microstructure database is established for the oil pipe steel to be analyzed, including several types: ferrite + pearlite (F+P), bainite + polygonal ferrite (B+PF), and tempered sorbite (+ ferrite) (S+F). Their C0, C1, C2, and composition vector P are shown in Table 1.
[0047] Table 1. Microscopic Tissue Database (Example)
[0048] Step 2: Building, training, and deploying the overview model. The overview model consists of a convolutional neural network with image classification capabilities. It extracts features and classifies the input microscopic tissue images, determines their constituent types, and outputs predicted type labels. Specifically, it includes the following sub-steps: Sub-step 1: Use an 18-layer residual network ( As an overview model, the main body includes eight "convolution-convolution" structures with residual structures, employing... The convolutional kernels have 64, 128, 256, and 512 channels respectively. The 2nd, 4th, 6th, and 8th convolution-convolution structures are followed by downsampling layers. The feature map size is... After stepwise downsampling, it becomes Then, after global average pooling, it becomes The input is a classifier with one fully connected layer, followed by a softmax output layer with three classes.
[0049] Sub-step 2, Overview of Model Training Set Construction, specifically includes: a) Image Preprocessing. Brightness and contrast are adjusted for all microscopic tissue images in the microscopic tissue database described in step one to ensure clear main microscopic tissue features and significant differences between different phases. The processed images are resized to a fixed size of 224×224 and stored in a computer named "". Under the directory of "; b) Classify and label microscopic tissue images with different C0 values. Establish a category label set, with the following labels: (13) Establish" "The directory and a series of subdirectories are named sequentially according to formula (13) to form a labeled folder. Randomly read..." The images in the directory are stored sequentially in annotation folders named "0", "1", and "2" according to their C0 values. The images in each category annotation folder are then arranged according to their C0 values. After renaming the data in the format "", complete the data annotation; c) Perform data augmentation by transforming the training samples in each subdirectory through flipping, rotating, cropping, and scaling to generate augmented samples. The sample size in each subdirectory after augmentation should be no less than 500; d) Create subdirectories "total data", "training", "validation", and "testing" in the "Training Dataset" directory, and store the original and augmented samples from all the annotation folders in the "total data" subdirectory. Select data in a 7:2:1 ratio to form the training set, validation set, and test set, and store them in the "training", "validation", and "testing" subdirectories respectively. Rename the data in the above subdirectories, adding the dataset type to the original name, with the naming format "". " "and" The new names are stored in text files named "training", "validation", or "testing", forming a tag document.
[0050] Sub-step 3: Overview of Model Training and Deployment. a) Model Training. Train the model built in Sub-step 1 using the training and validation sets constructed in Sub-step 2. Use the Adaptive Gradient Optimizer (AdamW) with a global learning rate of 0.00001. The L2 regularization coefficient is 0, the batch size is 20, and after 200 weeks of training, the model achieves an accuracy of 94% on the test set; b) Model Deployment. Store the trained model-related files in a folder named "model" for later use during analysis.
[0051] Step 3: Building, training, and deploying the expert model. The expert model locates and extracts the position, morphology, and distribution area of different constituent phases within a specific C0 category organization. Depending on the organization's C1 category, there are two types of expert models. Specifically; Type 1: When C1=1, the adaptive image segmentation method based on gray-level distribution builds an expert model, including the following sub-steps: Sub-step 1: Convert the input microscopic tissue image to grayscale, adjusting its brightness and contrast to maximize the contrast between light and dark areas. (The image is sized as follows.) The window increments by 10 steps over the input image (size: Sampling was performed to obtain the sampling results. , where h=484 is the total number of samples.
[0052] Substep 2: Perform bilinear interpolation upsampling on each sample in S0 to expand its size to... The grayscale distribution function is obtained by performing grayscale statistics on the upsampled samples. , where g is the grayscale value. For Perform morphological analysis. The steps are as follows: ① Perform peak and valley point detection and calculate the maximum peak value. and the second largest peak ratio ② Morphological analysis. If Then determine It exhibits a unimodal distribution; conversely, it is determined that... It exhibits a bimodal distribution.
[0053] Sub-step 3: For unimodal grayscale distribution, calculate according to the method described in sub-step 4. The segmentation threshold Ti is calculated. For a bimodal grayscale distribution, the segmentation threshold Isi is calculated according to the method described in substep 5. .
[0054] Sub-step 4: Calculate the local segmentation threshold using the Otsu's method. Assume there exists a threshold T that divides all pixels in the image into two classes: less than T and greater than T. Then the mean values for these two classes are m1 and m2, respectively, and the global mean value is... Meanwhile, the probabilities of a pixel being less than T and greater than T are p1 and p2, respectively. For a given gray level... First, calculate the gray level according to equation (3). Each gray level The proportion of pixels to the total number of pixels Then, p1, m1, and m2 are calculated according to equations (4) and (5), and finally, according to equation (6), Find within the interval make Then the segmentation threshold can be determined. .
[0055] Sub-step 5: Calculate the local segmentation threshold using the triangular method. This includes the following steps: ① Determine the grayscale histogram. domain ; ② Calculation The maximum value and its corresponding gray level (Maximum peak point); ③ Detect whether the maximum peak is on the bright side (the side with the larger grayscale value), otherwise flip; ④ Connection point (denoted as point A) and point (Denote this as point B), forming a straight line AB. Calculate the value of each point on the grayscale curve. Distance to line AB ⑤ Take the gray value corresponding to the point on the grayscale curve that is the largest distance from AB as the segmentation threshold T.
[0056] Sub-step 6: The threshold calculated according to the method described in sub-step 4 or sub-step 5. right Perform binary segmentation to obtain the segmentation result. .
[0057] Sub-step 7: Perform binary segmentation on all samples in S0 according to the methods described in sub-steps 2 to 6 to obtain a binary image set. The samples in B0 are arranged sequentially according to the sampling order and position in S0 to form a tissue distribution feature map, which is used as the output result.
[0058] Type 2: When C1=2, a semantic segmentation model is built based on a convolutional neural network as an expert model, including the following sub-steps: Sub-step 1: Model Building. A U-net with an encoder-decoder structure is built as a type 2 expert model. Its encoder consists of 4 "..." "Structural composition: the decoder consists of 4..." "Structural composition, input and output dimensions are..." Each encoder and decoder module is short-circuited, and the network is U-shaped.
[0059] Sub-step 2, training dataset construction, specifically includes: a) sample search. In step two, the dataset is named "..." Retrieve samples with C1=2 from the directory "". Based on the table, determine that tissues with C0=1 and C0=2 have the characteristic of C1=2, and store the samples of these two types of tissues in "". Under the directory, store them separately according to their C0 category values. The directory is named " "and" a) in the subdirectory of ""; b) for " "and" The catalog is used to sample all samples within it using a sliding window with a step size of 32, resulting in a size of [missing information]. The training samples, and all sampling results form a sample set. and The names of the samples are as follows;
[0060] c) Create a category label set with the following name:
[0061] A tag set is formed for all constituent category tags where C2=2. (Definition) For each category label, the feature value is... The assignment is as follows:
[0062] d) Phase labeling. For each phase... and Each of the names is " "or" For samples with a value of "", the polygonal lasso tool is used to delineate the regions containing the PF (for tissues with C0=1, B+PF) or F phase (for tissues with C0=2, S+F), forming a labeled area. All pixels within the labeled area are then labeled with the corresponding category label. The value is 1. Note that when the sample to be labeled does not contain PF or F phases, all pixel values are set to 0 as the labeling result; when the sample to be labeled consists entirely of PF or F phases, all pixel values are set to the corresponding values. A value of 1. The newly generated image after annotation will be stored as the annotated image in "". "or" The subdirectory is named " "or" Note that the image number should match the original sample; e) Perform data augmentation by flipping, rotating, cropping, and scaling the image. The training samples and corresponding labeled images in the directory are transformed to generate augmented samples and corresponding augmented labeled images. The sample size of each subdirectory after augmentation is no less than 500; f) In the " "and" Create separate directories This subdirectory stores all original samples / original labeled images and enhanced samples / enhanced labeled images. In the subdirectory, select data in a 7:2:1 ratio to form the training set, validation set, and test set, and store them separately. In the subdirectory. Rename the data in the above subdirectory, adding the dataset type to the original name, with the naming format "". "and" Store the new name in a space named In a text file, a tag document is formed.
[0063] Sub-step 3: Overview of model training and deployment. a) Model training. Utilizing the "..." built in sub-step 2 "and" "The training and validation sets are used to train the model established in substep 1. Training is performed using an adaptive gradient optimizer with a certain global learning rate. The L2 regularization coefficient is set to 0, and the batch size is..." The initial value was 20, and after 200 weeks of training, its average pixel accuracy on the test set reached 88%; b) Model deployment. The trained PF (B+PF) expert model and F (S+F) expert model related files were stored in a file named The folder is used for analysis.
[0064] Step 4: Execute the overall algorithm flow to achieve intelligent qualitative and quantitative analysis of the microstructure of the metallic material to be analyzed, specifically including the following sub-steps: Sub-step 1: Image preprocessing. First, the brightness and contrast of the original images acquired by the microscope are adjusted to make the main microscopic tissue features clear and the feature differences between different phases significant. Second, image reshaping is performed to resize the image to a fixed size of 224×224, resulting in the input data I0, I1, and I2.
[0065] Sub-step 2: Intelligent recognition of microscopic tissue composition based on the overview model. Inputting I0, I1, and I2 into the overview model described in step 2 yields the predicted C0 category values for the image to be analyzed. .
[0066] Sub-step 3: Tissue Composition Category Analysis. Input the predicted C0 category value output from sub-step 2 into the microscopic tissue database, and analyze it according to… "The C1 category value, P vector, and C2 category value corresponding to the predicted value of category C0 are shown in Table 2. For I0, the type 1 expert model is called to perform binary segmentation of the constituent phases F and P; for I1 and I2, the type 2 expert model PF (B+PF) trained in step 3 is called to perform semantic segmentation of the PF phase."
[0067] Table 2. Microscopic Tissue Database (Example)
[0068] Sub-step 4: Intelligent extraction of phase content based on expert models. Reorganize it into Size, sampled according to the method described in step three / type one / sub-step 1, to obtain The samples. For all samples, upsample to the method described in step three / type one / sub-step 2 respectively. The gray distribution function is then statistically analyzed and the f-factor is calculated.
[0069] Based on shape determination rules, the grayscale distribution shape of each sample is determined to be "bimodal", "bimodal", "bimodal", "unimodal", "unimodal", etc. For samples with a bimodal grayscale distribution, the Otsu's method is used to calculate the segmentation threshold. This threshold is then used to binarize and segment the original samples before upsampling, resulting in a segmentation image. For samples with a unimodal gray-level distribution, a segmentation threshold is calculated using the triangular segmentation method. This threshold is then used to binarize the original samples before upsampling, resulting in a segmentation map. After segmenting the 484 samples, the segmentation maps were combined according to their sampling positions to obtain the phase composition feature map of I0.
[0070] Sub-step 5: Intelligent extraction of phase content based on expert models. or Resize them to Then, grayscale processing is performed, and its brightness and contrast are adjusted to make the contrast between bright and dark areas as significant as possible. (The size is...) The window samples the image with a step size of 64 and records the position of each sample to obtain the sampling result. and and its position index; input the samples in S1 and S2 sequentially. Type II expert model, obtaining the segmentation diagram of the constituent phase PF. and ; according to position index respectively and The segmented images in the image are stitched together to obtain the phase composition feature map.
[0071] Sub-step 6: Phase content calculation and statistical analysis. Based on the phase composition characteristic diagrams obtained in sub-steps 4 and 5, calculate F and P respectively. The number of pixels occupied by PF in I1 and I2, and then the relative content of each component phase is calculated. .
[0072] Sub-step 6: Collect the area of 5 other locations on the I0 sample. The microscopic tissue images were analyzed, and the tissue C0 category of each image was predicted and the relative content of the constituent phases was calculated according to the methods described in substeps 1 to 6, as shown in Table 3. Statistical analysis was performed according to the following steps: ① The component vectors and relative contents corresponding to all images are shown in Table 4; ② Identical constituent phases were merged. Identical constituent phases in the component vector P were merged, and the total number of non-repeating constituent phase categories M=2. The merged component vector was denoted as... Based on the statistics of different constituent phases, a mapping relationship is established between the original constituent phase P and the merged constituent phase P'.
[0073] Table 3. C0 category prediction values and relative content of components in 5 images of sample I0.
[0074] Table 4. Component vectors, relative contents, and normalized contents of five images of sample I0.
[0075] ③ Statistical analysis. For the merged components... First, calculate the mean of its relative content.
[0076] Similarly, the relative content standard deviation can be written as
[0077]
[0078] Subsequently, the coefficient of variation is calculated according to equation (14).
[0079]
[0080] Finally, it can be concluded that... The microstructure of the sample was F+P, with the F phase having an average relative content of 0.43, a standard deviation of 0.051, high homogeneity, and a coefficient of variation of 11.9%; the P phase having an average relative content of 0.57, a standard deviation of 0.051, high homogeneity, and a coefficient of variation of 8.9%; the F phase exhibited greater variability than the P phase.
[0081] It should be noted that the terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Although the present invention 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; and these 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 the present invention.
Claims
1. A method for quantitative analysis of the phase content in the microstructure of metallic materials, characterized in that, include: Establishment of a microscopic tissue database; An overview of model building, training, and deployment; The construction, training, and deployment of expert models; Qualitative and quantitative analysis of the microstructure of metallic materials was performed based on overview models and expert models. The steps of the intelligent qualitative and quantitative analysis method for the microstructure of metallic materials are as follows: Intelligent identification of microscopic tissue composition based on overview model: The preprocessed image is input into the overview model to obtain the C0 category prediction value of the image to be analyzed; Tissue composition category analysis: Input the output C0 category prediction value into the microscopic tissue database to obtain the C1 category value, P vector and C2 category value corresponding to the C0 category prediction value; When C1=1, the first expert model is invoked; when C1=2, the second expert model is invoked. Intelligent extraction of phase content based on the first or second expert model: The microscopic tissue image to be analyzed is converted to grayscale by inputting the overview model; The input image is sampled using a step-size window, and the position of each sample is recorded to obtain the sampling result and the position index; The sampling results are sequentially input into the first or second expert model to obtain the segmentation map of the constituent phases; The segmented images are stitched together according to the position index to obtain a phase composition feature map; Phase content calculation and statistical analysis: Based on the obtained phase composition feature map, calculate the number of pixels occupied by different composition phases, and then calculate the relative content of each composition phase; The content of each component phase is determined by the mean, the homogeneity of each component phase is determined by the standard deviation, and the homogeneity difference between different component phases is obtained by the coefficient of variation. C0 represents the major category of microstructure in metallography, defined by the microstructure morphology, phase composition, relative quantity, size and distribution of metallic materials, i.e. microstructure type. C1 represents the category information defined based on the contrast between different phases in a microscopic image, i.e., the tissue image type; C2 represents the microstructure determined by category C0, and the corresponding category is defined according to the distribution characteristics of each constituent phase, i.e., the tissue distribution type; C1=1 indicates that there is a significant contrast between light and dark phases in the microstructure, and that there are clear boundaries between the phases. C1=2 indicates that the brightness and grayscale characteristics of the constituent phases of the microstructure are similar, there is no significant contrast between light and dark, and there are relatively significant boundaries between the constituent phases.
2. The method for quantitative analysis of phase content in the microstructure of metallic materials according to claim 1, characterized in that, The C2 value is 0, 1, or 2. For microstructures where C1=1, the distribution type of all constituent phases is C2=0; C2=1 indicates that this phase is the dominant phase, has no obvious boundary, and is diffusely distributed throughout the entire image field of view; C2=2 indicates that this phase is a minor phase, which is dispersed among the major phases and has relatively obvious phase boundaries. The distribution area has closed graphical characteristics.
3. The method for quantitative analysis of phase content in the microstructure of metallic materials according to any one of claims 1-2, characterized in that, The overview model includes a convolutional neural network or Transformer structure with image classification function, which extracts and classifies the features of the input microscopic tissue image to determine its composition type C0.
4. The method for quantitative analysis of phase content in the microstructure of metallic materials according to claim 3, characterized in that, The expert model locates and extracts the location, morphology, and distribution area of different constituent phases in a specific C0 category tissue. Depending on the tissue C1 category, the expert model has two types. When C1=1, the first expert model is built based on the adaptive image segmentation method of gray-scale distribution. When C1=2, a semantic segmentation model is built based on a convolutional neural network or Transformer structure. This is the second expert model.
5. The method for quantitative analysis of phase content in the microstructure of metallic materials according to claim 4, characterized in that, The steps to build the first expert model are as follows: The input microscopic tissue image is converted to grayscale, and its brightness and contrast are adjusted to make the contrast between light and dark phases significant; with a size of The window samples the input image with a step size of WS to obtain the sampling result, where This represents the total number of samples. Upsample each sample in the sampling results to increase its size. The grayscale distribution function is obtained by performing grayscale statistics on the upsampled samples. , where g is the grayscale value; The steps to build the second expert model are as follows: Sample search: Retrieve samples with C1=2 from the directory containing the original data and store them in the directory. They are stored according to their C0 category values in the first directory named " In the subdirectory of ""; For a certain C0 category The catalog is used to sample all samples within it using a sliding window with a certain step size, resulting in a sample of size [size missing]. The training samples, and all sampling results form a sample set. The sample names have the following format: right Sample set: Create a set of category labels, whose names have the following format: The above formula indicates that when the C2 category value of a certain component phase is 2, a category label is established for that component phase; all The components of a tag set are category tags; definition For each category label, the feature value is calculated according to the following formula. Assign a value; Phase labeling: for Each name is " ": The newly generated image after annotation is stored as the annotation map in " "In the subdirectory, its name is" The image number is consistent with the original sample.
6. A system for quantitative analysis of the microstructure phase content of metallic materials according to any one of claims 1-5, characterized in that, include: Microstructure data module: used to identify the type of microstructure in an image; Overview model module: used for qualitative analysis of microstructures; Expert model module: Used for quantitative analysis of microstructures.