Laue micro-area diffraction grating scanning segmentation method, device, electronic device and medium based on cluster analysis

Through the Laue micro-region diffraction raster scanning segmentation method based on clustering analysis, the Laue micro-region diffraction raster scanning region is segmented using feature clustering analysis and principal component analysis combined with hierarchical polymerization clustering algorithm, which solves the complex and time-consuming problem of segmentation process in the existing technology, and realizes a rapid analysis of the grain morphology of the sample surface.

CN119295757BActive Publication Date: 2025-04-08MVT GRP MULTIANGLE VIRTUAL TECH GRP INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411834710.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-08
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

In the prior art, the Laue micro-diffraction raster scanning segmentation process is complicated and time-consuming, making it difficult to quickly analyze the grain morphology of the sample surface.

Method used

The clustering analysis method is used to extract the feature vectors of the Laue diffraction pattern through feature clustering analysis and principal component analysis, and combine the hierarchical polymerization clustering algorithm to segment the raster scanning area to achieve rapid classification of the same grain.

Benefits of technology

The segmentation is done without parsing the Lauue diffraction pattern of each scanning grid point, which meets the need for rapid analysis of the scanning area, and determines the clustering and merging threshold through K-S detection to achieve rapid classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295757B_ABST
    Figure CN119295757B_ABST
Patent Text Reader

Abstract

The present invention provides a Laue micro-area diffraction grating scanning segmentation method, device, electronic device and medium based on cluster analysis, the method comprising: using feature cluster analysis and principal component analysis to extract the feature vector of the Laue diffraction pattern of each scanning grid point; using a clustering algorithm to segment the grid scanning area according to the feature vector of the Laue diffraction pattern. The method can segment the grid scanning area without analyzing the Laue diffraction pattern of each scanning grid point, and each segmented sub-area corresponds to the same grain, meeting the need for rapid grain morphology analysis of the scanning area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of measurement technology, and relates to a Laue micro-area diffraction grating scanning segmentation method, and in particular to a Laue micro-area diffraction grating scanning segmentation method, device, electronic equipment and medium based on cluster analysis. Background Art

[0002] Laue micro-area diffraction is a diffraction technique named after German physicist Max von Laue. It is an important method for studying polycrystalline materials. Its basic principle is that high-energy X-rays are converged and shot into the sample surface. After complex interactions with the atoms that make up the sample, some X-rays eventually shoot out of the sample surface, and the angle of their emission and the spacing between the sample crystal planes conform to the Bragg diffraction equation, thus forming characteristic Laue diffraction spots on the surface detector, also known as Laue diffraction patterns. High-energy X-rays are raster-scanned on the sample surface to obtain a set of Laue diffraction patterns, each of which corresponds to a micro-area. The Laue diffraction patterns produced by the same grain on the sample surface have similar shapes.

[0003] The formation of Laue diffraction pattern is highly related to grain orientation, geometric parameters of diffraction device, and incident X-ray energy. Therefore, the process of reversely solving grain orientation and geometric parameters of diffraction device from Laue diffraction pattern is relatively complicated and time-consuming. Summary of the invention

[0004] In order to solve the technical problems existing in the prior art, the present invention provides a Laue micro-area diffraction grating scanning segmentation method, device, electronic device and medium based on cluster analysis. This method can segment the grid scanning area without analyzing the Laue diffraction pattern of each scanning grid point. Each sub-area after segmentation corresponds to the same grain, meeting the need for rapid analysis of the grain morphology in the scanning area.

[0005] In order to achieve the above technical effects, the present invention adopts the following technical solutions:

[0006] One of the purposes of the present invention is to provide a Laue micro-area diffraction grating scanning segmentation method based on cluster analysis, the method comprising:

[0007] Feature cluster analysis and principal component analysis are used to extract the feature vector of the Laue diffraction pattern at each scanning grid point;

[0008] A clustering algorithm is used to segment the raster scanning area according to the characteristic vectors of the Laue diffraction pattern.

