A method for metallographic grain and particle adhesion segmentation and particle size distribution calculation

CN122928879APending Publication Date: 2026-10-16JINAN FENGZHI TEST INSTR CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611418181.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-14
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0002]在金相材料检测领域,晶粒与颗粒的尺寸、粒度分布是评价材料力学性能、工艺性能的关键指标,广泛应用于金属冶炼、热处理、粉末冶金、陶瓷制造等行业;现有技术中,对于金相材料检测如中国专利授权公告号:CN115015056B,公开的一种奥氏体不锈钢的晶粒度的检测方法及其应用,该检测方法包括以下步骤:显示晶界和组织形貌:取待评定奥氏体不锈钢,将奥氏体不锈钢加热至预定温度,冷却,采用草酸水溶液电解;最后进行晶粒度评定,使检测人员能够准确评判晶粒度级别并对组织形貌进行观察;但该检测方法无法深入对金相晶粒与颗粒进行统计,目前行业内主要通过传统图像处理算法实现金相晶粒与颗粒的分割和粒度统计,其存在如下缺陷:

Benefits of technology

1、大幅提升粘连目标分割精度与计数准确性:彻底解决传统算法粘连目标无法拆分的问题,各类金相粘连场景下晶粒、颗粒分割IoU提升至0.93以上,目标计数误差控制在5%以内,D50、D90粒度参数计算偏差低于3%,完全满足工业金相检测精度标准,彻底杜绝传统算法粒度分布严重失真的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122928879A_ABST
    Figure CN122928879A_ABST
Patent Text Reader

Abstract

The application discloses a metallographic grain and particle adhesion segmentation and particle size distribution calculation method, and belongs to the technical field of metallographic detection. The method comprises the following steps: S1, image acquisition and preprocessing: collecting a microscopic image of a metallographic sample, and preprocessing the image; S2, metallographic adhesion target instance segmentation inference: inputting the preprocessed image into a pre-trained instance segmentation deep learning model dedicated to metallographic adhesion targets, and outputting an instance segmentation mask image of grains and particles; the instance segmentation deep learning model is internally provided with a multi-scale feature fusion structure; S3, segmentation result post-processing: filtering noise from the instance segmentation mask image to obtain independent grain and particle target contours; S4, automatic calculation and output of particle size distribution; the metallographic grain and particle adhesion segmentation and particle size distribution calculation method can realize accurate splitting of adhesion targets, multi-scale material self-adaptive adaptation, and full-process automatic particle size detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention specifically relates to a method for metallographic grain and particle adhesion segmentation and particle size distribution calculation, belonging to the field of metallographic testing technology. Background Technology

[0002] In the field of metallographic material testing, grain size and particle size distribution are key indicators for evaluating the mechanical and technological properties of materials, and are widely used in industries such as metal smelting, heat treatment, powder metallurgy, and ceramic manufacturing. Existing technologies for metallographic material testing include, for example, Chinese Patent Publication No. CN115015056B, which discloses a method for detecting the grain size of austenitic stainless steel and its application. This method includes the following steps: displaying grain boundaries and microstructure: taking the austenitic stainless steel to be evaluated, heating it to a predetermined temperature, cooling it, and electrolyzing it with oxalic acid aqueous solution; finally, evaluating the grain size, enabling inspectors to accurately judge the grain size level and observe the microstructure. However, this method cannot perform in-depth statistical analysis of metallographic grains and particles. Currently, the industry mainly uses traditional image processing algorithms to achieve the segmentation and particle size statistics of metallographic grains and particles, which has the following drawbacks: 1. Traditional threshold segmentation cannot automatically separate adhered grains / particles: Existing commercial metallographic software generally adopts a threshold binarization + connected component analysis scheme. When grains or particles are tightly adhered over a large area, the algorithm directly identifies multiple adhered targets as a single connected component. Under metallographic field-of-view testing with medium adhesion density, the target counting error can reach 35% to 70%, and the calculation deviation of characteristic particle sizes such as D50 and D90 can exceed 40%. This method is only suitable for ideal images where particles are completely dispersed and non-contact. It is basically ineffective for metallographic images of polycrystalline structures and accumulated powders. It is necessary to manually draw lines to segment the adhered areas one by one. Manual correction of a single field of view takes 5 to 15 minutes, which cannot achieve batch automated detection.

