Alloy microstructure classification method based on PyTorch framework
By constructing an alloy microstructure classification method on the PyTorch framework, combining image enhancement and noise reduction technology, combining morphology and microfeature data, and using contrast index for screening and judgment, the problem of insufficient identification accuracy and reliability in the existing technology is solved. , achieving high accuracy and robustness recognition results.
Patent Information
- Application Number
- CN202410673036.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-30
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology lacks the ability to distinguish different categories in detail in the identification of alloy microstructures. The generalization ability and robustness of the model are insufficient, and it fails to effectively combine microscopic features and macroscopic morphological features, resulting in limited recognition accuracy and reliability.
Based on the PyTorch framework, the alloy microstructure classification method improves image quality through image enhancement and noise reduction technology, designs a convolutional neural network model, uses backpropagation algorithm training, and combines morphological characteristics and microscopic feature data to build a selection adjustment model. Use the comparison index to make preliminary and secondary judgments, and dynamically adjust the model to improve matching accuracy.
It achieves high accuracy and robustness of alloy microstructure identification, automated and efficient identification process, with good scalability and flexibility. Through the introduction of contrast index and model adjustment, the overall performance of the identification system is improved. and application scope.
Smart Images

Figure CN118570798A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, and in particular to an alloy microstructure classification method based on a PyTorch framework. Background Art
[0002] In the field of materials science, the identification of alloy microstructure is a crucial link because it is directly related to the performance and application of the material. This process relies on manual microscope observation and expert analysis, which is not only time-consuming and labor-intensive, but also easily affected by subjective judgment. With the development of artificial intelligence technology, especially the widespread application of deep learning, the automatic identification of alloy microstructure has become possible. As an open source machine learning framework, Pytorch provides powerful tool support including but not limited to image processing, model training and deployment. It has been widely used in various image recognition tasks, especially in convolutional neural networks (CNN). Pytorch has been widely used in the field of materials science image processing with its flexibility and efficiency.
[0003] In the prior art, publication number CN114332859A discloses an alloy microstructure recognition model construction and recognition method, device, computer equipment and storage medium, the method comprising: obtaining alloy microstructure images of different stresses and heat treatment states, and inputting the obtained γ, phase microstructure image set into a preset convolutional neural network model for training through image segmentation to obtain a convolutional neural network model of the alloy microstructure image; when performing application recognition, inputting the obtained γ, phase microstructure image set to be tested into the convolutional neural network model of the alloy microstructure image to obtain the stress and heat treatment state linear classification results corresponding to the alloy microstructure image to be tested; the method can improve the efficiency of alloy microstructure recognition;
[0004] The shortcomings are as follows: most existing technologies lack the ability to distinguish the microstructures of different types of alloys at the microscopic level, which is mainly due to the complexity of alloy structures and the diversity of microscopic image quality. Secondly, many methods do not make full use of image enhancement and noise reduction techniques when processing microscopic images, resulting in insufficient generalization and robustness of the model. In addition, the traditional model training and classification process fails to effectively combine the microscopic characteristics of the alloy with the macroscopic morphological characteristics, which limits the recognition accuracy and reliability.
[0005] How to improve the accuracy and efficiency of classification by building a more sophisticated classification model; how to further accurately screen on the basis of providing preliminary judgments through the introduction of contrast index and the establishment of selection and adjustment models, so as to achieve more accurate classification of alloy microstructures; how to dynamically adjust the selection and adjustment model so that the model can be optimized for different alloy microstructure characteristics, thereby improving matching accuracy is a technical problem that needs to be solved at present;
[0006] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0007] The purpose of the present invention is to provide an alloy microstructure classification method based on the PyTorch framework to solve the problems raised in the above background technology.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] The alloy microstructure classification method based on the PyTorch framework comprises the following specific steps: step S1, collecting alloy microstructure images of different categories, annotating them, and classifying them into different data sets to form {1,2,...,i,...,n}, wherein i represents the alloy microstructure image of the i-th category, and n represents the total number of alloy microstructure image categories, and image enhancement and noise reduction techniques are used to improve image quality;
[0010] Step S2: Design a convolutional neural network model according to the characteristics of the data set, including the number, size, and number of channels of the components of the convolutional layer, pooling layer, and fully connected layer; and use the back propagation algorithm to train the model;
[0011] Step S3, obtaining a new alloy microstructure image as a model input, and preprocessing the input alloy microstructure image to generate a preprocessing result; obtaining different annotated data sets, and dividing them into a training set, a validation set, and a test set in turn;
[0012] Step S4, obtaining the preprocessing result, and inputting the preprocessing result into the trained convolutional neural network model for classification and recognition, generating a classification and recognition output result, the output result including outputting the probability value of each category, and taking the category with the largest probability value as the classification result of the image;
[0013] Step S5, collecting the morphological feature data of the current i-th new alloy microstructure image and the microscopic feature data of the alloy microstructure, and determining the standard data set of each category of alloy microstructure based on the alloy microstructure images of different categories;
[0014] Step S6, obtaining each category probability value included in the output result in step S4, and obtaining the morphological feature data in step S5, and performing analysis and processing to generate a first comparison index, dividing the index value range into a number of intervals and performing comparison and analysis with the standard data set to generate a first matching result, which is used to preliminarily determine the category that best matches the current alloy microstructure among the several category probability values included in the output result;
[0015] Step S7, obtaining each category probability value included in the output result in step S4, receiving the microscopic feature data in step S5, and performing analysis and processing to generate a second comparison index, dividing the index value range into several intervals and performing comparison and analysis with the standard data set to generate a second matching result, which is used to secondarily determine the category that best matches the current alloy microstructure among the several category probability values included in the output result;
[0016] Step S8, after obtaining the first comparison index and the second comparison index, perform analysis and processing to construct a selection adjustment model, which is used to perform final screening and judgment on the alloy microstructure category judged in the first matching result and the second matching result.
[0017] Further, the first contrast index is defined as C1, and the calculation formula is as follows:
[0018]
[0019] Among them, the function f(X i ) is given by the following expression:
[0020]
[0021] Where Pi represents the probability value of the i-th category alloy microstructure image in the model prediction;
[0022] Xi is the comprehensive morphological feature value corresponding to the i-th category, which is the result of weighted average of various morphological indicators LDs, JTx, JJz, and XFb. i is the weight of the i-th category;
[0023] σ i is a normalization factor that adjusts the influence of the i-th category in the calculation to prevent the value from being too large or too small;
[0024] α i ,β i ,γ i ,δ i ,ò i is the adjustment parameter specific to the i-th category, determined by empirical data;
[0025] The value range of formula C1 is set to (0,1), where a value closer to 1 indicates a higher matching degree, and a value closer to 0 indicates a lower matching degree;
[0026] The first matching result includes the following value ranges:
[0027] Very low matching interval (0.00, 0.25), C1 value lower than 0.25 indicates that the matching degree between the probability value of the current category and the morphological feature data is very low, and the matching degree is below 25%, which is due to misclassification or data anomaly;
[0028] The judgment rule is that when C1<0.10, the data is considered to be almost irrelevant and it is recommended to exclude this category; if C1 is between 0.10 and 0.25, it is recommended to review the data or increase sample data for retraining;
[0029] Low match interval [0.25, 0.50), C1 values in this interval indicate low category match, with a match between 25% and 50%, indicating that the model has not fully learned the features;
[0030] The judgment rule is that when C1 reaches 0.40 or above, consider adjusting the model parameters or feature weights to try to improve the matching degree. Specifically, adjust the model parameters or feature weights to improve the matching degree of the model by at least 20%;
[0031] Medium matching interval [0.50, 0.75), C1 value in this interval indicates that there is a certain degree of matching, between 50% and 75%, but further optimization is needed;
[0032] The judgment rule is that if C1 is close to 0.75, it is recommended to make slight model adjustments or data weighting for specific categories;
[0033] High matching interval [0.75, 1.00), C1 value higher than 0.75 indicates high matching, the matching degree is above 75%, and the current category is well matched with the alloy microstructure image;
[0034] The judgment rule is that when C1>0.90, the match is considered to be very successful and the output result of this category is directly adopted.
[0035] Further, the second contrast index is defined as C2, and the calculation formula is as follows:
[0036]
[0037] Wherein, WZMd, NMd, HXj, WGd represent the indexes of dislocation density, nanoscale phase boundary, chemical composition uniformity and microhardness respectively; pi is the predicted probability of the i-th category; k is an adjustment factor used to adjust the exponential weight of the probability value pi, affecting the sensitivity of the overall index; b1, b2, b3, b4 are non-negative weight coefficients used to balance the influence of each microscopic feature in the total contrast index, and b1+b2+b3+b4=1;
[0038] The value range of formula C2 is set in the interval (0,1). The closer the C2 value is to 1, the higher the matching degree between the current category and the alloy microstructure is, which is used for more accurate classification decisions;
[0039] The second matching result includes the following intervals:
[0040] The C2 value of (0, 0.25) is a low matching interval, which means that the alloy microstructure image has a low matching degree with the current classification model. The matching degree is within 20%, and it is recommended to re-extract features or increase the amount of data training. It is also considered that the credibility of the classification result is less than 25%, and additional verification or data is needed;
[0041] The C2 value of [0.25, 0.5) is a medium match interval, which means that there is a 20% to 45% match, but it is still not enough to make a final judgment, and further feature analysis or model adjustment is required; and the credibility of the classification result is considered to be between 25% and 50%, and it is recommended to re-analyze local features;
[0042] The C2 value is in the range of [0.5, 0.75) which is a high matching interval. This range indicates that the alloy microstructure image has a high matching degree with the model, with a matching degree of 45% to 75%, and can be considered as a candidate classification result; and the credibility of the classification result is considered to be between 50% and 75%;
[0043] The C2 value in the interval [0.75,1] is a high matching interval, which means that the alloy microstructure image matches the current model very well, with a matching degree of more than 75%. It is believed that the credibility of the classification result is higher than 75%, and this classification is regarded as the final result.
[0044] Furthermore, the selection adjustment model is defined as S, and the calculation formula is as follows:
[0045]
[0046] Where n represents the total number of alloy microstructure image categories; τ i is the first index adjustment coefficient of the corresponding category, which is used to adjust the weight of the first comparison index C1 in the total score. i When , the influence of the first contrast index of the corresponding category on the total score increases;
[0047] ρ i is the second index adjustment coefficient of the corresponding category, which is used to adjust the weight of the second comparison index C2 in the total score. i When , the influence of the second contrast index of the corresponding category on the total score increases;
[0048] τ i The dynamic adjustment expression is as follows:
[0049]
[0050] Among them, TDc j1 is the weight used for a specific parameter j1, n1 is the total number of specific parameters, ρ i Dynamic adjustment expression:
[0051]
[0052] Among them, TDYx j2 It refers to the influence measure of the specific feature j2, n2 is the total number of specific features, di is the power coefficient of the second index of the corresponding category, which is used to adjust the nonlinear influence of the second contrast index C2. Increasing di will make the influence of C2 of the corresponding category in the score more sensitive;
[0053] Set the value range of S to (0,10). The closer the value is to 0, the lower the matching score is, and the closer the value is to 10, the higher the matching score is. Divide the value range of S (0,10) into the following intervals, and perform matching result screening and judgment;
[0054] Very low matching interval (0,3), S value in this interval indicates that the matching degree of the model is very low, and the adaptability of the alloy microstructure image and the model is poor; if S<1.5, the matching degree is less than 15%, and it is necessary to make large-scale adjustments to the model parameters and data processing with the highest matching degree between the first matching result and the second matching result; if 1.5≤S<3, the matching degree is between 15% and 30%, the second matching result is selected, and the C2 value is increased by 0.15, the interval to which the adjusted second matching result belongs is determined, and detailed feature reanalysis and model fine-tuning are performed on the corresponding matching results;
[0055] Medium matching interval [3,7), S value in this interval indicates that the model has a medium matching degree, and some significant features are identified but there is still room for improvement; if 3≤S<5, the matching degree is between 30% and 50%. At this time, it is recommended to select the category with the highest matching degree between the first matching result and the second matching result for local parameter adjustment and data weighting; if 5≤S<7, the matching degree is between 50% and 70%, select the category in the second matching result, and increase the C2 value by 0.1, determine the interval to which the adjusted second matching result belongs, and make slight model adjustments to the corresponding matching results or increase the number of training samples;
[0056] High matching interval [7,10], S value in this interval indicates that the model has a high matching degree, the matching result is very reliable and suitable for practical applications; if 7≤S<8.5, the matching degree is between 70% and 85%, which is considered a high matching, and either the first matching result or the second matching result is selected, and a small amount of adjustment is required to optimize the result; if 8.5≤S<10, the matching degree exceeds 85%, the second matching result is selected, and the C2 value is increased by 0.5, the interval to which the adjusted second matching result belongs is determined, and the corresponding matching result is directly used for actual category judgment and output.
[0057] Compared with the prior art, the present invention has the following beneficial effects: the alloy microstructure identification method based on the PyTorch framework proposed in the present invention has the following advantages:
[0058] 1. High accuracy and robustness: Using deep learning models and real alloy microscopic image data for training and verification, it can achieve high accuracy and robust identification of alloy microstructures;
[0059] 2. Automation and high efficiency: The automated and efficient recognition process can realize the rapid recognition and analysis of large-scale alloy microscopic image data, improve work efficiency and reduce labor costs;
[0060] 3. Scalability and flexibility: Deep learning models are built based on the PyTorch framework, which has good scalability and flexibility, and can optimize models and expand functions according to actual needs;
[0061] 4. Integration and visualization: Ability to integrate with other tools and technologies, such as computer vision algorithms and high-performance computing systems, to achieve deeper analysis and interpretation, and to display analysis results through a visual interface;
[0062] 5. By using image enhancement and noise reduction technology to improve the quality of input images, combining the dual analysis of morphological features and microscopic features, and building a more sophisticated classification model to improve the accuracy and efficiency of classification, the introduction of contrast index and the establishment of a selection adjustment model can further accurately screen on the basis of providing preliminary judgments, thereby achieving more accurate alloy microstructure classification, effectively improving the overall performance and application scope of the recognition system; by dynamically adjusting τ i ,ρ i , the model can be optimized for different alloy microstructure characteristics, thereby improving the matching accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a schematic diagram of the overall method flow of the present invention;
[0064] Figure 2It is a schematic diagram of the convolutional neural network process of the present invention. DETAILED DESCRIPTION
[0065] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.
[0066] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0067] Embodiment 1:
[0068] See also Figure 1 and Figure 2 , the present invention provides a technical solution:
[0069] A method for identifying alloy microstructure based on a Pytorch framework, characterized in that the specific steps include:
[0070] Step S1, collecting alloy microstructure images of different categories, annotating them, and classifying them into different data sets to form {1, 2, ..., i, ..., n}, where i represents the i-th category of alloy microstructure images, and n represents the total number of alloy microstructure image categories, and using image enhancement and noise reduction techniques to improve image quality;
[0071] Step S2: Design a convolutional neural network model according to the characteristics of the data set, including the number, size, and number of channels of the components of the convolutional layer, pooling layer, and fully connected layer; and use the back propagation algorithm to train the model;
[0072] Step S3, obtaining a new alloy microstructure image as a model input, and preprocessing the input alloy microstructure image to generate a preprocessing result; obtaining different annotated data sets, and dividing them into a training set, a validation set, and a test set in turn;
[0073] Step S4, obtaining the preprocessing result, and inputting the preprocessing result into the trained convolutional neural network model for classification and recognition, generating a classification and recognition output result, the output result including outputting the probability value of each category, and taking the category with the largest probability value as the classification result of the image;
[0074] Step S5, collecting the morphological feature data of the current i-th new alloy microstructure image and the microscopic feature data of the alloy microstructure, and determining the standard data set of each category of alloy microstructure based on the alloy microstructure images of different categories;
[0075] Step S6, obtaining each category probability value included in the output result in step S4, and obtaining the morphological feature data in step S5, and performing analysis and processing to generate a first comparison index, dividing the index value range into a number of intervals and performing comparison and analysis with the standard data set to generate a first matching result, which is used to preliminarily determine the category that best matches the current alloy microstructure among the several category probability values included in the output result;
[0076] Step S7, obtaining each category probability value included in the output result in step S4, receiving the microscopic feature data in step S5, and performing analysis and processing to generate a second comparison index, dividing the index value range into several intervals and performing comparison and analysis with the standard data set to generate a second matching result, which is used to secondarily determine the category that best matches the current alloy microstructure among the several category probability values included in the output result;
[0077] Step S8, after obtaining the first comparison index and the second comparison index, perform analysis and processing to construct a selection adjustment model, which is used to perform final screening and judgment on the alloy microstructure category judged in the first matching result and the second matching result.
[0078] Embodiment 2:
[0079] Further explanation based on the first embodiment, the convolutional neural network model adopts a pre-trained ResNet18 model and fine-tunes it;
[0080] The preprocessing of the input alloy microstructure image specifically includes cutting and scaling the input alloy microstructure image, wherein the scaling step adopts a bilinear interpolation method; the cutting and scaling specific steps include:
[0081] Image loading,First, load the original alloy microstructure image, and use PyTorch’s image loading library to complete this step;
[0082] Image cropping, cropping the original image to remove unnecessary edges or background information and focus on the alloy microstructure. Cropping includes the following steps:
[0083] Determine the cutting area, according to the task requirements, determine the appropriate cutting area, and determine it according to the location and size of the alloy microstructure;
[0084] Perform cropping, using image processing libraries such as OpenCV or torchvision.transforms to perform cropping operations on the image and extract the region of interest from the original image;
[0085] Image scaling, in order to make the image have a consistent size and resolution, it is scaled. Scaling is done by the following steps:
[0086] Determine the target size. Determine the required target size based on the model input requirements or task requirements.
[0087] Bilinear interpolation, using bilinear interpolation to scale the image to maintain image quality and details. Bilinear interpolation is a commonly used interpolation method that uses known pixel values in the image to calculate new pixel values to achieve image scaling. In PyTorch, use the Resize function in torchvision.transforms and specify the interpolation method as BILINEAR for scaling;
[0088] Convert images to tensors. In PyTorch, neural network models usually accept tensors as input. Therefore, after preprocessing, images need to be converted to PyTorch tensors.
[0089] Data standardization: standardize the image so that the pixel value range of the image is between 0 and 1 or standardized to a mean of 0 and a variance of 1;
[0090] The data set is divided into training set, validation set and test set. The training set is used to train the convolutional neural network model, using the cross entropy loss function and the Adam optimizer for optimization. During training, random flipping and random cropping of data augmentation techniques are used to expand the training data set and reduce overfitting of the model.
[0091] The validation set is used to determine the hyperparameters of the model and prevent overfitting;
[0092] The test set is used to test the recognition accuracy and generalization ability of the model, and the accuracy, precision, recall rate, and F1 score of the model are calculated to evaluate the performance of the model. The accuracy of the model is calculated to be 90%, that is, 90% of the test images are correctly classified. Based on the above training and testing, a network classifier model is obtained, and the alloy microstructure is recognized and classified through the network model.
[0093] The image enhancement technology adopts a histogram equalization method, and the specific steps include:
[0094] Histogram Analysis,First, a histogram analysis is performed on the input alloy microstructure,image to understand the brightness distribution of the image;
[0095] Cumulative distribution function calculation, calculate the cumulative distribution function CDF of the image, and map the grayscale of the original image to the new grayscale to achieve uniform distribution;
[0096] Grayscale mapping, using the cumulative distribution function to perform grayscale mapping on each pixel in the original image, replacing the original pixel value with the corresponding equalized pixel value;
[0097] Output image generation, generating an equalized image in which the brightness distribution of pixels is more uniform, improving the contrast and visual effect of the image;
[0098] The noise reduction technology uses a combination of a Gaussian filter and a median filter, specifically including:
[0099] Sequentially applied, first, the original image is smoothed by applying a Gaussian filter;
[0100] Then, the image processed by the Gaussian filter is further denoised by applying a median filter;
[0101] It is necessary to select appropriate Gaussian filter and median filter parameters, such as kernel size, standard deviation, and window size, according to specific application requirements and image characteristics;
[0102] In PyTorch, use the functions in the torchvision.transforms.functional module provided by TorchVision to implement filter combinations, or write your own filter functions directly;
[0103] The back propagation algorithm uses the gradient descent method, sets the learning rate to 0.0001, and uses BatchNormalization technology to accelerate the deep neural network training process to improve model performance and stability;
[0104] The steps of the gradient descent method are as follows:
[0105] Initialization parameters,First, you need to initialize the parameters of the model, using random initialization or pre-trained parameters.
[0106] Forward propagation, input the training data into the model, and calculate the output of the model through forward propagation. In deep neural networks, forward propagation includes a series of linear transformations and nonlinear activation operations on the input data until the final prediction result is obtained;
[0107] Calculate the loss function, using the model's output and the true label to calculate the loss function. The loss function can be mean square error (MSE) or cross entropy loss, which is used to measure the difference between the model's prediction result and the true label.
[0108] Back propagation, which calculates the gradient of the loss function to the model parameters through back propagation. Back propagation propagates the gradient of the loss function back to each layer of the network through the chain rule, thereby calculating the gradient of each layer's parameters;
[0109] Parameter update, using the calculated gradient and the set learning rate, updates the model parameters. The gradient descent algorithm adjusts the parameters according to the direction and size of the gradient so that the loss function gradually decreases. The parameter update is completed using the following formula:
[0110]
[0111] Among them, θ old is the old parameter value, θ new is the updated parameter value, is the gradient of the loss function with respect to the parameters, and learningrate is the learning rate;
[0112] Repeat the iteration, and repeat the forward propagation step to the parameter update step until the stopping condition is reached, such as reaching the maximum number of iterations or the loss function converges to a preset threshold;
[0113] The gradient descent method optimizes the model gradually by continuously iteratively updating the model parameters, thereby improving the model performance and stability;
[0114] The classification and recognition output result also includes a category label of the alloy microstructure based on {1, 2, ..., i, ..., n};
[0115] Build a web-based application where users can upload microscopic images and get tissue type prediction results. Here, use the Python web framework of Django or Flask to implement the API service.
[0116] Embodiment three:
[0117] Further explained on the basis of Example 2, the morphological characteristic data includes a particle size index, a crystal morphology index, a grain boundary characteristic index, and a phase distribution and morphology index, and the particle size index is recorded as LDs, the crystal morphology index is recorded as JTx, the grain boundary characteristic index is recorded as JJz, and the phase distribution and morphology index is recorded as XFb;
[0118] The grain size index LDs is expressed as the average size of the particles in the alloy structure, expressed in diameter or circumference. Suppose there are N particles in the alloy, and the diameter of the mth particle is D m , then the average particle size is expressed as the arithmetic mean:
[0119]
[0120] The crystal morphology index JTx describes the morphological characteristics of the crystal and is used to distinguish different crystal structures. Assuming that there are M crystal morphologies in the alloy microstructure, the number of the jth morphology is C j , C k Represents the number of the kth crystal form, the value range of k is 1 to M, and the crystal form index is expressed as the proportion of various forms:
[0121]
[0122] The grain boundary characteristic index JJz describes the characteristics of the crystal grain boundary, including the clarity and spacing of the grain boundary. Assume that for a microstructure image, P grain boundary features are obtained, where the uth feature is represented by W u , then the grain boundary characteristic index is expressed as the average value of these characteristics:
[0123]
[0124] Phase distribution and morphology index XFb describes the distribution of different alloy phases in the microscopic image and is used to analyze the morphological characteristics of each phase. Assuming that there are Q phases in the microscopic image, the area proportion of the rth phase is A r , then the distribution and morphological index of the phase can be expressed as the weighted average of the area proportion of each phase:
[0125]
[0126] Among them, F r It represents the morphological characteristic coefficient of the rth phase, which is set according to the morphological characteristics of the phase, such as color distribution and shape;
[0127] When determining the morphological characteristic coefficient F r Consider the following ways to quantify:
[0128] For color distribution, assume that the color is represented by grayscale values in the image, and the grayscale value range is 0 to 255. Let the average grayscale value of the nth phase in the alloy microstructure be G r , then the morphological characteristic coefficient F r It is expressed as:
[0129]
[0130] In this way, Fr The value range is between 0 and 1, indicating the ratio relative to the maximum gray value;
[0131] For shape, assume that the contours of each phase are extracted by image processing technology, and the complexity index of its shape, such as compactness index, is calculated. Let the shape complexity index of the rth phase be C r , then the morphological characteristic coefficient F r It is expressed as:
[0132] F r =1-C r
[0133] In this way, F r The value range is between 0 and 1, indicating that the more complex the shape, the higher the F r The closer to 0, the simpler the shape, and the r The closer to 1;
[0134] For the relative area, assuming that the area ratio of each phase has been calculated on the microscopic image, let the area ratio of the rth phase in the alloy be A r , then the morphological characteristic coefficient F r Directly expressed as relative area:
[0135] F r =A r
[0136] In this way, F r The value range of is between 0 and 1, indicating the proportion relative to the total area;
[0137] For texture, assuming that the texture features of each phase are calculated by texture analysis methods, such as the gray level co-occurrence matrix GLCM, and the texture feature of the rth phase is Tr, then the morphological feature coefficient F r It is expressed as:
[0138]
[0139] Among them, Tmax is the maximum value of the texture features in all phases;
[0140] Among them, F r The value range is between 0 and 1, indicating that the more significant the texture feature, the higher the F r The closer to 1;
[0141] The microscopic characteristic data include a dislocation density index, a nanoscale phase boundary index, a chemical composition uniformity index and a microscopic hardness index, and the dislocation density index is recorded as WZMd, the nanoscale phase boundary index is recorded as NMd, the chemical composition uniformity index is recorded as HXj, and the microscopic hardness index is recorded as WGd;
[0142] For the dislocation density index WZMd, dislocations are key microstructures that affect the mechanical properties of materials and are identified and quantified using the EBSD technique under an electron microscope;
[0143] The dislocation density WZMd is quantified by electron backscatter diffraction EBSD technology. The specific calculation expression is:
[0144]
[0145] Where Nd represents the total number of dislocations identified in a specific observation area, and A represents the area of the observation area;
[0146] For nanoscale phase boundaries, the index is NMd, which includes the type and continuity of the phase boundary, which is quantified using high-resolution electron microscopy;
[0147] The nanoscale phase boundary index NMd is quantified by evaluating the type and continuity of the phase boundary, and its mathematical expression is:
[0148]
[0149] Where Lv represents the total length of the vth type of phase boundary, V is the total number of phase boundary categories; A is the observation area;
[0150] Cv is the continuity coefficient, a number between 0 and 1, indicating the continuity quality of the phase boundary;
[0151] For the chemical composition uniformity index HXj, it is quantified by energy dispersive spectroscopy EDS analysis to understand the distribution uniformity of different elements at the microscopic scale;
[0152] The chemical composition uniformity HXj is calculated by the element distribution uniformity obtained by energy dispersive spectroscopy EDS analysis, and its mathematical expression is:
[0153]
[0154] Among them, σ X Represents the standard deviation of the concentration of a specific element in the observation area, μ X is the average value of the element concentration;
[0155] For the microhardness index WGd, it is obtained through microhardness testing and reflects the local hardness of the material;
[0156] The microhardness WGd is obtained through microhardness testing and is expressed as:
[0157]
[0158] Where F is the force applied to the sample in Newtons (N), and Ad is the surface area of the indentation in square millimeters (mm).2 ).
[0159] Embodiment 4:
[0160] Further explanation based on the third embodiment, the first contrast index is defined as C1, and the calculation formula is as follows:
[0161]
[0162] Among them, the function f(Xi) is given by the following expression:
[0163]
[0164] Where Pi represents the probability value of the i-th category alloy microstructure image in the model prediction;
[0165] X i is the comprehensive morphological feature value corresponding to the i-th category, which is the result of weighted average of various morphological indicators LDs, JTx, JJz, and XFb, and increases by X i Will be due to α i ,β i ,γ i , the regulatory effect makes f(X i ) increases or decreases, thus directly affecting the calculation result of C1;
[0166] X i The steps of weighted averaging are as follows:
[0167] Normalization,First, each morphological index is normalized to convert their values into scores,within a similar range to ensure that they have an equal impact on the,results. Normalization is performed using the following formula:
[0168]
[0169] Among them, X i is the morphological index value of the microstructure image of the i-th type alloy; μ i is the mean value of the morphological index of the i-th category; σ2 i is the standard deviation of the morphological index of the i-th category; Z i is the standardized morphological index value;
[0170] Assign weights to each morphological index, reflecting their relative importance in the comprehensive morphological features. These weights are determined according to actual conditions or specified through data analysis or expert opinions. Assume that the four morphological indicators are represented by w LDs 、w JTx 、w JJz 、w XFb Indicate their weights;
[0171] Weighted average: multiply the standardized morphological index value by the corresponding weight and add them together to obtain the comprehensive morphological feature value X i , the mathematical expression of weighted average is as follows:
[0172] X i =w LDs ·Z LDs +w JTx ·Z JTx +w JJz ·Z JJz +w XFb ·Z XFb
[0173] Among them, X i is the comprehensive morphological characteristic value of the microstructure image of the i-th category alloy;
[0174] Z LDs , Z JTx , Z JJz , Z XFb They are the standardized LDs, JTx, JJz and XFb morphological index values;
[0175] w i is the weight of the i-th category, which is determined by prior knowledge and reflects the importance of different categories in practical applications. i It can change the weight of this category in the total calculation, which has a significant impact on C1 and increases w i It will increase C1, indicating that the influence of this category is enhanced;
[0176] σ i is a normalization factor that adjusts the influence of the i-th category in the calculation to prevent the value from being too large or too small;
[0177] α i ,β i ,γ i ,δ i ,ò i is the adjustment parameter specific to the i-th category, determined by empirical data;
[0178] Function f(X i ) is a rational function in order to provide sufficient complexity to adapt to different types of feature data. Through this design, not only the nonlinear relationship of morphological features is considered, but also the nonlinear changes of polynomials and denominators are introduced to adapt to the diversity of data.
[0179] The value range of formula C1 is set to (0,1), where a value closer to 1 indicates a higher matching degree, and a value closer to 0 indicates a lower matching degree. This setting can intuitively reflect the matching degree between the probability values of different categories and the morphological feature data;
[0180] The first matching result includes the following value ranges:
[0181] Very low matching interval (0.00, 0.25), C1 value lower than 0.25 indicates that the matching degree between the probability value of the current category and the morphological feature data is very low, which is due to misclassification or data anomaly;
[0182] The judgment rule is that when C1<0.10, the data is considered to be almost irrelevant, and it is recommended to exclude this category. Specifically, consider checking whether there are problems in model settings, data preprocessing or feature engineering, and adjust the model parameters by at least 20%;
[0183] If C1 is between 0.10 and 0.25, it is recommended to review the data or increase the sample data for retraining. Specifically, the amount of sample data should be increased by at least 30% to improve the matching degree of the data.
[0184] The technical effect is that, by setting this interval, the categories with large errors can be effectively identified and excluded, avoiding the introduction of noise in subsequent analysis;
[0185] Low matching interval [0.25, 0.50), the C1 value in this interval indicates that the category matching is low, indicating that the model has not fully learned the features;
[0186] The judgment rule is that when C1 reaches 0.40 or above, consider adjusting the model parameters or feature weights to try to improve the matching degree. Specifically, adjust the model parameters or feature weights to improve the matching degree of the model by at least 20%;
[0187] The technical effect is to prompt technicians to adjust the model or data processing method to increase the accuracy of classification;
[0188] Medium matching interval [0.50, 0.75), C1 value in this interval indicates a certain degree of matching, but further optimization is needed to improve confidence;
[0189] The judgment rule is that if C1 is close to 0.75, it is recommended to make slight model adjustments or data weighting for specific categories, specifically to make slight model adjustments or increase data weighting by at least 10%;
[0190] The technical effect is that, on the basis of ensuring the stability of the model, moderate adjustment can improve the accuracy of matching;
[0191] High matching interval [0.75, 1.00), C1 value higher than 0.75 indicates high matching, and the current category is well consistent with the alloy microstructure image;
[0192] The judgment rule is that when C1>0.90, the match is considered to be very successful, and the output results of this category are directly adopted. The model is regularly monitored and maintained to ensure the stability of the results.
[0193] The technical effect is to provide a high-reliability judgment basis to ensure the reliability and accuracy of the results.
[0194] Embodiment five:
[0195] Further explanation based on the fourth embodiment, the second contrast index is defined as C2, and the calculation formula is as follows:
[0196]
[0197] Where WZMd, NMd, HXj, WGd represent the indicators of dislocation density, nanoscale phase boundary, chemical composition uniformity and microhardness respectively; pi is the predicted probability of the i-th category; k is an adjustment factor used to adjust the exponential weight of the probability value pi, k∈(0.1,0.62), affecting the sensitivity of the overall index; b1, b2, b3, b4 are non-negative weight coefficients used to balance the influence of each microscopic feature in the total contrast index, and b1+b2+b3+b4=1, which is determined by empirical data and expert group analysis;
[0198] The value range of formula C2 is set in the interval (0,1). By adjusting the parameters k, b1, b2, b3, and b4, the sensitivity and interval distribution of C2 are affected. Increasing k will amplify the impact of the category with a higher prediction probability, while increasing b1 will increase the role of the dislocation density index in the total index, which helps to accurately identify those alloy categories with particularly complex microstructures. Different C2 value intervals correspond to different technical effects. The closer the C2 value is to 1, the higher the match between the current category and the alloy microstructure, which is used for more accurate classification decisions.
[0199] The second matching result includes the following intervals:
[0200] The C2 value of (0, 0.25) is a low matching interval, which means that the alloy microstructure image has a low matching degree with the current classification model. The matching degree is within 20%, and it is recommended to re-extract features or increase the amount of data training. It is also considered that the credibility of the classification result is less than 25%, and additional verification or data is needed;
[0201] Re-extract features: Re-examine the selected feature set. The current features cannot effectively distinguish different types of microstructure images. Try to add more features or modify the feature extraction method.
[0202] The current feature set only includes basic pixel intensity features, without considering the texture or shape features in the alloy microstructure. Try to use texture-based feature extraction methods, such as LBP (Local Binary Patterns) or GLCM (Gray Level Co-occurrence Matrix), to capture richer information;
[0203] Increase the amount of training data: Collect more data, especially samples of low-matching categories. Increasing training data can help the model better learn the differences between various categories and improve classification accuracy.
[0204] Assuming that the current dataset only contains a few types of microstructure images, consider collecting more different types of alloy microstructure images, especially those samples with low matching categories, so that the model can better learn the differences between various categories;
[0205] Validation and additional data: Since the confidence of the current classification results is less than 25%, it is recommended to verify the performance of the model through additional validation datasets, which can be achieved through cross-validation or independent test datasets;
[0206] In addition to the training set and the test set, create an independent validation set to evaluate the performance of the model on unseen data. This validation set should cover all categories and be mutually exclusive with the training set and the test set. By evaluating the performance of the validation set, you can better understand the generalization ability and robustness of the model.
[0207] The C2 value of [0.25, 0.5) is a medium match interval, which means that there is a 20% to 45% match, but it is still not enough to make a final judgment, and further feature analysis or model adjustment is required; and the credibility of the classification result is considered to be between 25% and 50%, and it is recommended to re-analyze local features;
[0208] Further feature analysis: Conduct a deeper analysis of the currently used features to determine which features contribute more to the classification and which features have problems or need to be improved;
[0209] Model adjustment: Based on the results of feature analysis, the model parameters or structure need to be adjusted to improve classification accuracy and matching;
[0210] Assuming that a convolutional neural network (CNN) is currently used as a classifier, try to adjust the network's depth, width, or activation function parameters to improve the model's expressiveness and classification performance;
[0211] Local feature re-analysis: Re-analyze the local features of a specific category or microstructure to determine whether more distinguishing features can be extracted;
[0212] For a certain category of microstructure, the sliding window method is used to extract local features and combine them with the overall features to improve classification accuracy.
[0213] The C2 value is in the range of [0.5, 0.75) which is a high matching interval. This range indicates that the alloy microstructure image has a high matching degree with the model, with a matching degree of 45% to 75%, and can be considered as a candidate classification result; and the credibility of the classification result is considered to be between 50% and 75%;
[0214] Candidate classification results: These results are candidate classification results, but they still need to be treated with caution and need further optimization or verification;
[0215] Careful analysis and validation: Conduct more in-depth analysis and validation of candidate results to ensure their accuracy and reliability. Consider using cross-validation or independent test data sets to verify the robustness of the results.
[0216] For each category in the candidate results, further analyze its classification performance and use the confusion matrix tool to evaluate the performance of the model on each category. At the same time, the cross-validation method is used to verify the robustness and generalization ability of the model.
[0217] The C2 value in the interval [0.75,1] is a high matching interval, which means that the alloy microstructure image matches the current model very well, with a matching degree of more than 75%. It is believed that the credibility of the classification result is higher than 75%, and this classification can be regarded as the final result;
[0218] Final results: These classification results are considered highly reliable and can be adopted directly;
[0219] Verification and Validation: Although the results are considered final, it is recommended to conduct a final verification and validation to ensure that there are no omissions or errors, either through discussions with domain experts or additional experiments;
[0220] Parameter interaction and threshold setting:
[0221] For k: Increasing k will increase the weight of the high-probability category and increase the C2 value. Increasing k from 0.5 to 1.0, if the C2 value is increased from 0.45 to 0.65, the result will be pushed from the low matching interval to the medium matching interval.
[0222] For b1, b2, b3, b4: the adjustment of each weight directly affects the influence of the corresponding microscopic feature on C2. If the dislocation density b1 is an important feature, increasing the value of b1 can directly increase C2, reflecting that the alloy category with high dislocation density has a higher degree of match with the image;
[0223] Increasing b1 from 0.1 to 0.3 can increase C2 from 0.48 to 0.62, pushing it from the low matching range to the medium matching range;
[0224] Likewise, increasing b2, b3, and b4 will similarly affect the calculation of C2 and change the classification decision.
[0225] Embodiment six:
[0226] Further explanation based on the fifth embodiment, the selection adjustment model is defined as S, and the calculation formula is as follows:
[0227]
[0228] Where n represents the total number of alloy microstructure image categories;
[0229] τ i is the first index adjustment coefficient of the corresponding category, which is used to adjust the weight of the first comparison index C1 in the total score. i When , the influence of the first contrast index of the corresponding category on the total score increases;
[0230] ρ i is the second index adjustment coefficient of the corresponding category, which is used to adjust the weight of the second comparison index C2 in the total score. i When , the influence of the second contrast index of the corresponding category on the total score increases;
[0231] τ i The dynamic adjustment expression is as follows:
[0232]
[0233] Among them, TDc j1 It refers to the weight used for a specific parameter j1, n1 is the total number of specific parameters, and its value is determined by domain experts, calculated based on statistical data, or is an empirical value;
[0234] ρ i Dynamic adjustment expression:
[0235]
[0236] Among them, TDYx j2 It refers to the influence measure of a specific feature j2, where n2 is the total number of specific features, obtained by feature importance analysis, calculated based on information gain, or determined based on domain knowledge;
[0237] For τ i ,Specific parameter weight: indicates the importance of each specific parameter to the matching model;
[0238] τi The value range of is (0,1) and satisfies To ensure that the sum of the weights is 1;
[0239] For ρ i ,Specific feature influence: measures the influence of each feature on the matching model;
[0240] ρ i The value range of is (0,1) and satisfies To ensure that the sum of the influences is 1;
[0241] Dynamic adjustment mechanism description:
[0242] τ i and ρ i The dynamic adjustment of enables the model to be optimized according to different alloy microstructural characteristics;
[0243] These adjustments are based on changes in specific parameter weights and specific feature influences, so the model can flexibly adapt to different data and task requirements;
[0244] For example:
[0245] Assume that the matching model for the alloy microstructure image has two important parameters: parameter A and parameter B, and three key features: feature X, feature Y and feature Z;
[0246] For τ i Dynamic adjustment:
[0247] If parameter A has a greater impact on the matching model, then parameter A is given a higher weight, that is, τ A >τ B ;
[0248] If the parameter B is also important for the matching model, then τ A and τ B The weights are adjusted accordingly to ensure
[0249] For ρ i Dynamic adjustment:
[0250] If feature X plays a key role in matching, its specific feature influence is adjusted to a larger value, that is, ρ X >ρ Y and ρ Z ;
[0251] If feature Y and feature Z have similar influence on the matching model, adjust their specific feature influences to ensure
[0252] di is the power coefficient of the second index of the corresponding category, which is used to adjust the nonlinear effect of the second contrast index C2. Increasing di will make the influence of C2 of the corresponding category in the score more sensitive;
[0253] Set the value range of S to (0,10). The closer the value is to 0, the lower the matching score is, and the closer the value is to 10, the higher the matching score is. Divide the value range of S (0,10) into the following intervals, and perform matching result screening and judgment;
[0254] Very low matching interval (0,3), S value in this interval indicates that the matching degree of the model is very low, and the adaptability of the alloy microstructure image and the model is poor; if S<1.5, the matching degree is less than 15%, and it is necessary to make large-scale adjustments to the model parameters and data processing with the highest matching degree between the first matching result and the second matching result; if 1.5≤S<3, the matching degree is between 15% and 30%, the second matching result is selected, and the C2 value is increased by 0.15, the interval to which the adjusted second matching result belongs is determined, and detailed feature reanalysis and model fine-tuning are performed on the corresponding matching results;
[0255] For (S<1.5), fundamental adjustments are made to the algorithm parameters, such as changing the matching algorithm or introducing a new feature extraction method;
[0256] For 1.5≤S<3, optimize the existing data preprocessing steps and adjust the feature selection and model regularization parameters;
[0257] Assume that the matching degree of the model for a certain microstructure category is S = 1, which means that the matching degree of the model for this category is only 10%. In this case, the model needs to be adjusted on a large scale, such as redesigning the feature extraction method or changing the classification algorithm. In addition, if the matching degree of a certain type of microstructure is S = 2.5, it means that the model is slightly better adapted to this category, but it still needs to be carefully adjusted in terms of data preprocessing and feature selection.
[0258] Medium matching interval [3,7), S value in this interval indicates that the model has a medium matching degree, and some significant features are identified but there is still room for improvement; if 3≤S<5, the matching degree is between 30% and 50%. At this time, it is recommended to select the category with the highest matching degree between the first matching result and the second matching result for local parameter adjustment and data weighting; if 5≤S<7, the matching degree is between 50% and 70%, select the category in the second matching result, and increase the C2 value by 0.1, determine the interval to which the adjusted second matching result belongs, and make slight model adjustments to the corresponding matching results or increase the number of training samples;
[0259] For 3≤S<5, fine-tune the parameters of the existing model, such as adjusting the learning rate and increasing the model complexity;
[0260] For 5≤S<7, try to increase the number of training samples or perform reinforcement learning on specific features;
[0261] When the matching degree of a certain microstructure category is S=4, it means that the model is at a medium level of adaptability to the category and has identified some significant features, but there is still room for improvement. In this case, the matching degree can be improved by fine-tuning the model parameters or increasing the number of training samples. For example, if the matching degree of a certain category is S=6, it means that the model is well adapted to the category, but some slight adjustments are still needed to further improve the matching degree.
[0262] High matching interval [7,10], S value in this interval indicates that the model has a high matching degree, the matching result is very reliable and suitable for practical applications; if 7≤S<8.5, the matching degree is between 70% and 85%, which is considered a high matching, and either the first matching result or the second matching result is selected, and a small amount of adjustment is required to optimize the result; if 8.5≤S<10, the matching degree exceeds 85%, the second matching result is selected, and the C2 value is increased by 0.5, the interval to which the adjusted second matching result belongs is determined, and the corresponding matching result This model can be directly used for actual category judgment and output;
[0263] For 7≤S<8.5, fine-tune, such as adjusting parameters or adding slight feature engineering;
[0264] For 8.5≤S<10, maintain the existing model status and perform routine maintenance and monitoring;
[0265] If the matching degree of a certain microstructure category is S=8, it means that the model has a high matching degree for this category, but some fine-tuning is still needed to optimize the results. For example, if the matching degree of a certain category is S=9, it means that the model is very adaptable to this category and can be directly used for actual category judgment and output without additional adjustments.
[0266] Embodiment seven:
[0267] Further explanation based on Example 6, this example aims to verify the practical application effect of the proposed selection adjustment model S in the judgment of alloy microstructure category. First, five different types of alloy microstructure image data are collected from different sources. These data are preprocessed, including denoising, size standardization and contrast enhancement, to ensure the consistency and quality of the input data;
[0268] Next, based on the defined adjustment model S, for each alloy microstructure image, its first contrast index C1 and second contrast index C2 are calculated, where C1 represents the detail clarity of the image, and C2 represents the texture matching of the image. Each type of alloy microstructure is assigned a different τ i and ρi value to reflect the difference in their weight in the total score; for alloy types with complex textures, increase ρ i , to increase the influence of C2 in the overall score;
[0269] During the implementation, different di values were set to investigate the effects of different nonlinear weight adjustments on the S value, and five independent tests were performed for each alloy microstructure type to collect data and analyze the changes in the S value;
[0270] Excel table data
[0271] The following table lists the C1, C2, τ of the five alloy microstructures. i ,ρ i ,di and the calculated S value:
[0272] Table 1
[0273]
[0274]
[0275] Data comparison and analysis:
[0276] It can be seen from the table that the types of microstructures of different alloys can be adjusted by adjusting τ i ,ρ i , di parameter, the S value shows obvious differences, which fully demonstrates the flexible application and effect of the selected adjustment model under different conditions. The di value of austenitic stainless steel is 2.2, indicating that the weight increase of its C2 is more nonlinear, making the final S value reach 8.2, reflecting a high degree of matching. On the other hand, the di value of duplex steel is lower at 1.3, resulting in an S value of 5.4, indicating that its matching effect is moderate and needs further optimization;
[0277] Strong adaptability: By dynamically adjusting τ i ,ρ i The model can be optimized for different alloy microstructure characteristics to improve the matching accuracy. The C1 of aluminum alloy is low, but by increasing τ i to 1.3, increasing its weight in the total score, making the final S value 7.9, showing good adaptability and accurate matching;
[0278] Precise control: Through the nonlinear adjustment coefficient di, the model can finely control the weight of C2, allowing the model to automatically adjust its influence according to the importance of texture matching, further enhancing the flexibility and applicability of the model;
[0279] Quantitative scoring mechanism: The introduction of S value provides a clear quantitative indicator for the classification of alloy microstructures, which can intuitively indicate the quality of the matching effect. This quantitative mechanism is technically novel and provides direct decision support for users;
[0280] Analysis of interactive changes in numerical values:
[0281] Increase τ i : When C1 is higher, increase τ i It will significantly increase the weight of this category in the total score S, resulting in an increase in the S value. i to 1.3, its S value increased to 7.9;
[0282] Increase ρ i And adjust di: This will strengthen the weighting influence of C2, especially when di is high, the weight of C2 becomes more nonlinear, such as austenitic stainless steel, whose di value is 2.2, which makes the C2 weight significantly enhanced, so that the S value reaches 8.2.
[0283] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0284] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. Those skilled in the art may appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software methods depends on the specific application and design constraints of the technical solution.
[0285] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0286] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. Alloy microstructure classification method based on PyTorch framework, It is characterized in that The specific steps include: Step S1, collecting alloy microstructure images of different categories, annotating them, and classifying them into different data sets to form {1, 2, ..., i, ..., n}, where i represents the i-th category of alloy microstructure images, and n represents the total number of alloy microstructure image categories, and using image enhancement and noise reduction techniques to improve image quality; Step S2: Design a convolutional neural network model according to the characteristics of the data set, including the number, size, and number of channels of the components of the convolutional layer, pooling layer, and fully connected layer; and use the back propagation algorithm to train the model; Step S3, obtaining a new alloy microstructure image as a model input, and preprocessing the input alloy microstructure image to generate a preprocessing result; obtaining different annotated data sets, and dividing them into a training set, a validation set, and a test set in turn; Step S4, obtaining the preprocessing result, and inputting the preprocessing result into the trained convolutional neural network model for classification and recognition, generating a classification and recognition output result, the output result including outputting the probability value of each category, and taking the category with the largest probability value as the classification result of the image; Step S5, collecting the morphological feature data of the current i-th new alloy microstructure image and the microscopic feature data of the alloy microstructure, and determining the standard data set of each category of alloy microstructure based on the alloy microstructure images of different categories; Step S6, obtaining each category probability value included in the output result in step S4, and obtaining the morphological feature data in step S5, and performing analysis and processing to generate a first comparison index, dividing the index value range into a number of intervals and performing comparison and analysis with the standard data set to generate a first matching result, which is used to preliminarily determine the category that best matches the current alloy microstructure among the several category probability values included in the output result; Step S7, obtaining each category probability value included in the output result in step S4, receiving the microscopic feature data in step S5, and performing analysis and processing to generate a second comparison index, dividing the index value range into several intervals and performing comparison and analysis with the standard data set to generate a second matching result, which is used to secondarily determine the category that best matches the current alloy microstructure among the several category probability values included in the output result; Step S8, after obtaining the first comparison index and the second comparison index, perform analysis and processing to construct a selection adjustment model, which is used to perform final screening and judgment on the alloy microstructure category judged in the first matching result and the second matching result.
2. The alloy microstructure classification method based on the PyTorch framework according to claim 1, Features: The preprocessing of the input alloy microstructure image specifically includes cropping and scaling the input alloy microstructure image, and dividing the data set into a training set, a validation set, and a test set; The image enhancement technology uses a histogram equalization method, the noise reduction technology uses a combination of a Gaussian filter and a median filter, the back propagation algorithm uses a gradient descent method, and sets the learning rate to 0.0001. BatchNormalization technology is used to accelerate the deep neural network training process to improve model performance and stability; The classification and recognition output result also includes a category label of the alloy microstructure based on {1, 2, ..., i, ..., n}.
3. The alloy microstructure classification method based on the PyTorch framework according to claim 2, Features: The morphological characteristic data include a particle size index, a crystal morphology index, a grain boundary characteristic index, and a phase distribution and morphology index, and the particle size index is recorded as LDs, the crystal morphology index is recorded as JTx, the grain boundary characteristic index is recorded as JJz, and the phase distribution and morphology index is recorded as XFb; The microscopic characteristic data include a dislocation density index, a nanoscale phase boundary index, a chemical composition uniformity index and a microhardness index, and the dislocation density index is recorded as WZMd, the nanoscale phase boundary index is recorded as NMd, the chemical composition uniformity index is recorded as HXj, and the microhardness index is recorded as WGd.
4. The alloy microstructure classification method based on the PyTorch framework according to claim 3, Features: The first contrast index is defined as C1, and the calculation formula is as follows: Among them, the function f(Xi) is given by the following expression: Where Pi represents the probability value of the i-th category alloy microstructure image in the model prediction; Xi is the comprehensive morphological feature value corresponding to the i-th category, which is the result of weighted average of various morphological indicators LDs, JTx, JJz, and XFb, and wi is the weight of the i-th category; σi is a normalization factor that adjusts the influence of the i-th category in the calculation to prevent the value from being too large or too small; αi, βi, γi, δi, òi are adjustment parameters specific to the i-th category and are determined by empirical data; The value range of formula C1 is set to (0,1), where a value closer to 1 indicates a higher matching degree, and a value closer to 0 indicates a lower matching degree; The first matching result includes the following value ranges: Very low matching interval (0.00, 0.25), C1 value lower than 0.25 indicates that the matching degree between the probability value of the current category and the morphological feature data is very low, and the matching degree is below 25%, which is due to misclassification or data anomaly; The judgment rule is that when C1<0.10, the data is considered to be almost irrelevant and it is recommended to exclude this category; if C1 is between 0.10 and 0.25, it is recommended to review the data or increase sample data for retraining; Low match interval [0.25, 0.50), C1 values in this interval indicate low category match, with a match between 25% and 50%, indicating that the model has not fully learned the features; The judgment rule is that when C1 reaches 0.40 or above, consider adjusting the model parameters or feature weights to try to improve the matching degree. Specifically, adjust the model parameters or feature weights to improve the matching degree of the model by at least 20%; Medium matching interval [0.50, 0.75), C1 value in this interval indicates that there is a certain degree of matching, between 50% and 75%, but further optimization is needed; The judgment rule is that if C1 is close to 0.75, it is recommended to make slight model adjustments or data weighting for specific categories; High matching interval [0.75, 1.00), C1 value higher than 0.75 indicates high matching, the matching degree is above 75%, and the current category is well matched with the alloy microstructure image; The judgment rule is that when C1>0.90, the match is considered to be very successful and the output result of this category is directly adopted.
5. The alloy microstructure classification method based on the PyTorch framework according to claim 4, Features: The second contrast index is defined as C2, and the calculation formula is as follows: Wherein, WZMd, NMd, HXj, WGd represent the indexes of dislocation density, nanoscale phase boundary, chemical composition uniformity and microhardness respectively; pi is the predicted probability of the i-th category; k is an adjustment factor used to adjust the exponential weight of the probability value pi, affecting the sensitivity of the overall index; b1, b2, b3, b4 are non-negative weight coefficients used to balance the influence of each microscopic feature in the total contrast index, and b1+b2+b3+b4=1; The value range of formula C2 is set in the interval (0,1). The closer the C2 value is to 1, the higher the matching degree between the current category and the alloy microstructure is, which is used for more accurate classification decisions; The second matching result includes the following intervals: The C2 value of (0, 0.25) is a low matching interval, which means that the alloy microstructure image has a low matching degree with the current classification model. The matching degree is within 20%, and it is recommended to re-extract features or increase the amount of data training. It is also considered that the credibility of the classification result is less than 25%, and additional verification or data is needed; The C2 value of [0.25, 0.5) is a medium match interval, which means that there is a 20% to 45% match, but it is still not enough to make a final judgment, and further feature analysis or model adjustment is required; and the credibility of the classification result is considered to be between 25% and 50%, and it is recommended to re-analyze local features; The C2 value is in the range of [0.5, 0.75) which is a high matching interval. This range indicates that the alloy microstructure image has a high matching degree with the model, with a matching degree of 45% to 75%, and can be considered as a candidate classification result; and the credibility of the classification result is considered to be between 50% and 75%; The C2 value in the interval [0.75,1] is a high matching interval, which means that the alloy microstructure image matches the current model very well, with a matching degree of more than 75%. It is believed that the credibility of the classification result is higher than 75%, and this classification is regarded as the final result.
6. The alloy microstructure classification method based on the PyTorch framework according to claim 5, Features: The selection adjustment model is defined as S, and the calculation formula is as follows: Wherein, n represents the total number of alloy microstructure image categories; τi is the first index adjustment coefficient of the corresponding category, which is used to adjust the weight of the first contrast index C1 in the total score. When τi is increased, the influence of the first contrast index of the corresponding category on the total score increases; ρi is the second index adjustment coefficient of the corresponding category, which is used to adjust the weight of the second comparison index C2 in the total score. When ρi is increased, the influence of the second comparison index of the corresponding category on the total score increases; The dynamic adjustment expression of τi is as follows: Among them, TDcj 1 refers to the weight used for a specific parameter j1, n1 is the total number of specific parameters, and the dynamic adjustment expression of ρi is: Among them, TDYxj 2 It refers to the influence measure of the specific feature j2, n2 is the total number of specific features, di is the power coefficient of the second index of the corresponding category, which is used to adjust the nonlinear influence of the second contrast index C2. Increasing di will make the influence of C2 of the corresponding category in the score more sensitive; Set the value range of S to (0,10). The closer the value is to 0, the lower the matching score is, and the closer the value is to 10, the higher the matching score is. Divide the value range of S (0,10) into the following intervals, and perform matching result screening and judgment; Very low matching interval (0,3), S value in this interval indicates that the matching degree of the model is very low, and the adaptability of the alloy microstructure image and the model is poor; if S<1.5, the matching degree is less than 15%, and it is necessary to make large-scale adjustments to the model parameters and data processing with the highest matching degree between the first matching result and the second matching result; if 1.5≤S<3, the matching degree is between 15% and 30%, the second matching result is selected, and the C2 value is increased by 0.15, the interval to which the adjusted second matching result belongs is determined, and detailed feature reanalysis and model fine-tuning are performed on the corresponding matching results; Medium matching interval [3,7), S value in this interval indicates that the model has a medium matching degree, and some significant features are identified but there is still room for improvement; if 3≤S<5, the matching degree is between 30% and 50%. At this time, it is recommended to select the category with the highest matching degree between the first matching result and the second matching result for local parameter adjustment and data weighting; if 5≤S<7, the matching degree is between 50% and 70%, select the category in the second matching result, and increase the C2 value by 0.1, determine the interval to which the adjusted second matching result belongs, and make slight model adjustments to the corresponding matching results or increase the number of training samples; High matching interval [7,10], S value in this interval indicates that the model has a high matching degree, the matching result is very reliable and suitable for practical applications; if 7≤S<8.5, the matching degree is between 70% and 85%, which is considered a high matching, and either the first matching result or the second matching result is selected, and a small amount of adjustment is required to optimize the result; if 8.5≤S<10, the matching degree exceeds 85%, the second matching result is selected, and the C2 value is increased by 0.5, the interval to which the adjusted second matching result belongs is determined, and the corresponding matching result is directly used for actual category judgment and output.
Citation Information
Cited By
Construction method and application of fluorescence microscopic signal detection model
CN119693942A
Titanium alloy microscopic structure identification method and system based on deep learning and medium
CN120564187A
A titanium alloy microstructure identification method, system and medium based on deep learning
CN120564187B