[0009] As a preferred technical solution of the present invention, the Laue diffraction pattern is compressed before principal component analysis.

[0010] As a preferred technical solution of the present invention, the clustering algorithm includes a hierarchical aggregation clustering algorithm.

[0011] As a preferred technical solution of the present invention, the steps of the hierarchical aggregation clustering algorithm include:

[0012] Treat each feature vector as a separate cluster;

[0013] Perform iterative operations to merge the clusters with the closest distance;

[0014] The merging is repeated until the number of remaining clusters reaches a pre-specified number or the difference between different clusters is greater than a pre-specified merging threshold.

[0015] As a preferred technical solution of the present invention, the distance is a connectivity constraint, and the connectivity constraint includes any one of single link, complete link, average link or Ward method (proposed by Joe H. Ward in 1963).

[0016] As a preferred technical solution of the present invention, the merging is realized by the AgglomerativeClustering function of the sklearn library. The sklearn library is a software machine learning library of the Python programming language; the AgglomerativeClustering function is a function belonging to the sklearn library for a hierarchical aggregation clustering algorithm.

[0017] As a preferred technical solution of the present invention, the method for determining the clustering merging threshold of the AgglomerativeClustering function of the sklearn library includes:

[0018] Enter a cluster merging threshold and use the hierarchical aggregation clustering algorithm to segment the raster scanning area;

[0019] The distribution of the areas of all segmented regions is fitted with a log-normal distribution function;

[0020] Plot the cumulative distribution curve of the fitting results and the cumulative distribution curve of the actual area distribution, and calculate the maximum difference between the two curves, which is defined as the KS distance;

[0021] Enter a new cluster merging threshold, repeat the above steps to get a new KS distance, and select the cluster merging threshold with the smallest KS distance as the cluster merging threshold of the AgglomerativeClustering function.

[0022] The second object of the present invention is to provide a Laue micro-area diffraction grating scanning and segmentation device based on cluster analysis, the device comprising:

[0023] A feature vector extraction module, used to extract the feature vector of the Laue diffraction pattern of each scanning grid point through feature cluster analysis and principal component analysis;

[0024] The segmentation module is used to segment the grid scanning area according to the characteristic vector of the Laue diffraction pattern through a clustering algorithm.

[0025] A third object of the present invention is to provide an electronic device, the electronic device comprising:

[0026] at least one processor and a memory communicatively coupled to the at least one processor;

[0027] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the Laue micro-area diffraction grating scanning segmentation method based on clustering analysis provided by one of the purposes of the present invention.

[0028] A fourth object of the present invention is to provide a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a processor to implement the Laue micro-area diffraction grating scanning and segmentation method based on cluster analysis provided by one of the objects of the present invention when executed.

[0029] Compared with the prior art, the present invention has at least the following beneficial effects:

[0030] (1) The present invention provides a Laue micro-area diffraction grating scanning segmentation method based on cluster analysis. The method can classify scanning grid points without analyzing the diffraction pattern of each scanning grid point, and meets the requirement of continuous distribution of scanning grid points of the same type in space;

[0031] (2) The present invention provides a Laue micro-area diffraction grating scanning segmentation method based on cluster analysis. The method determines the cluster merging threshold through KS detection, and the result can meet the demand for rapid classification of the diffraction pattern of the scanning area. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 is the original image of Laue micro-area diffraction in Example 1 of the present invention;

[0033] Figure 2 The image is a compressed image of the original image of Laue micro-area diffraction in Example 1 of the present invention;

[0034] Figure 3 The pixel feature clustering result distribution in Example 1 of the present invention;

[0035] Figure 4 The image after pixel feature clustering processing in Example 1 of the present invention;

[0036] Figure 5 The result after performing principal component analysis on the pixel features in Example 1 of the present invention and sorting all principal components by variance;

[0037] Figure 6 The KS distance distribution diagram obtained by different cluster merging thresholds in Example 1 of the present invention;