[0003] 2. Marked watershed segmentation faces the dilemma of oversegmentation / undersegmentation: The mainstream improvement solution in the industry is distance transformation and marked watershed algorithm. This algorithm is highly dependent on manually setting the H-minima suppression threshold. If the threshold is too small, a large amount of oversegmentation will occur, and a single grain will be split into 3 to 8 pseudo grains. If the threshold is too large, it will cause undersegmentation of deeply bonded areas. For mixed crystal metallographic images with both coarse and fine grains, the segmentation intersection-union ratio (IoU) is usually lower than 0.72 under fixed parameters. After changing materials and adjusting the microscope exposure / corrosion degree, the original parameters become invalid, and the parameters need to be repeatedly readjusted for each type of sample. It does not have universal adaptive capability.

[0004] 3. The concave point matching segmentation method has limited applicability and low success rate in segmenting irregular grains: Some particle analysis software uses contour concave point detection and pairing to achieve adhesion separation. This method relies on obvious concave point features, but most metallographic grains are irregular polygons or elongated precipitates, and the concave points at the adhesion junctions are weak or even non-existent. Tests show that in the case of irregular grain adhesion, the success rate of concave point pairing segmentation is less than 55%; it almost fails for three or more areas where multiple particles meet and adhere. At the same time, this method is easily affected by metallographic surface corrosion pits and texture noise, generating a large number of false concave points, which further amplifies the particle size statistical error. Summary of the Invention

[0005] To address the aforementioned issues, this invention proposes a method for metallographic grain and particle adhesion segmentation and particle size distribution calculation, which enables precise separation of adhered targets, multi-scale material adaptive adaptation, and fully automated particle size detection.

[0006] The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution of the present invention includes the following steps: S1. Image acquisition and preprocessing: Acquire microscopic images of metallographic samples and preprocess the images; S2. Metallographic Adhesion Target Instance Segmentation Inference: The pre-processed image is input into a pre-trained deep learning model for instance segmentation of metallographic adhesion targets, and the output is an instance segmentation mask map of grains and particles; the instance segmentation deep learning model is trained on a special dataset for metallographic image scenes with grain stacking, multiple particle intersections, blurred boundaries, and irregular shapes, and has a built-in multi-scale feature fusion structure to extract layered features for coarse grains, fine particles, and mixed crystal structures. S3. Post-processing of segmentation results: Noise filtering is performed on the instance segmentation mask to obtain independent grain and particle target contours; S4. Automatic Calculation and Output of Particle Size Distribution: Based on the independent profile of each grain and particle, automatically calculate the equivalent circle diameter, area, and circumference parameters, batch statistically analyze the number of grains, particle size distribution, D50 and D90 characteristic particle size data, and output the particle size distribution results.

[0007] Furthermore, in step S1, the preprocessing includes at least one of illumination uniformity correction, median filtering for scratch removal, and adaptive contrast enhancement.