[0038] Figure 7 It is a comparison diagram of the probability distribution of the areas of all segmented regions at the minimum KS distance in Example 1 of the present invention and the fitted log-normal distribution curve;

[0039] Figure 8 This is a scan area segmentation result diagram at the minimum KS distance in Example 1 of the present invention;

[0040] Fig. 9 This is a diagram of the scan area segmentation result at a larger KS distance in Example 1 of the present invention.

[0041] The present invention is further described in detail below. However, the following examples are only simplified examples of the present invention and do not represent or limit the scope of protection of the present invention. The scope of protection of the present invention shall be subject to the claims. DETAILED DESCRIPTION

[0042] The technical solution of the present invention is further described below through specific implementation methods.

[0043] The specific embodiment of the present invention provides a Laue micro-area diffraction grating scanning segmentation method based on cluster analysis, the method comprising:

[0044] Feature cluster analysis and principal component analysis are used to extract the feature vector of the Laue diffraction pattern at each scanning grid point;

[0045] A clustering algorithm is used to segment the raster scanning area according to the characteristic vectors of the Laue diffraction pattern.

[0046] In the present invention, since the size of a single Laue diffraction pattern is too large and contains too much image noise, it is not suitable for direct use in the image segmentation algorithm. Therefore, after merging the pixel features through feature clustering analysis, the feature vectors of all diffraction patterns are subjected to principal component analysis, and the main components are retained and the smaller components are discarded to reduce the data dimension. After the raster scanning area is segmented using the clustering algorithm, the feature vectors in the same segmented area have a high degree of similarity and can be regarded as being generated from the same grain.

[0047] In a specific embodiment of the present invention, the Laue diffraction pattern is compressed before principal component analysis. Since principal component analysis involves the calculation of singular value decomposition of the matrix, directly performing principal component analysis on all data will result in a large amount of calculation. Data compression is performed in two steps. The first step is an average pooling operation. As an example, for a diffraction pattern of 1024×1024 pixels, a 2×2 average pooling operation is performed on the image before principal component analysis to compress the image into 512×512 pixels. The grayscale value of the compressed pixel is the average of the grayscale values ​​of the original 2×2 pixels; the second step is to merge pixel features using a hierarchical agglomerative clustering (HAC) algorithm. The basic idea is to regard the grayscale value of the i-th pixel of all images as a feature vector. If the vector composed of the grayscale values ​​of the i-th pixel of all images and the vector composed of the grayscale values ​​of the j-th pixel of all images are relatively "similar" (the degree of similarity is obtained by calculating the vector angle), the grayscale values ​​of the i-th pixel and the j-th pixel can be merged.

[0048] The hierarchical agglomerative clustering algorithm builds a hierarchical clustering tree by gradually merging data features.

[0049] In a specific embodiment of the present invention, the steps of the hierarchical aggregation clustering algorithm include:

[0050] Treat each feature vector as a separate cluster;

[0051] Perform iterative operations to merge the clusters with the closest distance;

[0052] The merging is repeated until the number of remaining clusters reaches a pre-specified number or the difference between different clusters is greater than a pre-specified merging threshold.

[0053] In a specific implementation of the present invention, the distance is a connectivity constraint, and the connectivity constraint includes any one of single link, complete link, average link, or Ward's method (proposed by Joe H. Ward in 1963). Only interconnected scan grid points that meet the connectivity constraint can be merged.

[0054] In a specific implementation of the present invention, feature merging is implemented by the FeatureAgglomeration function of the sklearn library.

[0055] In a specific embodiment of the present invention, principal component analysis is implemented by the principal component analysis function (PCA) of the open source machine learning library sklearn. The goal of PCA is to find a new feature set that is a linear combination of the original features, and the new features are mutually orthogonal, so that the variance of the data is maximized. When processing high-dimensional data, PCA can help us identify and extract the most meaningful features, thereby building a more effective machine learning model. PCA is implemented by converting the data into a new coordinate system through an orthogonal transformation, so that the first largest variance of any projection of the data is on the first coordinate (called the first principal component), the second largest variance is on the second coordinate, and so on, and then the data dimension reduction is achieved by discarding the coordinates with smaller variances.

[0056] In a specific embodiment of the present invention, the clustering algorithm for scanning grid merging uses the hierarchical aggregation clustering algorithm mentioned above again. The difference is that the hierarchical aggregation clustering algorithm used above is to merge the pixel features of the image, and the FeatureAgglomeration function of the sklearn library needs to be called. Now, in order to merge the scanning grids, the AgglomerativeClustering function of the sklearn library needs to be called. Since a single crystal is continuous in space, the scanning grids divided into the same grain also need to be continuous, and the hierarchical aggregation clustering algorithm can meet this requirement.

[0057] In a specific embodiment of the present invention, the AgglomerativeClustering function of the sklearn library needs to input the clustering merging threshold when calculating. If the merging threshold is too low, the segmentation will be too fragmented, and the scanning grid points belonging to the same grain may be classified as different grains due to the slight difference in the diffraction image. If the merging threshold is too high, the classification will be too rough, and the scanning grid points belonging to different grains may be classified as the same grain.

[0058] In a specific embodiment of the present invention, in actual metal materials, the grain size distribution conforms to the log-normal distribution, so the Kolmogorov-Smirnov (KS) test can be used to test the conformity of the classification results to the log-normal distribution to determine the optimal merging threshold of the AgglomerativeClustering function of the sklearn library.

[0059] In a specific embodiment of the present invention, the method for determining the merging threshold of the AgglomerativeClustering function of the sklearn library includes:

[0060] Enter a merge threshold and use the hierarchical aggregation clustering algorithm to segment the raster scan area;

[0061] The distribution of the areas of all segmented regions is fitted with a log-normal distribution function;

[0062] Draw the cumulative distribution curve of the fitting results and the cumulative distribution curve of the actual area distribution, and calculate the maximum difference between the two curves, which is defined as the KS distance. The smaller the KS distance, the more the area distribution conforms to the lognormal distribution;

[0063] Enter a new merge threshold, repeat the above steps to get a new KS distance, and select the merge threshold with the smallest KS distance as the merge threshold of the sklearn library function AgglomerativeClustering.

[0064] The specific embodiment of the present invention provides a Laue micro-area diffraction grating scanning and segmentation device based on cluster analysis, and the device comprises:

[0065] A feature vector extraction module, used to extract the feature vector of the Laue diffraction pattern of each scanning grid point through principal component analysis;

[0066] The segmentation module is used to segment the grid scanning area according to the characteristic vector of the Laue diffraction pattern through a clustering algorithm.

[0067] A specific embodiment of the present invention provides an electronic device, the electronic device comprising:

[0068] at least one processor and a memory communicatively coupled to the at least one processor;

[0069] The memory stores a computer program executable by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the Laue micro-area diffraction grating scanning segmentation method based on cluster analysis provided in the specific embodiment of the present invention.

[0070] A specific embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions. The computer instructions are used to enable a processor to implement the Laue micro-area diffraction grating scanning segmentation method based on cluster analysis provided by the specific embodiment of the present invention when executed.

[0071] To better illustrate the present invention and facilitate understanding of the technical solution of the present invention, typical but non-limiting embodiments of the present invention are as follows:

[0072] Example 1

[0073] This embodiment provides a Laue micro-area diffraction grating scanning segmentation method based on cluster analysis, the method comprising:

[0074] The original image of Laue micro-area diffraction is as follows Figure 1 As shown, the pixel size of the image is 1024×1024. Average pooling is performed on the image to compress the original image to 512×512 pixels, as shown in Figure 2 As shown. The compressed image pixels are further merged with features (hierarchical aggregation clustering algorithm). Figure 3 An example of pixel feature merging is given. The number of pixels in the original image is 512×512. The grayscale value of the i-th pixel of all images is regarded as a feature vector. By merging "similar" pixel feature vectors (the degree of similarity can be measured by the angle between vectors), the original 512×512 features are successfully merged into 4096 features (4096 is a pre-specified number). Figure 3 The colors in the graph reflect the number of each feature (from 1 to 4096). Figure 4 Given Figure 2 After the features are merged, the two images have a high degree of similarity.

[0075] Pixel feature merging is implemented through the FeatureAgglomeration function of the sklearn library, and the connectivity constraint of the merging is the Ward method. The Ward method was proposed by Joe H. Ward in 1963, and the core idea is to minimize the variance within the cluster.

[0076] Principal component analysis is performed on the compressed image to extract the characteristic vector of the Laue diffraction pattern of each scanning grid point.

[0077] The principal component analysis method is to call the PCA function of the sklearn library and implement data compression by specifying the number of principal components n_components to be retained. The result is Figure 5 As shown in Figure 2, when the principal components are sorted from high to low in terms of variance, starting from the 60th principal component, the variance no longer decreases significantly and can be ignored in the analysis.

[0078] The raster scan area is segmented according to the feature vectors of the Laue diffraction pattern using a hierarchical agglomerative clustering algorithm.

[0079] The steps of the hierarchical agglomerative clustering algorithm include:

[0080] Treat each feature vector as a separate cluster;

[0081] Perform iterative operations to merge the clusters with the closest distance;

[0082] The merging is repeated until the differences between the remaining clusters are greater than a pre-specified merging threshold.

[0083] The merging is implemented through the AgglomerativeClustering function of the sklearn library, and the connectivity constraint of the merging is the Ward method. The Ward method was proposed by Joe H. Ward in 1963, and the core idea is to minimize the variance within the cluster.

[0084] The merging threshold of the AgglomerativeClustering function of the sklearn library is determined by the following method:

[0085] Enter a cluster merging threshold and use the above-mentioned hierarchical aggregation clustering algorithm to segment the raster scanning area;

[0086] The distribution of the areas of all segmented regions is fitted with a log-normal distribution function;

[0087] Plot the cumulative distribution curve of the fitting results and the cumulative distribution curve of the actual area distribution, and calculate the maximum difference between the two curves, which is defined as the KS distance;

[0088] Enter a new cluster merging threshold, repeat the above steps to get a new KS distance, and select the cluster merging threshold with the smallest KS distance as the merging threshold of the AgglomerativeClustering function.