[0008] Furthermore, the multi-scale feature fusion structure extracts feature maps of different scales through multi-level downsampling, and then fuses the multi-scale features through upsampling to enhance the feature recognition ability of weak boundaries and blurred, contiguous regions, and suppress interference from erosion pits and surface texture noise. Specifically, downsampling involves reducing the spatial size (width and height) of the feature map while increasing the number of feature channels, such as 2×2 max pooling and convolution with a stride of 2. This expands the receptive field and reduces computational cost. Expanding the receptive field involves allowing each convolutional unit to see a larger image area, gradually transitioning from viewing pixel details to viewing the overall shape, and extracting higher-level semantics. Semantic features, such as identifying the overall outline of grains and the distribution of adhesion regions; the compression computation is as follows: the feature map size is halved, the computation is reduced to 1 / 4, and the inference efficiency is improved; during downsampling, the encoder part compresses the 512×512 input image into 256×256, 128×128, 64×64, and 32×32 feature maps through 4 downsampling operations, extracting multi-scale features from grain boundary details to the global grain layer by layer; upsampling is as follows: enlarging the spatial size of the feature map and restoring the spatial resolution; such as bilinear interpolation and transposed convolution (deconvolution), which can gradually restore the deeply compressed semantic features back to the original. Figure 1 The high resolution prepares for the final pixel-level segmentation mask output. During upsampling, the decoder performs four upsampling operations to gradually enlarge the 32×32 deep feature map back to 64×64, 128×128, 256×256, and 512×512. At the same time, it fuses the shallow detail features of the corresponding level through skip connections, and finally outputs the grain instance segmentation result with the same size as the input image. Upsampling and downsampling work together to first determine where the grains are and where the grain boundaries are, and then accurately delineate the boundaries of each grain.

[0009] Furthermore, the instance segmentation deep learning model is a dual-branch structure of grain boundaries and grains. The grain boundary branch uses an 8-directional anisotropic convolutional kernel to extract multi-directional grain boundary features and constrains grain boundary connectivity through a grain boundary continuity loss function. The grain boundary branch uses an 8-directional anisotropic convolutional kernel to extract linear grain boundary features in eight directions: 0°, 22.5°, 45°, 67.5°, 90°, 112.5°, 135°, and 157.5°. It also applies a grain boundary continuity loss function to penalize fractured grain boundaries, constraining grain boundary connectivity. The grain branch uses an encoder and decoder structure to extract the main semantic features of the grains. The decoder embeds the grain boundary branch feature map at each level, using grain boundary features to guide the splitting of adhesion region boundaries, improving the splitting accuracy of polycrystalline junction areas.

[0010] Furthermore, the multi-scale feature fusion structure is an adaptive weighted fusion model driven by prior grain size. The specific working process is as follows: First, the shallow prediction network quickly outputs the grain size distribution histogram of the current field of view and counts the proportions of coarse, medium, and fine grains; then, the fusion weights of each level of feature map are dynamically adjusted according to the size distribution. If the proportion of fine grains is high, the weight of the shallow high-resolution features is increased to enhance the expression of details; if the proportion of coarse grains is high, the weight of the deep large receptive field features is increased to ensure global integrity and adapt to samples with different mixed crystal ratios.

[0011] Furthermore, in step S3, the post-processing of the segmentation results also includes metallographic topological constraint verification: extracting the adjacency relationship and the angle between the three-way grain boundary of each segmentation target, removing pseudo grains with a neighbor number of <3 or >10 and a grain boundary angle deviating from 120° by more than 40°, repairing oversegmentation errors, and reducing the interference of false targets on grain size statistics.

[0012] Furthermore, step S4 also includes grain size calibration, specifically as follows: the equivalent circle diameter is cross-calibrated using the intercept method, and the grains truncated at the edge of the field of view are weighted statistically corrected according to their area proportion; the intercept method adopts the GB / T6394 standard to cross-calibrate the equivalent circle diameter and correct the grain size statistical deviation caused by irregular grains; at the same time, the grains truncated at the edge of the field of view are weighted statistically corrected according to their area proportion in the field of view to reduce the grain size distribution deviation caused by the edge effect.

[0013] Furthermore, the training dataset of the instance segmentation deep learning model includes metallographic images of carbon steel, aluminum alloy, powder metallurgy particles, and ceramic grains, covering samples with different degrees of adhesion, corrosion, and imaging magnification, ensuring the generalization ability of the instance segmentation deep learning model.

[0014] Furthermore, in step S4, the output particle size distribution result includes at least one of the following: particle size distribution histogram, cumulative distribution curve, grain size rating result, and statistical report.

[0015] Compared with the prior art, the method for calculating metallographic grain and particle adhesion segmentation and particle size distribution of the present invention has the following advantages: 1. Significantly improves the segmentation accuracy and counting accuracy of adhered targets: Completely solves the problem that traditional algorithms cannot separate adhered targets. The IoU of grain and particle segmentation in various metallographic adhesion scenarios is improved to above 0.93, the target counting error is controlled within 5%, and the calculation deviation of D50 and D90 particle size parameters is less than 3%, which fully meets the accuracy standards of industrial metallographic testing and completely eliminates the problem of serious particle size distribution distortion in traditional algorithms.

[0016] 2. Possesses extremely strong generalization ability for working conditions and materials: There is no need to repeatedly adjust algorithm parameters for different metal alloys, ceramic particles, and powder metallurgy materials. It can adaptively adapt to various regular and irregular grain morphologies, effectively resist interference from working conditions such as differences in microscope exposure, different degrees of sample corrosion, and slight surface noise. The robustness of the algorithm is greatly improved, and the applicable scenarios cover the vast majority of metallographic testing scenarios.

[0017] 3. Fully automated batch testing: It replaces tedious operations such as manual scribing and parameter adjustment, and reduces the time for single metallographic field of view testing to less than 1 second, improving testing efficiency by dozens of times. It can quickly output complete particle size distribution curves and statistical reports, completely solving the industry pain points of traditional technology relying on manual labor and being unable to perform batch automated testing, and adapting to the industrial needs of large-scale metallographic sample testing.

[0018] 4. By adopting the preferred dual-branch architecture, adaptive multi-scale fusion and topological constraints, the performance in complex scenarios is further improved: the accuracy of separation of adhesion in polycrystalline intersection areas is increased from 68% in the general model to 91%, the IoU of mixed crystal sample segmentation is increased to 0.92, the oversegmentation rate is reduced to less than 2%, and the particle size statistical deviation is further reduced to less than 2%, making it suitable for detection scenarios with higher precision requirements. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the overall process of the metallographic grain and particle adhesion segmentation and particle size distribution calculation method of Embodiment 1 of the present invention.

[0020] Figure 2 This is a schematic diagram illustrating the upsampling and downsampling process of the instance segmentation deep learning model of the present invention.

[0021] Figure 3 This is a schematic diagram illustrating the calculation and output of metallographic grain and particle adhesion segmentation and particle size distribution of the present invention.

[0022] Figure 4 This is a schematic diagram of the overall process of the metallographic grain and particle adhesion segmentation and particle size distribution calculation method in Embodiment 3 of the present invention. Detailed Implementation

[0023] like Figures 1 to 4 As shown, the method for calculating metallographic grain and particle adhesion segmentation and particle size distribution of the present invention includes the following steps: S1. Image acquisition and preprocessing: Acquire microscopic images of metallographic samples and preprocess the images; S2. Metallographic Adhesion Target Instance Segmentation Inference: The pre-processed image is input into a pre-trained deep learning model for instance segmentation of metallographic adhesion targets, and the output is an instance segmentation mask map of grains and particles; the instance segmentation deep learning model is trained on a special dataset for metallographic image scenes with grain stacking, multiple particle intersections, blurred boundaries, and irregular shapes, and has a built-in multi-scale feature fusion structure to extract layered features for coarse grains, fine particles, and mixed crystal structures. S3. Post-processing of segmentation results: Noise filtering is performed on the instance segmentation mask to obtain independent grain and particle target contours; S4. Automatic Calculation and Output of Particle Size Distribution: Based on the independent profile of each grain and particle, automatically calculate the equivalent circle diameter, area, and circumference parameters, batch statistically analyze the number of grains, particle size distribution, D50 and D90 characteristic particle size data, and output the particle size distribution results.

[0024] In step S1, the preprocessing includes at least one of illumination homogenization correction, median filtering for scratch removal, and adaptive contrast enhancement.