[0089] The KS distances obtained with different cluster merging thresholds are as follows: Figure 6 As shown in the figure, the minimum KS distance is selected, and the probability distribution of the area of ​​all segmented regions is compared with the fitted log-normal distribution curve. Figure 7 The scan area segmentation result based on the minimum KS distance is shown in Figure 8 As shown. If a relatively large KS distance is selected for scanning area segmentation ( Figure 6 The leftmost data point in the Fig. 9 As shown. Figure 8 and Fig. 9 It can be seen from the comparison that when the merging threshold is too small, there are a large number of unmerged regions. From the perspective of KS distance, the area distribution of these regions seriously deviates from the log-normal distribution, which does not conform to the empirical law that the grain size in metal materials obeys the log-normal distribution.

[0090] Example 2

[0091] The present invention provides a Laue micro-area diffraction grating scanning segmentation device based on cluster analysis, which is used to perform the Laue micro-area diffraction grating scanning segmentation method of cluster analysis provided in Example 1, and specifically includes:

[0092] A feature vector extraction module, used to extract the feature vector of the Laue diffraction pattern of each scanning grid point through principal component analysis;

[0093] The segmentation module is used to segment the grid scanning area according to the characteristic vector of the Laue diffraction pattern through a clustering algorithm.

[0094] The present invention illustrates the detailed structural features of the present invention through the above embodiments, but the present invention is not limited to the above detailed structural features, that is, it does not mean that the present invention must rely on the above detailed structural features to be implemented. Those skilled in the art should understand that any improvement of the present invention, equivalent replacement of the components selected by the present invention, addition of auxiliary components, selection of specific methods, etc., all fall within the protection scope and disclosure scope of the present invention.

[0095] The preferred embodiments of the present invention are described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the technical concept of the present invention, a variety of simple modifications can be made to the technical solution of the present invention, and these simple modifications all belong to the protection scope of the present invention.

[0096] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.

[0097] In addition, various embodiments of the present invention may be arbitrarily combined, and as long as they do not violate the concept of the present invention, they should also be regarded as the contents disclosed by the present invention.

Claims

1. A Laue micro-area diffraction grating scanning segmentation method based on cluster analysis, characterized in that: The method comprises: The Laue diffraction pattern is compressed: the first step is the average pooling operation, and the second step is to merge the pixel features using the hierarchical aggregation clustering algorithm; Principal component analysis was used to extract the characteristic vector of the Laue diffraction pattern at each scanning grid point; Using a clustering algorithm, segmenting the grid scanning area according to the characteristic vector of the Laue diffraction pattern; The clustering algorithm includes a hierarchical aggregation clustering algorithm; The steps of the hierarchical aggregation clustering algorithm include: Treat each of the feature vectors as a separate cluster; Performing iterative operations to merge the clusters with the closest distances; The merging is repeated until the number of remaining clusters reaches a pre-specified number or the difference between different clusters is greater than a pre-specified merging threshold.

2. The Laue micro-area diffraction grating scanning segmentation method according to claim 1, characterized in that: The distance is a connectivity constraint, and the connectivity constraint includes any one of single linkage, complete linkage, average linkage or Ward's method.

3. The Laue micro-area diffraction grating scanning segmentation method according to claim 1, characterized in that: The merging is achieved by the AgglomerativeClustering function of the sklearn library.

4. The method according to claim 3, characterized in that The method for determining the cluster merging threshold of the AgglomerativeClustering function includes: Enter a cluster merging threshold and use the hierarchical aggregation clustering algorithm to segment the raster scanning area; The distribution of the areas of all segmented regions is fitted with a log-normal distribution function; Plotting a cumulative distribution curve of the fitting result and a cumulative distribution curve of the actual area distribution, and calculating the maximum difference between the two curves, which is defined as the KS distance; Enter a new cluster merging threshold, repeat the above steps to get a new KS distance, and select the cluster merging threshold with the smallest KS distance as the cluster merging threshold of the AgglomerativeClustering function of the sklearn library.

5. A Laue micro-area diffraction grating scanning and segmentation device based on cluster analysis, characterized in that: The device comprises: The feature vector extraction module is used to compress the Laue diffraction pattern: the first step is the average pooling operation, and the second step is to merge the pixel features using the hierarchical aggregation clustering algorithm; principal component analysis is used to extract the feature vector of the Laue diffraction pattern of each scanning grid point; A segmentation module, used for segmenting the grid scanning area according to the characteristic vector of the Laue diffraction pattern by a clustering algorithm; The clustering algorithm includes a hierarchical aggregation clustering algorithm; The steps of the hierarchical aggregation clustering algorithm include: Treat each of the feature vectors as a separate cluster; Performing iterative operations to merge the clusters with the closest distances; The merging is repeated until the number of remaining clusters reaches a pre-specified number or the difference between different clusters is greater than a pre-specified merging threshold.

6. An electronic device, characterized in that: The electronic device comprises: at least one processor and a memory communicatively coupled to the at least one processor; Wherein, the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the Laue micro-area diffraction grating scanning segmentation method based on clustering analysis as described in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the Laue micro-area diffraction grating scanning segmentation method based on cluster analysis as described in any one of claims 1 to 4 when executed.

Citation Information

Patent Citations

  • Ancient building culture information extraction method and system based on clustering algorithm

    CN119091042A

  • X-ray imaging system

    CN1860997A