[0025] The multi-scale feature fusion structure extracts feature maps at different scales through multi-level downsampling, and then fuses these multi-scale features through upsampling. This enhances the feature recognition capability for weak boundaries and blurred, contiguous regions, while suppressing interference from erosion pits and surface texture noise. Specifically, downsampling involves reducing the spatial dimensions (width and height) of the feature map while increasing the number of feature channels, such as 2×2 max pooling with a stride of 2. This expands the receptive field and reduces computational cost. Expanding the receptive field involves allowing each convolutional unit to see a larger image area, gradually transitioning from viewing pixel details to viewing the overall shape, thus extracting higher-level semantic features. For example, identifying the overall outline of grains and the distribution of adhesion regions; the compression computation is as follows: the feature map size is halved, the computation is reduced to 1 / 4, and the inference efficiency is improved; during downsampling, the encoder part compresses the 512×512 input image into 256×256, 128×128, 64×64, and 32×32 feature maps through 4 downsampling operations, extracting multi-scale features from grain boundary details to the global grain layer by layer; the upsampling is as follows: enlarging the spatial size of the feature map and restoring the spatial resolution; such as bilinear interpolation and transposed convolution (deconvolution), which can gradually restore the deeply compressed semantic features back to the original. Figure 1The high resolution prepares for the final pixel-level segmentation mask output. During upsampling, the decoder performs four upsampling operations to gradually enlarge the 32×32 deep feature map back to 64×64, 128×128, 256×256, and 512×512. At the same time, it fuses the shallow detail features of the corresponding level through skip connections, and finally outputs the grain instance segmentation result with the same size as the input image. Upsampling and downsampling work together to first determine where the grains are and where the grain boundaries are, and then accurately delineate the boundaries of each grain.

[0026] The instance segmentation deep learning model employs a dual-branch structure of grain boundaries and grains. The grain boundary branch uses an 8-directional anisotropic convolutional kernel to extract multi-directional grain boundary features and constrains grain boundary connectivity through a grain boundary continuity loss function. This grain boundary branch also uses an 8-directional anisotropic convolutional kernel to extract linear grain boundary features in eight directions: 0°, 22.5°, 45°, 67.5°, 90°, 112.5°, 135°, and 157.5°. A grain boundary continuity loss function is used to penalize fractured grain boundaries, thus constraining grain boundary connectivity. The grain branch uses an encoder and decoder structure to extract the main semantic features of the grains. The decoder embeds the grain boundary branch feature map at each level, using grain boundary features to guide the splitting of adhesion region boundaries and improve the splitting accuracy of polycrystalline junction areas.

[0027] The multi-scale feature fusion structure is an adaptive weighted fusion model driven by prior grain size. The specific working process is as follows: First, the shallow prediction network quickly outputs the grain size distribution histogram of the current field of view and counts the proportions of coarse, medium, and fine grains. Then, the fusion weights of each level of feature map are dynamically adjusted according to the size distribution. If the proportion of fine grains is high, the weight of the shallow high-resolution features is increased to enhance the expression of details. If the proportion of coarse grains is high, the weight of the deep large receptive field features is increased to ensure global integrity and adapt to samples with different mixed crystal ratios.

[0028] In step S3, the post-processing of the segmentation results also includes metallographic topological constraint verification: extracting the adjacency relationship and the angle between the three-way grain boundary of each segmentation target, removing pseudo grains with a neighbor number of <3 or >10 and a grain boundary angle deviating from 120° by more than 40°, repairing oversegmentation errors, and reducing the interference of false targets on grain size statistics.

[0029] Step S4 also includes grain size calibration, specifically as follows: the equivalent circle diameter is cross-calibrated using the intercept method, and the grains truncated at the edge of the field of view are weighted statistically corrected according to their area proportion; the intercept method adopts the GB / T6394 standard to cross-calibrate the equivalent circle diameter and correct the grain size statistical deviation caused by irregular grains; at the same time, the grains truncated at the edge of the field of view are weighted statistically corrected according to their area proportion in the field of view to reduce the grain size distribution deviation caused by the edge effect.

[0030] The training dataset of the instance segmentation deep learning model includes metallographic images of carbon steel, aluminum alloy, powder metallurgy particles, and ceramic grains, covering samples with different degrees of adhesion, corrosion, and imaging magnification, ensuring the generalization ability of the instance segmentation deep learning model.

[0031] In step S4, the output particle size distribution result includes at least one of the following: particle size distribution histogram, cumulative distribution curve, grain size rating result, and statistical report.

[0032] Example 1: like Figures 1 to 3 As shown, the method for metallographic grain and particle adhesion segmentation and particle size distribution calculation in this embodiment specifically includes image acquisition and preprocessing, instance segmentation deep learning model inference, segmentation result post-processing, and particle size distribution calculation and output; as detailed below: First, this embodiment uses annealed metallographic samples of No. 45 steel as the test object and adopts an instance segmentation deep learning model. The specific steps are as follows: Sample preparation and image acquisition: The annealed No. 45 steel sample is etched with 4% nitric acid alcohol. Images are acquired using a metallographic microscope with a 5-megapixel industrial camera. The acquisition parameters are: 500x optical magnification, camera resolution 2448×2048, and the actual field of view corresponding to a single image is 0.3mm×0.25mm. The acquired raw images are preprocessed in sequence: illumination homogenization correction, median filtering to remove surface scratches, and contrast adaptive enhancement are performed to improve image quality and then scaled to a resolution of 512×512.

[0033] Secondly, the inference process of the instance segmentation deep learning model involves inputting the preprocessed image into a pre-trained deep learning model specifically for metallographic adhesion targets. The model employs an improved U-Net architecture, featuring a symmetrical encoder and decoder structure with a built-in multi-scale feature fusion module. The encoder uses a four-level downsampling structure, with each level containing two 3×3 convolutional layers, a BatchNorm layer, and a ReLU activation function, followed by a 2×2 max-pooling layer. The decoder uses a four-level upsampling structure, with each level first upsampled by a factor of 2 using bilinear interpolation, and then skipping between the upsampled image and the feature map of the corresponding encoder level. The model is connected and spliced; a multi-scale feature fusion module is set at the bottom layer of the encoder, which uses dilated convolution with different dilation rates to extract features in parallel, and fuses multi-scale receptive field information to capture the global morphology of coarse grains and the detailed features of fine particles at the same time; the model training uses a metallographic adhesion-specific dataset, which includes metallographic images of various materials such as carbon steel, aluminum alloy, powder metallurgy, and ceramics, covering light, medium and heavy adhesion degrees, as well as samples with different corrosion degrees and magnification, with a total sample size of more than 8,000 images; the model inference outputs an instance segmentation mask map for each grain, with a single image inference time of 150ms.

[0034] 3. Post-processing of segmentation results: The minimum grain area threshold is set to 50 pixels. Noise points and false targets with an area less than 50 pixels in the mask image are removed to obtain the complete outline of all independent grains. In this embodiment, a total of 326 valid grains were identified. After manual verification, 301 of the adhesion regions were correctly segmented, and the adhesion segmentation accuracy rate reached 92.3%. 4. Particle size distribution calculation and result output: For each independent grain profile, calculate the equivalent circle diameter, area, major axis and minor axis and other parameters; divide it into 8 particle size grades according to GB / T6394 grain size determination standard, and statistically analyze the quantity distribution and area distribution respectively, generate a particle size distribution histogram and cumulative distribution curve, and automatically calculate characteristic particle sizes such as D5, D16, D50, D75 and D90.

[0035] For grains truncated at the edge of the field of view, a weighted correction is performed based on the area ratio to reduce the statistical bias caused by the edge effect.

[0036] In this embodiment, the calculated average grain size grade is 7.5, the equivalent circle diameter range is 5-25 μm, and the D50 is 10.9 μm. Compared with the results of manual calibration of the gold standard, the grain size grade deviation is within 0.5 grades, and the average grain size error is 2.1%, which meets the accuracy requirements.

[0037] Example 2: This embodiment uses aluminum alloy powder particles as the test object and Example 1 as the test method to test the suitability of the method for granular samples. Specifically, the following steps are taken: 200x optical magnification is used to acquire metallographic images of closely packed aluminum alloy powder, which are then input into the instance segmentation deep learning model of Example 1 for segmentation and particle size statistics. The test results show that for closely packed powder particles, the segmentation IoU of this method reaches 0.94, the particle counting error is 4.2%, the D50 calculation deviation is 2.7%, and the single image detection time is 0.8s, which is far superior to the traditional watershed algorithm's 0.68 IoU and 38% counting error.

[0038] Example 3: like Figure 4 As shown, this embodiment, based on Embodiment 1, employs a grain boundary and grain bi-branch structure, size prior adaptive multi-scale fusion, and topological constraint post-processing structure to test a 45# steel sample with mixed coarse and fine grains, as detailed below: 1. The model adopts a dual-branch structure of grain boundary branching and grain branching, as detailed below: Grain boundary branching: After inputting the image, an 8-directional anisotropic convolution kernel is used instead of ordinary square convolution to extract linear grain boundary features in 8 directions. After fusion, the grain boundary probability map is output. During training, a grain boundary continuity loss function is added to apply a 3x penalty weight to broken grain boundary pixels to enhance the connectivity of grain boundaries. Grain branching: A four-level encoder and decoder structure is adopted. A size prior prediction head is set in the shallow layer of the encoder. The grain size distribution histogram of the current field of view is quickly output through the shallow layer features, and the proportion of coarse grains (diameter > 20μm), medium grains (10-20μm), and fine grains (< 10μm) is statistically analyzed. The fusion weights of the four-level encoder features are dynamically adjusted according to the size distribution. In this embodiment, the proportion of fine grains is about 62%. Therefore, the weights of the shallow features in the first two levels are increased to 1.3 times, and the weights of the deep features in the last two levels are reduced to 0.8 times to enhance the expression of fine grain details. When the decoder upsamples at each level, it embeds the grain boundary feature map of the corresponding level to guide the splitting of the adhesion boundary with the grain boundary features, especially to enhance the boundary recognition of the intersection area of ​​three-way and four-way grain boundaries. 2. Model Training: The training dataset is the same as in Example 1. The total loss function adds a grain boundary continuity loss term to the basic cross-entropy loss and Dice loss, with a weight ratio of: cross-entropy loss: Dice loss: grain boundary continuity loss = 1:1:2; the AdamW optimizer is used with an initial learning rate of 1e-4 and 150 training rounds. 3. Inference and Topological Constraint Post-processing: After the inference outputs the instance segmentation mask map and grain boundary probability map, topological constraint verification is performed: the outline and adjacency relationship of each grain are extracted, the included angle of each three-way grain boundary is calculated, and pseudo-grains with fewer than 3 or more than 10 neighbors and grain boundary angles deviating from 120° by more than 40° are removed. In this embodiment, a total of 412 grains were identified, and 8 over-segmented pseudo-grains that did not conform to the topological rules were removed through topological verification, reducing the over-segmentation rate from 11.2% in the basic model to 1.9%. 4. Intercept Method Particle Size Calibration and Output: The equivalent circle diameter is cross-calibrated using the intercept method specified in GB / T6394 to correct the particle size deviation of irregular grains; combined with edge grain weighted correction, the final particle size distribution result is obtained; the test results show that the IoU of the mixed crystal sample in this embodiment reaches 0.92, the accuracy of the adhesion and separation of polycrystalline intersection areas reaches 91%, and the D50 calculation deviation is 1.7%, which further improves the accuracy compared with Example 1, and there is no need to manually adjust the parameters for the mixed crystal ratio.

[0039] The above embodiments are merely preferred embodiments of the present invention. Therefore, all equivalent changes or modifications made to the structure, features and principles described in the claims of the present invention are included within the scope of the present invention.

Claims

1. A method for calculating the segmentation of metallographic grains and particle adhesion and particle size distribution, characterized in that, Includes the following steps: S1. Image acquisition and preprocessing: Acquire microscopic images of metallographic samples and preprocess the images; S2. Metallographic Adhesion Target Instance Segmentation Inference: The pre-processed image is input into a pre-trained deep learning model for instance segmentation of metallographic adhesion targets, and the output is an instance segmentation mask map of grains and particles; the instance segmentation deep learning model is trained on a special dataset for metallographic image scenes with grain stacking, multiple particle intersections, blurred boundaries, and irregular shapes, and has a built-in multi-scale feature fusion structure to extract layered features for coarse grains, fine particles, and mixed crystal structures. S3. Post-processing of segmentation results: Noise filtering is performed on the instance segmentation mask to obtain independent grain and particle target contours; S4. Automatic Calculation and Output of Particle Size Distribution: Based on the independent profile of each grain and particle, automatically calculate the equivalent circle diameter, area, and circumference parameters, batch statistically analyze the number of grains, particle size distribution, D50 and D90 characteristic particle size data, and output the particle size distribution results.

2. The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution according to claim 1, characterized in that: In step S1, the preprocessing includes at least one of illumination homogenization correction, median filtering for scratch removal, and adaptive contrast enhancement.

3. The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution according to claim 1, characterized in that: The multi-scale feature fusion structure extracts feature maps of different scales through multi-level downsampling, and then fuses multi-scale features through upsampling, thereby enhancing the feature recognition capability of weak boundaries and blurred and sticky regions, and suppressing interference from corrosion pits and surface texture noise.

4. The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution according to claim 1, characterized in that: The instance segmentation deep learning model has a dual-branch structure of grain boundaries and grains. The grain boundary branch uses an 8-directional anisotropic convolution kernel to extract multi-directional grain boundary features and constrains grain boundary connectivity through a grain boundary continuity loss function. The grain branch uses an encoder and decoder structure to extract the main features of the grains. The decoder embeds grain boundary branch features at each level to guide the splitting of the adhesion region boundary with grain boundary features.

5. The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution according to claim 1, characterized in that: The multi-scale feature fusion structure is an adaptive weighted fusion model driven by prior grain size. The specific working process is as follows: First, the shallow prediction network outputs the grain size distribution histogram of the current field of view and counts the proportions of coarse, medium and fine grains; then, the fusion weights of each layer of feature maps are dynamically adjusted according to the size distribution. If the proportion of fine grains is high, the weights of the shallow high-resolution features are increased, and if the proportion of coarse grains is high, the weights of the deep large receptive field features are increased.

6. The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution according to claim 1, characterized in that: In step S3, the post-processing of the segmentation results also includes metallographic topological constraint verification: extracting the adjacency relationship of each segmentation target and the angle between the three-way grain boundary, removing pseudo grains with a neighbor number of <3 or >10 and a grain boundary angle deviation of more than 40° from 120°, and repairing oversegmentation errors.

7. The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution according to claim 1, characterized in that: Step S4 also includes grain size calibration, specifically as follows: the equivalent circle diameter is cross-calibrated using the intercept method, and the grains truncated at the edge of the field of view are weighted and statistically corrected according to their area ratio.

8. The method for calculating metallographic grain and particle adhesion segmentation and particle size distribution according to claim 1, characterized in that: The training dataset of the instance segmentation deep learning model contains metallographic images of carbon steel, aluminum alloy, powder metallurgy particles, and ceramic grains, covering samples with different degrees of adhesion, corrosion, and imaging magnification.

9. The method for calculating metallographic grain and particle adhesion segmentation and grain size distribution according to claim 1, characterized in that: In step S4, the output particle size distribution result includes at least one of the following: particle size distribution histogram, cumulative distribution curve, grain size rating result, and statistical report.

Citation Information

Patent Citations

  • A method for detecting grain size of austenitic stainless steel and its application

    CN115015056B