Image clustering method, device, apparatus and storage medium

By compressing images in high-resolution images and combining dynamic selection of graph clustering and spatial clustering algorithms, the problems of high computational cost and low accuracy in high-resolution image clustering are solved, achieving efficient and accurate defect block clustering and improving the efficiency and reliability of industrial parts inspection.

CN120563870BActive Publication Date: 2026-05-12GUANGZHOU ZHONGKE FEICE TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGZHOU ZHONGKE FEICE TECHNOLOGY CO LTD
Filing Date
2025-05-20
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing defect clustering methods are computationally intensive and inefficient in high-resolution image processing. Furthermore, density-based machine learning clustering methods rely on complex prior parameter settings, making them difficult to adapt to the diversity and uncertainty of defect blocks.

Method used

By acquiring preset clustering parameters and pixel information of the workpiece image, if the target cluster radius is smaller than the initial cluster radius, the image is compressed to the size indicated by the initial cluster radius. Initial clustering is performed using a graph clustering algorithm. Subsequently, a spatial clustering algorithm is dynamically selected based on the number of pixels in the clusters for multiple iterations until the preset stopping condition is met.

Benefits of technology

It significantly improves the efficiency and accuracy of image clustering, and can adaptively perform high-precision clustering of defect blocks of different sizes and shapes, thereby improving the efficiency and reliability of surface quality inspection of industrial parts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120563870B_ABST
    Figure CN120563870B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an image clustering method, which is used for realizing high-precision clustering and reducing clustering time. The method comprises the following steps: obtaining preset clustering parameters including a target clustering radius and a starting clustering radius, and pixel point information of each defect block in each original workpiece image; if the target clustering radius is smaller than the starting clustering radius, determining that the original workpiece image is larger than an image size indicated by the starting clustering radius, and compressing the original workpiece image to the image size indicated by the starting clustering radius; performing preliminary clustering processing on the pixel points of each defect block in each compressed workpiece image by using a spatial clustering algorithm to obtain at least one clustering cluster; for each obtained clustering cluster, determining a spatial clustering algorithm corresponding to the clustering cluster based on the number of pixel points of the clustering cluster, and performing multiple clustering iterations on the clustering cluster until a preset stop condition is met, and outputting the obtained multiple clustering clusters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image detection technology, specifically to image clustering methods, apparatus, devices, and storage media. Background Technology

[0002] The surface quality of industrial components directly affects the yield and reliability of assembled products. With the continuous upgrading of workpiece manufacturing processes, the accuracy requirements for defect detection are also constantly increasing. Currently, high-resolution machine vision technology is commonly used to image the surface of components to identify microscopic defects such as impurities, scratches, and particles. Detected defects are then clustered and classified to determine the defect type, analyze its causes, and optimize production processes. At higher imaging resolutions, the amount of defect data detected for industrial components of the same size increases exponentially, significantly increasing the burden on subsequent data processing.

[0003] However, existing defect clustering methods still have certain limitations: for example, graph clustering algorithms are computationally intensive and have low processing efficiency when dealing with high-resolution images; density-based machine learning clustering methods, such as Gaussian mixture models, rely on complex prior parameter settings and are difficult to adapt to the diversity and uncertainty of defect blocks. Summary of the Invention

[0004] Based on the above problems, embodiments of this application provide an image clustering method, apparatus, device, and storage medium, with the aim of significantly reducing clustering time and improving the clustering efficiency of high-precision images while ensuring high clustering accuracy.

[0005] In a first aspect, embodiments of this application provide an image clustering method, including:

[0006] Obtain preset clustering parameters and pixel information of each defect block in each original workpiece image; the preset clustering parameters include a target clustering radius and an initial clustering radius; the target clustering radius is determined based on the image size of the original workpiece image; the initial clustering radius is used to indicate the clustering accuracy or image size that the workpiece image needs to meet when using a graph clustering algorithm;

[0007] If the target cluster radius is smaller than the initial cluster radius, then the original workpiece image is determined to be larger than the image size indicated by the initial cluster radius, and the original workpiece image is compressed to the image size indicated by the initial cluster radius;

[0008] A spatial clustering algorithm is used to perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image to obtain at least one cluster; wherein, the spatial clustering algorithm includes at least a graph clustering algorithm;

[0009] For each obtained cluster, based on the number of pixels in the cluster, determine the spatial clustering algorithm corresponding to the cluster and perform multiple clustering iterations on the cluster until a preset stopping condition is met, and output the multiple obtained clusters.

[0010] In one embodiment, the spatial clustering algorithm further includes a distance clustering algorithm; the step of using the spatial clustering algorithm to perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image to obtain at least one cluster includes:

[0011] The graph clustering algorithm is used to cluster the pixels of each defect block in each compressed workpiece image to obtain at least one cluster after graph clustering.

[0012] For at least one cluster after graph clustering, a distance clustering algorithm is used to cluster the clusters whose total number of pixels is less than a first pixel number threshold, thus obtaining at least one cluster after distance clustering.

[0013] In one embodiment, for each obtained cluster, based on the number of pixels in the cluster, determining the spatial clustering algorithm corresponding to the cluster and performing multiple clustering iterations on the cluster until a preset stopping condition is met, and outputting the obtained multiple clusters, includes:

[0014] For each of the obtained clusters, if the number of pixels in the cluster is less than the second pixel number threshold, then the cluster is clustered using a distance clustering algorithm to obtain the cluster after this clustering process.

[0015] If the number of pixels in the cluster is greater than the second pixel number threshold, then based on the pixel information of each defect block, the local area of ​​the target defect block corresponding to the pixel in the cluster is determined and magnified in the original workpiece image.

[0016] The graph clustering algorithm is used to cluster the magnified projected local image to obtain the clusters after this clustering process;

[0017] Determine whether the current clustering process meets the preset stopping condition. If the current clustering process meets the preset stopping condition, stop the clustering iteration and output the multiple clusters that have been obtained.

[0018] In one embodiment, determining and magnifying the local image of the target defect block corresponding to the pixels within the cluster in the original workpiece image based on the pixel information of each defect block includes:

[0019] Based on the pixel information of each defect block, determine the position coordinates of the target defect block corresponding to the pixel in the cluster in the original workpiece image, as well as the actual physical size of the target defect block;

[0020] Based on the position coordinates of the target defect block in the original workpiece image, determine the local region of the target defect block in the original workpiece image;

[0021] Calculate the target magnification size of the local region based on the actual physical size of the target defect block and the current cluster radius;

[0022] Based on the target magnification size, the local area is projected to obtain a magnified local image.

[0023] In one embodiment, determining and magnifying the local image of the defect block corresponding to the pixel point within the cluster in the original workpiece image based on the pixel point information of each defect block includes:

[0024] Based on the pixel information of each defect block, determine the position coordinates of the target defect block corresponding to the pixel in the cluster in the original workpiece image, as well as the actual physical size of the target defect block;

[0025] Based on the position coordinates of the target defect block in the original workpiece image, determine the local region of the target defect block in the original workpiece image;

[0026] The target magnification size of the local region is calculated based on the size of the local region of the target defect block in the compressed workpiece image, and the ratio between the clustering accuracy corresponding to the compressed workpiece image and the clustering accuracy corresponding to the current clustering radius.

[0027] Based on the target magnification size, the local area is projected to obtain a magnified local image.

[0028] In one embodiment, the preset stopping condition includes one of the following: the current cluster radius is smaller than the target cluster radius; the clustering time is greater than the clustering timeout threshold; the total number of defective blocks in a single cluster is greater than the defective block count threshold; the number of pixels in a single cluster is greater than the third pixel count threshold.

[0029] In one embodiment, after re-executing the steps of determining the target clustering algorithm corresponding to each existing cluster based on the number of pixels in the cluster, and performing secondary clustering processing on the cluster using the target clustering algorithm, until a preset stopping condition is met and the obtained multiple clusters are output, the method further includes:

[0030] Output the number of defective blocks in each cluster and the number of pixels in each defective block.

[0031] Secondly, embodiments of this application also provide an image clustering apparatus, comprising:

[0032] The acquisition unit is used to acquire preset clustering parameters and pixel information of each defect block in each original workpiece image; the preset clustering parameters include a target clustering radius and a starting clustering radius; the target clustering radius is determined based on the image size of the original workpiece image; the starting clustering radius is used to indicate the clustering accuracy or image size that the workpiece image needs to meet when using a graph clustering algorithm;

[0033] An image processing unit is configured to determine that the original workpiece image is larger than the image size indicated by the initial cluster radius if the target cluster radius is smaller than the initial cluster radius, and to compress the original workpiece image to the image size indicated by the initial cluster radius;

[0034] A clustering unit is used to perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image using a spatial clustering algorithm to obtain at least one cluster; wherein, the spatial clustering algorithm includes at least a graph clustering algorithm;

[0035] The clustering unit is further configured to, for each obtained cluster, determine the spatial clustering algorithm corresponding to the cluster based on the number of pixels in the cluster and perform multiple clustering iterations on the cluster until a preset stopping condition is met, and output the multiple obtained clusters.

[0036] Thirdly, embodiments of this application also provide a computer device, including:

[0037] Central processing unit, memory, input / output interfaces;

[0038] The memory is either a short-term storage memory or a persistent storage memory;

[0039] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform any of the image clustering methods described above.

[0040] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it performs any of the image clustering methods described above.

[0041] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0042] This application embodiment obtains preset clustering parameters (including target clustering radius and initial clustering radius) and pixel information of each defect block in each workpiece image. When the target clustering radius is determined to be smaller than the initial clustering radius, the original workpiece image is compressed to a specified image size, thereby reducing the computational burden of high-resolution images in clustering processing and improving the overall processing efficiency of image clustering. Subsequently, spatial clustering algorithms, including graph clustering algorithms, are used to perform preliminary clustering processing on the compressed workpiece image, which can quickly and effectively discover potential defects while reducing the amount of data. Based on the number of pixels in each cluster after preliminary clustering, an appropriate spatial clustering algorithm is dynamically selected, and multiple rounds of iterative clustering are performed until a preset stopping condition is met, ultimately achieving adaptive high-precision clustering of defect blocks of different sizes and shapes. Through the above processing, the accuracy and robustness of defect identification in image clustering are significantly improved, while the overall efficiency and reliability of workpiece defect detection are enhanced, providing high-quality data support for industrial component surface quality control and production process optimization, especially suitable for industrial surface defect analysis scenarios with large-scale, high-density defect data. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0044] Figure 1 This is a schematic diagram of an image clustering method provided in an embodiment of this application;

[0045] Figure 2 A schematic diagram of a workpiece image provided in an embodiment of this application;

[0046] Figure 3 This is a schematic diagram of another image clustering method provided in an embodiment of this application;

[0047] Figure 4 This is a schematic diagram of an image clustering device provided in an embodiment of this application;

[0048] Figure 5 This is a schematic diagram of a computer device structure provided in an embodiment of this application. Detailed Implementation

[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0050] The surface quality of industrial components directly affects the yield and reliability of assembled products. With the continuous upgrading of industrial manufacturing technology, the accuracy requirements for defect detection in industrial components are also constantly increasing. Currently, high-resolution machine vision technology is commonly used to image the surface of components to identify microscopic defects such as impurities, scratches, and particles. Detected defects are then clustered and classified to determine the defect type, analyze its causes, and optimize production processes. At higher imaging resolutions, the amount of defect data detected for industrial components of the same size increases exponentially, significantly increasing the burden on subsequent data processing.

[0051] However, existing defect clustering methods still have certain limitations. For example, clustering based on image connected components is time-consuming and inefficient when dealing with high-resolution images. Density-based machine learning clustering methods, such as Gaussian mixture models, rely on complex prior parameter settings. Among them, clustering methods such as K-Means and bi-KMeans require the number of defects to be classified in advance, which is not suitable for clustering with an unknown number of defect types and is difficult to adapt to the diversity and uncertainty of defect blocks.

[0052] Based on the above scheme, in various embodiments of this application, a preliminary coarse clustering is first performed on the workpiece image using a graph clustering algorithm. This fully utilizes the algorithm's insensitivity to the number of defects, enabling efficient completion of the first round of clustering operations even in scenarios with a large number of defects but low clustering accuracy requirements, thereby quickly obtaining the clusters after the preliminary coarse clustering. On this basis, the corresponding spatial clustering algorithm is dynamically determined according to the number of pixels in each cluster after the preliminary coarse clustering, and multiple clustering iterations are performed on each cluster, ultimately outputting multiple cluster results that meet the clustering accuracy requirements corresponding to the target clustering radius.

[0053] The various embodiments of this application will now be described in further detail with reference to the accompanying drawings.

[0054] This application provides an image clustering method, such as... Figure 1 As shown, the method includes steps S101-S104.

[0055] S101: Obtain the preset clustering parameters and the pixel information of each defect block in each original workpiece image;

[0056] Here, the workpiece image can be referenced. Figure 2 The actual workpiece corresponding to this image is a wafer-like surface structure. Figure 2 The structure contains multiple small dot-like or line-like structures, representing multiple defect blocks or suspected defect areas detected and identified by the defect detection algorithm.

[0057] Image processing or a pre-defined defect detection algorithm (such as Canny edge detection algorithm, Sobel / Laplacian gradient detection algorithm, binarization + connected component analysis detection algorithm, etc.) is used to identify a set of pixels corresponding to each defect block in the workpiece image, thus obtaining the pixel information of each defect block. Specifically, the pixel information of each defect block may include the coordinates of the pixels located on the edge contour of the defect block, the coordinate set of all pixels inside the defect block excluding the edge contour, the gray value of each pixel or the value in other image channels, and the actual physical coordinates corresponding to each pixel.

[0058] Furthermore, image clustering requires obtaining preset clustering parameters. These parameters include a target clustering radius and a starting clustering radius. The target clustering radius indicates the final clustering accuracy to be achieved, i.e., the minimum clustering radius required when clustering the workpiece image. The target clustering radius is determined based on the image size of the original workpiece image and is related to the image resolution. Due to factors such as the performance of the imaging equipment, there is an upper limit to the image resolution. Therefore, in practical applications, the target clustering radius can be set to 0.1 or 0.2. The specific value can be flexibly set according to the actual workpiece characteristics and imaging equipment conditions. This application embodiment does not impose any restrictions on this.

[0059] The initial clustering radius indicates the required clustering accuracy or image size for a workpiece image when using a graph clustering algorithm. The required clustering accuracy for a workpiece image when using a graph clustering algorithm can actually be determined by the required image size and the physical dimensions of the workpiece corresponding to the image. Please refer to the following for details.

[0060] As mentioned earlier, the computation time of graph clustering algorithms increases exponentially with increasing image resolution. Therefore, it is necessary to establish an acceptable upper limit for image resolution when applying graph clustering algorithms to control processing time and computational resource consumption while ensuring clustering effectiveness. Based on this, by determining the applicable image size limit, an initial clustering radius is further set to determine whether the current image is suitable for directly applying the graph clustering algorithm (i.e., whether the current image resolution leads to an abnormal increase in clustering time when applying the graph clustering algorithm).

[0061] It is understandable that if the cluster radius is set to 0.03 mm, these defects can be separated and clustered in a fine-grained manner (high cluster accuracy); if the cluster radius is set to 0.1 mm, multiple close-range defects may be grouped into the same cluster, and the cluster accuracy will decrease compared to when the cluster radius is 0.03 mm, but the processing speed will be faster. Therefore, the smaller the cluster radius, the higher the cluster accuracy; the higher the cluster accuracy, the smaller the cluster accuracy value.

[0062] For example, if workpiece a has dimensions of 200mm × 200mm, and the maximum applicable image size for the graph clustering algorithm is set to 5000 × 5000 pixels, then the initial clustering radius can be set to 5000 × 5000. The clustering accuracy corresponding to image a is 200 / 5000 = 0.04. If, for the same workpiece a, another image b with a higher resolution (image size 7500 × 7500 pixels) is used, then the clustering accuracy of image b is 200 / 7500 = 0.03. It can be seen that the 7500 × 7500 image b is larger than the image size indicated by the initial clustering radius, and the value of the clustering accuracy of image b (i.e., 0.03) is less than the value of the clustering accuracy indicated by the set initial clustering radius (i.e., 0.04).

[0063] In this situation, directly applying the graph clustering algorithm to image b would significantly increase computation time. Therefore, image b needs to be compressed, for example, to 5000×5000 pixels, before applying the graph clustering algorithm to complete the initial clustering. This method effectively controls image processing time and data volume without affecting the clustering results, ensuring that potential defects can be detected quickly and accurately.

[0064] S102: If the target cluster radius is smaller than the initial cluster radius, then the original workpiece image is determined to be larger than the image size indicated by the initial cluster radius, and the original workpiece image is compressed to the image size indicated by the initial cluster radius;

[0065] S103: Perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image using a spatial clustering algorithm to obtain at least one cluster; wherein, the spatial clustering algorithm includes at least a graph clustering algorithm;

[0066] In this embodiment, if the target cluster radius is smaller than the initial cluster radius, it indicates that the clustering accuracy of the workpiece image currently used for clustering is higher than the clustering accuracy indicated by the initial cluster radius (i.e., the clustering accuracy value of the workpiece image currently used for clustering is less than the clustering accuracy value indicated by the initial cluster radius), meaning that the current workpiece image has a high resolution and a large number of pixels. In other words, directly performing graph clustering processing on this workpiece image will significantly increase the computation time. Based on this, this embodiment proposes that when dealing with high-pixel-resolution workpiece images, the image is first compressed and then a graph clustering algorithm is applied to perform preliminary coarse clustering of the pixels in each workpiece image to obtain preliminary cluster results. This effectively reduces the amount of data required for each subsequent clustering, avoids increased clustering time due to excessive data volume, and improves the overall clustering processing efficiency.

[0067] Furthermore, in this embodiment, the initial clustering radius is used as the defining criterion for using the graph clustering algorithm. If the target clustering radius is smaller than the initial clustering radius, it is determined that the original workpiece image does not meet the applicable conditions for graph clustering indicated by the initial clustering radius (including the required clustering accuracy or image size), that is, the size of the original workpiece image is larger than the image size indicated by the initial clustering radius. In this case, to reduce the amount of data required for subsequent clustering processing, it is preferable to first compress the original workpiece image to the image size indicated by the initial clustering radius, so that the graph clustering algorithm can be applied to the compressed image to quickly achieve the preliminary clustering division of adjacent defect blocks, complete the preliminary clustering processing, and thus effectively control the processing time and resource consumption while ensuring the clustering effect.

[0068] S104: For each of the obtained clusters, based on the number of pixels in the cluster, determine the spatial clustering algorithm corresponding to the cluster and perform multiple clustering iterations on the cluster until a preset stopping condition is met, and output the multiple obtained clusters.

[0069] In this embodiment, to balance the accuracy and efficiency requirements of clustering processing, a suitable spatial clustering algorithm can be dynamically selected for each cluster to perform secondary or multiple clustering processes based on the number of pixels contained in each cluster, thereby improving the overall flexibility and adaptability of clustering.

[0070] Specifically, for the obtained clusters, spatial clustering algorithms can be selected according to the following strategy:

[0071] First, it's important to clarify that while geometric distance-based clustering algorithms (such as K-Means, bi-KMeans, DBSCAN, OPTICS, or distance-based clustering methods implemented using libraries like Scikit-learn and SciPy) can achieve high clustering accuracy while maintaining coordinate precision, they are not suitable for clusters containing a large number of pixels. In high-resolution images, a defect block is typically not a single pixel but a region of pixels, potentially containing tens, hundreds, or even more pixels. Taking Euclidean distance as an example, such algorithms usually need to traverse the pixel coordinates of all defect blocks, calculating the Euclidean distance between each pixel in each defect block and each pixel in every other defect block to determine if they are close enough to be grouped together. As can be seen, the clustering time increases exponentially with the number of pixels, severely impacting processing efficiency.

[0072] Therefore, when the number of pixels in a cluster is small and acceptable, distance clustering algorithms, such as point cloud clustering or hierarchical clustering, can be used to finely divide the clusters.

[0073] When the number of pixels in a cluster is large, graph clustering algorithms based on image connectivity or spatial grid partitioning can be preferred to reduce computational load and clustering time. These include image connected component clustering, MeanShift clustering, watershed algorithms, neighborhood analysis, and region growing clustering. These image-level clustering methods directly cluster pixels or regions, offering fast clustering speed, insensitivity to the number of defective blocks, relatively low computational complexity, suitability for handling large-scale defective clusters, and good parallelism.

[0074] By dynamically selecting the spatial clustering algorithm based on the number of pixels, the cluster cluster features and clustering strategies can be effectively matched, which can significantly reduce the computational cost while improving the clustering accuracy and enhancing the system's adaptability to different defect distribution features.

[0075] In this embodiment, to further improve the precision and accuracy of the clustering results, after completing the current clustering process, it can be determined whether another clustering operation is needed based on whether the current clustering process meets the preset stopping conditions, until the preset stopping conditions are met, such as the number of clustering layers reaching the maximum limit or the clustering time exceeding the clustering timeout threshold. Finally, multiple clusters that have completed the clustering process are output for subsequent defect labeling, type identification, or statistical analysis.

[0076] This application embodiment obtains preset clustering parameters (including target clustering radius and initial clustering radius) and pixel information of each defect block in each workpiece image. When the target clustering radius is determined to be smaller than the initial clustering radius, the original workpiece image is compressed to a specified image size, thereby reducing the computational burden of high-resolution images in clustering processing and improving the overall processing efficiency of image clustering. Subsequently, spatial clustering algorithms, including graph clustering algorithms, are used to perform preliminary clustering processing on the compressed workpiece image, which can quickly and effectively discover potential defects while reducing the amount of data. Based on the number of pixels in each cluster after preliminary clustering, an appropriate spatial clustering algorithm is dynamically selected, and multiple rounds of iterative clustering are performed until a preset stopping condition is met, achieving adaptive high-precision clustering of defect blocks of different sizes and shapes. Through the above processing, the accuracy and robustness of defect identification in image clustering are significantly improved, while the overall efficiency and reliability of workpiece defect detection are enhanced. This provides high-quality data support for industrial component surface quality control and production process optimization, and is particularly suitable for industrial surface defect analysis scenarios with large-scale, high-density defect data.

[0077] based on Figure 1 In some specific examples, to improve the clustering efficiency and adaptability under image resolution constraints, the spatial clustering algorithm also includes a distance clustering algorithm; step S103 specifically includes: using the graph clustering algorithm to cluster the pixels of each defect block in each compressed workpiece image to obtain at least one cluster after graph clustering; for the at least one cluster after graph clustering, using the distance clustering algorithm to cluster the clusters whose total number of pixels in the cluster is less than the first pixel number threshold to obtain at least one cluster after distance clustering.

[0078] In addition to using graph clustering algorithms for initial clustering, this application embodiment can also use graph clustering algorithms to process each compressed workpiece image first, quickly forming preliminary clusters. For each cluster obtained through graph clustering, a judgment is made based on the number of pixels within the cluster. If the total number of pixels in a certain cluster is less than a first pixel count threshold (that is, the number of pixels in this cluster is within an acceptable range, and using distance clustering will not cause excessive clustering time), then a distance clustering algorithm (such as K-Means, DBSCAN, OPTICS, etc., clustering methods based on the geometric distance between points) is used for further clustering processing to obtain at least one cluster based on distance clustering.

[0079] It is understandable that distance clustering algorithms are typically sensitive to the amount of data processed; as the number of pixels increases, their computation time will rise significantly. However, in this embodiment, defect blocks in multiple workpiece images have been divided into multiple independent clusters using the aforementioned graph clustering algorithm, and the number of pixels within each cluster is limited. Therefore, under the premise that the local data volume is controllable, using the distance clustering algorithm not only does not bring significant computational burden, but can also achieve clustering results with higher spatial accuracy.

[0080] For clusters where the total number of pixels exceeds the threshold of the first number of pixels, the next step, S104, can be performed using the clustering method.

[0081] By using the aforementioned phased, stepped clustering method, we can quickly obtain coarse clustering results and lay the foundation for further clustering, while avoiding the computational resource consumption caused by processing the entire graph at once, thus achieving a comprehensive balance between clustering efficiency and accuracy.

[0082] based on Figure 1 In some specific examples, to further improve clustering accuracy and adapt to the complexity differences of different types of defect clusters, step S104 specifically includes: for each obtained cluster, if the number of pixels in the cluster is less than a second pixel number threshold, then the cluster is clustered using a distance clustering algorithm to obtain the cluster after this clustering process; if the number of pixels in the cluster is greater than the second pixel number threshold, then based on the pixel information of each defect block, the local region of the target defect block corresponding to the pixel in the cluster is determined in the original workpiece image and magnified and projected; the local image after magnification and projection is clustered using the graph clustering algorithm to obtain the cluster after this clustering process; it is determined whether the current clustering process meets the preset stopping condition, and if the current clustering process meets the preset stopping condition, the clustering iteration is stopped and the obtained multiple clusters are output.

[0083] In this embodiment, dynamically selecting an appropriate clustering strategy for clusters based on the number of pixels can further accelerate the efficiency and accuracy of clustering. Specifically, if the number of pixels in a cluster is less than a preset second pixel count threshold, a distance clustering algorithm is used to cluster the cluster, resulting in the clusters after this processing. Considering that the distance clustering algorithm has high clustering accuracy but high computational complexity when processing large-scale pixel data, it is preferred to use the distance clustering algorithm in small-scale clusters, which helps to balance clustering accuracy and computational efficiency.

[0084] If the number of pixels within a cluster is greater than or equal to the second pixel count threshold, then based on the pixel information of each defect block, the local region of the target defect block corresponding to the pixels within that cluster is determined in the original workpiece image, and magnification projection processing is performed on this local region. Subsequently, a graph clustering algorithm is used to cluster the magnified and projected local image to obtain the clusters after this clustering process. By performing local magnification projection, the graph clustering algorithm can perform fine-grained clustering with more complete image details, thereby effectively controlling the computational load and improving clustering accuracy under large-scale data.

[0085] After each clustering process is completed, the system determines whether to continue to the next round of clustering iteration based on a preset stopping condition. If the stopping condition is met, the clustering iteration is terminated and the current clustering result is output; if not, the system continues to perform subsequent iterations of clustering processing on the newly obtained clusters. By using the above spatial clustering algorithm based on pixels within a cluster to determine the spatial cluster corresponding to each cluster and completing multiple clustering iterations, the embodiments of this application can adaptively refine defect clusters of different sizes, achieving high-precision and high-efficiency surface defect clustering identification.

[0086] Furthermore, the above clustering operation can be performed only on clusters with a total number of pixels greater than 1. Specifically, for each cluster obtained after the preliminary clustering process in step S103, if it still contains multiple pixels, the corresponding spatial clustering algorithm is selected based on the number of pixels in the updated cluster, and the above clustering process is repeated to achieve multi-level iterative clustering; when the clustering result meets the preset stopping condition, the current cluster is output. Conversely, if a cluster contains only a single pixel, there is no need to perform subsequent clustering operations.

[0087] based on Figure 1 In some specific examples, in order to achieve higher-precision image clustering, the step S104, which describes "determining the local area of ​​the target defect block corresponding to the pixel point in the cluster in the original workpiece image and magnifying the projection based on the pixel point information of each defect block", can be achieved through the following two local magnification methods.

[0088] In both methods, the common defect block location processing steps include:

[0089] First, based on the pixel information of each defect block within the cluster, the position coordinates of each target defect block in the original workpiece image and its corresponding actual physical size are determined; then, based on the position coordinates of the target defect block, the local region containing the target defect block is extracted in the original workpiece image as the base region position for subsequent magnification and projection processing.

[0090] In the workpiece image, after identifying the set of pixels corresponding to each defect block through image processing methods or a preset defect detection algorithm, the system can uniformly store the mapping relationship between the pixel coordinates of all defect blocks in the original workpiece image, the pixel coordinates in the compressed workpiece image, and the corresponding actual physical coordinates of the wafer in a vector. <waferpointdataelement>The container. Therefore, the above preprocessing steps can be performed by first querying the vector. <waferpointdataelement>The container stores the mapping relationships, allowing us to obtain the set of pixel coordinates for all pixels corresponding to each target defect block in the original workpiece image. Based on this set of pixel coordinates, we can determine the minimum bounding box of the target defect block in the original workpiece image, which is the rectangular region defined by the minimum horizontal (X-axis) and vertical (Y-axis) coordinate range of all pixels in the defect block. The coordinates of the top-left and bottom-right corners of this rectangular region describe the spatial position of the target defect block in the original image.

[0091] Subsequently, by combining the corresponding position of each pixel in the actual physical space of the wafer, the physical dimensions of the target defect block on the actual wafer are further determined by calculating the boundary range of the bounding rectangle in the physical coordinate system. For example, the physical dimensions of the target defect block in the X and Y directions can be calculated by multiplying the number of pixels corresponding to the width of the minimum bounding rectangle by the actual physical length corresponding to a unit pixel. Here, the actual physical length corresponding to a unit pixel refers to the actual size length represented by a pixel on the workpiece surface in the actual physical space (such as the wafer surface), usually in millimeters (mm) or micrometers (μm). The calculation formula is: actual physical length corresponding to a unit pixel = workpiece physical size (mm) / number of image pixels. For example, if the workpiece physical size is 200mm × 200mm and the image pixel count is 5000 × 5000 pixels, then the actual physical length corresponding to a unit pixel = 200 / 5000 = 0.04mm / pixel.

[0092] Through the above steps, it is possible to extract the spatial boundary and calculate the physical size based on the set of pixel coordinates, thereby providing an accurate target area positioning basis for subsequent magnified projection processing of local areas.

[0093] After completing the above defect block location processing, the target magnified size of the local area can be calculated according to different methods, and the area magnification projection processing can be performed, as follows:

[0094] Local magnification method 1: Calculate the target magnification size of the local region based on the actual physical size of the target defect block and the current cluster radius; perform projection processing on the local region based on the target magnification size to obtain the magnified local image.

[0095] For example, if the physical size of the current workpiece is 300mm × 300mm, and the corresponding compressed workpiece image size is 5000 × 5000 pixels, then the clustering accuracy of the current workpiece image is 300 / 5000 = 0.06. If the minimum bounding rectangle of a defect block in the current 5000 × 5000 workpiece image is 30 × 30mm, and the current clustering radius is 0.03, then the target magnified size can be calculated as the actual physical size of the target defect block / the current clustering radius = 30 / 0.03 = 1000. That is, the area where the defect block is located should be projected as an image of 1000 × 1000 pixels.

[0096] In practical implementation, it can be based on the data stored in a vector. <waferpointdataelement>The correspondence in the container, combined with the coordinate information of the minimum bounding rectangle of the defect block, determines the corresponding local area from the original workpiece image, and performs image projection processing according to the target magnification size to obtain the magnified local image.

[0097] It should be noted that the "magnification" operation in this embodiment involves reprojecting the pixel coordinates of a single cluster in the high-resolution original image onto the cluster map corresponding to the current cluster radius. The magnification factor is related to the current cluster radius. Since the original workpiece image has high resolution, the magnification operation can reveal image details that are not observable in the compressed workpiece image. For example, an area that originally appears as a single complete defect block in the compressed workpiece image may reveal multiple smaller defect units after magnification. Therefore, through the aforementioned local magnification and image projection processing, not only is the clustering accuracy improved, but the defect identification accuracy is also significantly enhanced, providing reliable data support for subsequent high-precision clustering.

[0098] Method 2 for local magnification: Calculate the target magnification size of the local area based on the size of the local region of the target defect block in the compressed workpiece image, and the ratio between the clustering accuracy corresponding to the compressed workpiece image and the clustering accuracy corresponding to the current clustering radius; then, perform projection processing on the local area based on the target magnification size to obtain the magnified local image.

[0099] For example, if the physical size of the current workpiece is 300mm × 300mm, and the corresponding compressed workpiece image size is 5000 × 5000 pixels, then the clustering accuracy of the current workpiece image is 300 / 5000 = 0.06, meaning that each pixel corresponds to a length of 0.06mm in the actual physical space. If the minimum bounding rectangle size of a target defect block in the actual physical space is 30mm × 30mm, then the local area size of the defect block in the compressed workpiece image can be calculated as: 30 / 0.06 = 500 pixels, meaning that the minimum bounding rectangle occupies 500 × 500 pixels in the compressed image.

[0100] Furthermore, assuming the current cluster radius is set to 0.03 mm (i.e., the expected clustering accuracy for this clustering process is 0.03 mm), the target magnification size can be calculated using the following formula:

[0101] Target magnification size = Local region size of the target defect block in the compressed workpiece image × (Clustering accuracy corresponding to the compressed workpiece image / Clustering accuracy corresponding to the current clustering radius) = 500 × (0.06 / 0.03) = 1000. That is, the area containing the defect block should be projected as an image of 1000 × 1000 pixels.

[0102] This application's embodiments achieve refined local analysis of clusters with higher clustering accuracy by using a local region coordinate reprojection method. Compared to traditional methods that use a uniform scale for clustering, this embodiment maintains the integrity of the original workpiece image pixel information while dynamically adjusting the workpiece image processing scale based on the current clustering radius, effectively improving the adaptability and clustering accuracy of high-precision image clustering in complex defect scenarios.

[0103] based on Figure 1 In some specific examples, to control the efficiency and accuracy of clustering processing, the system sets a set of preset stopping conditions during multi-round iterative clustering to determine whether the current clustering can be terminated. The preset stopping conditions include one of the following: the current cluster radius is smaller than the target cluster radius; the clustering time exceeds the clustering timeout threshold; the total number of defective blocks in a single cluster exceeds the defective block count threshold; or the number of pixels in a single cluster exceeds the third pixel count threshold.

[0104] The current cluster radius refers to the maximum distance threshold between pixels that are allowed to be classified into the same cluster in the current clustering round. If the current cluster radius is less than the target cluster radius, it means that the distance between all defect points is close enough that there is no need to further subdivide them. It also indicates that the clustering of the current cluster has reached the set target accuracy (that is, it meets the target cluster radius) and the clustering effect has converged.

[0105] During the clustering process, the system continuously monitors the time spent on clustering. If the current clustering time exceeds the preset timeout threshold, in order to ensure processing efficiency or system resource utilization, the clustering needs to be forcibly terminated even if the clustering is not fully refined, thereby protecting system resources and overall processing efficiency and preventing excessive time consumption in extreme clustering processes.

[0106] After each clustering process, the number of defective blocks within each cluster needs to be checked. If the total number of defective blocks in a cluster exceeds a set upper limit (defective block count threshold), it indicates that the cluster is too complex or the clustering is unreasonable. In this case, it can be considered that continuing clustering is not worthwhile, and the clustering process can be terminated. The result can be output for subsequent processing (such as manual intervention or special labeling) to prevent overcrowding within a single cluster and ensure the rationality and manageability of the clustering results.

[0107] Similarly, after each clustering process, it is necessary to check the number of pixels within each cluster. If the number of pixels in a cluster exceeds a preset third pixel count threshold, it means that the cluster is too large. Large clusters not only increase the complexity of subsequent processing but may also mask small internal defects. Therefore, in this case, the current clustering iteration is terminated to control the cluster size, avoid excessively large abnormal clusters, and ensure that the clustering granularity is appropriate.

[0108] The above-mentioned preset stopping conditions, based on five different dimensions—accuracy requirements, spatial sparsity, time consumption limits, cluster complexity, and cluster size control—are used to determine whether to terminate the clustering iteration. This approach can reasonably control processing efficiency and system resource consumption while ensuring the clustering effect.

[0109] based on Figure 1 In some specific examples, the workpiece includes a wafer; the workpiece image includes a wafer image.

[0110] Understandably, in the field of chip manufacturing, wafers, as a core basic material, are typically made of high-purity silicon and other semiconductor materials, and are in the form of thin sheets. Wafers have extremely high requirements for material purity, surface flatness, and structural consistency. However, in actual production, wafer manufacturing involves complex and variable processes and highly sensitive environmental conditions, which easily generate microscopic defects on the wafer surface, such as impurities, pits, scratches, and particles. These defects not only directly affect chip yield but also significantly impact the electrical performance and reliability of the final chip. Therefore, efficient and accurate detection and cluster analysis of wafer defects are needed to ensure chip quality and stability.

[0111] As the precision of integrated circuit manufacturing processes continues to improve, the imaging resolution and discrimination accuracy for wafer defect detection are also increasing. Under micron- or even nanometer-level imaging conditions, the amount of defect data contained in an image of a wafer of the same size grows exponentially. Faced with such massive amounts of data, traditional clustering algorithms struggle to simultaneously meet practical requirements in terms of computational efficiency, resource consumption, and processing accuracy.

[0112] Therefore, in image clustering scenarios where the workpiece includes a wafer and the workpiece image includes a wafer image, the image clustering method provided in this application can dynamically adjust the clustering method and clustering parameters according to the image resolution, defect distribution characteristics and target accuracy requirements. This effectively controls computational overhead while ensuring clustering results, thereby improving the overall efficiency and applicability of wafer defect analysis.

[0113] based on Figure 1 In some specific examples, in order to support subsequent defect statistical analysis, quality judgment and labeling operations, after step S104, the method of this application embodiment may further include: outputting the number of defect blocks under each cluster and the number of pixels in each defect block.

[0114] Specifically, based on the final clustering results, the system can traverse all clusters and extract all defect block objects contained within each cluster. For each defect block, the number of associated pixels can be counted to form a pixel count record for a single defect block. Simultaneously, the total number of defect blocks under the current cluster is counted, forming statistical information for the cluster hierarchy. The number of defect blocks is used to assess the degree of clustering and density characteristics of defects within the cluster, while the number of pixels reflects the area size, morphological differences (such as small particles or large scratches), or potential severity of each defect block. The output of this information facilitates subsequent analysis of defect density and scale in different clusters and workpiece quality assessment. Furthermore, the clustering results can be correlated with production batches, equipment status, and other information to improve quality traceability and process optimization capabilities.

[0115] Please combine Figure 3 , Figure 3 This is a flowchart illustrating another image clustering method provided in an embodiment of this application. (This application embodiment) Figure 3 The provided image clustering algorithm includes the following steps:

[0116] S301: Initialize the clustering process, corresponding to... Figure 3 The beginning (Start) in the middle.

[0117] S3021: Obtain clustering parameter setting information, specifically including: starting clustering radius MaxClusteringR, target clustering radius MinClusteringR, defect block number threshold EventThresh, second pixel number threshold PixelThresh, and clustering timeout threshold TimeThresh.

[0118] S3022: Read the output data of the defect detection algorithm, and store the pixel information of each defect block in each workpiece image, as well as the actual physical radius of the wafer (WaferRadius), in a container vector. <waferpointdataelement>middle.

[0119] S303: Determine the number of clusters and the radius of each cluster.

[0120] S304: Start the clustering processing timer to record the clustering time (time), which will be used for subsequent timeout judgment based on the clustering timeout threshold TimeThresh.

[0121] S305: Based on the pixel information of each defect block in each workpiece image, perform preliminary clustering processing on each defect block using a spatial adjacency clustering algorithm (at least including a clustering algorithm based on image connected components) to obtain at least one cluster (corresponding to...). Figure 3 ("Maximum radius clustering based on connected component analysis" in Chinese).

[0122] S306: If the current clustering time is greater than or equal to TimeThresh, or the pixel spacing between defective blocks within each cluster is not greater than the target cluster radius (corresponding to...) Figure 3 If the condition "There are no defects that require higher precision clustering?" is met, then proceed to step S309; ​​otherwise, proceed to the next step S307.

[0123] S307: For each obtained cluster, based on the number of defective blocks in the cluster, determine the target clustering algorithm corresponding to the cluster, and use the target clustering algorithm to perform secondary clustering processing on the cluster to obtain the cluster after secondary clustering (corresponding to...). Figure 3 Then proceed to step S308 ("perform higher-level clustering on connected components with more than one pixel").

[0124] S308: Determine whether any of the following conditions are met:

[0125] (1) Clustering timeout time > Clustering timeout threshold TimeThresh;

[0126] (2) The pixel spacing between defective blocks within each cluster is not greater than the target cluster radius (corresponding to...). Figure 3 The judgment condition is: "Is there a need for higher-precision clustering due to the absence of defects?"

[0127] (3) There exists a single cluster of pixels where the number of pixels is PixelCount > the preset second pixel threshold PixelThresh;

[0128] (4) There exists a cluster where the total number of defective blocks RawEvent is greater than the preset threshold number of defective blocks EventThresh.

[0129] If any condition is met, proceed to step S309; ​​otherwise, return to step S307.

[0130] S309: Output the multiple clusters obtained, including information such as the number of defective blocks (RawEvent) and the number of pixels (PixelCount) in each defective block, for subsequent analysis, classification or judgment.

[0131] S310: End clustering.

[0132] It should be noted that steps S301, S3021, and S3022 can be executed in parallel. That is, while initializing the clustering process, the clustering parameter settings can be read simultaneously, and the pixel information and related physical parameters of each defect block in the workpiece image can be loaded from the defect detection module. By using parallel processing, the waiting time in the initialization phase can be effectively reduced, the startup speed of the clustering process can be accelerated, and the overall algorithm execution efficiency can be improved.

[0133] pass Figure 3 The image clustering method shown in this application can dynamically control the selection of clustering algorithms and the number of process iterations based on the number of defect blocks, clustering time, and clustering parameter settings while maintaining the target clustering accuracy. This effectively balances clustering accuracy and processing efficiency, avoiding system burden caused by excessive computation. It is especially suitable for workpiece image clustering applications in high-resolution, high-density defect data scenarios such as wafer images.

[0134] To implement the image clustering method of this application embodiment, this application embodiment also provides an image clustering apparatus, such as... Figure 4 As shown, the device includes:

[0135] The acquisition unit 401 is used to acquire preset clustering parameters and pixel information of each defect block in each original workpiece image; the preset clustering parameters include a target clustering radius and a starting clustering radius; the target clustering radius is determined based on the image size of the original workpiece image; the starting clustering radius is used to indicate the clustering accuracy or image size that the workpiece image needs to meet when using a graph clustering algorithm;

[0136] Image processing unit 402 is configured to determine that the original workpiece image is larger than the image size indicated by the initial cluster radius if the target cluster radius is smaller than the initial cluster radius, and to compress the original workpiece image to the image size indicated by the initial cluster radius;

[0137] Clustering unit 403 is used to perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image using a spatial clustering algorithm to obtain at least one cluster; wherein, the spatial clustering algorithm includes at least a graph clustering algorithm;

[0138] The clustering unit 403 is further configured to, for each obtained cluster, determine the spatial clustering algorithm corresponding to the cluster based on the number of pixels in the cluster and perform multiple clustering iterations on the cluster until a preset stopping condition is met, and output the multiple obtained clusters.

[0139] In one embodiment, the spatial clustering algorithm further includes a distance clustering algorithm; the clustering unit 402 is specifically used to: use the graph clustering algorithm to cluster the pixels of each defect block in each compressed workpiece image to obtain at least one cluster after graph clustering;

[0140] For at least one cluster after graph clustering, a distance clustering algorithm is used to cluster the clusters whose total number of pixels is less than a first pixel number threshold, thus obtaining at least one cluster after distance clustering.

[0141] In one embodiment, the clustering unit 403 is specifically used for:

[0142] For each of the obtained clusters, if the number of pixels in the cluster is less than the second pixel number threshold, then the cluster is clustered using a distance clustering algorithm to obtain the cluster after this clustering process.

[0143] If the number of pixels in the cluster is greater than the second pixel number threshold, then based on the pixel information of each defect block, the local image of the target defect block corresponding to the pixel in the cluster is determined and magnified in the original workpiece image;

[0144] The graph clustering algorithm is used to perform clustering processing on the magnified local image to obtain the clusters after this clustering process;

[0145] Determine whether the current clustering process meets the preset stopping condition. If the current clustering process meets the preset stopping condition, stop the clustering iteration and output the multiple clusters that have been obtained.

[0146] In one embodiment, the clustering unit 403 is specifically used for:

[0147] Based on the pixel information of each defect block, determine the position coordinates of the target defect block corresponding to the pixel in the cluster in the original workpiece image, as well as the actual physical size of the target defect block;

[0148] Based on the position coordinates of the target defect block in the original workpiece image, determine the local region of the target defect block in the original workpiece image;

[0149] Calculate the target magnification size of the local region based on the actual physical size of the target defect block and the current cluster radius;

[0150] Based on the target magnification size, the local area is projected to obtain a magnified local image.

[0151] In one embodiment, the clustering unit 403 is specifically used for:

[0152] Based on the pixel information of each defect block, determine the position coordinates of the target defect block corresponding to the pixel in the cluster in the original workpiece image, as well as the actual physical size of the target defect block;

[0153] Based on the position coordinates of the target defect block in the original workpiece image, determine the local region of the target defect block in the original workpiece image;

[0154] The target magnification size of the local region is calculated based on the size of the local region of the target defect block in the compressed workpiece image, and the ratio between the clustering accuracy corresponding to the compressed workpiece image and the clustering accuracy corresponding to the current clustering radius.

[0155] Based on the target magnification size, the local area is projected to obtain a magnified local image.

[0156] In one embodiment, the preset stopping condition includes one of the following: the current cluster radius is smaller than the target cluster radius; the clustering time is greater than the clustering timeout threshold; the total number of defective blocks in a single cluster is greater than the defective block count threshold; the number of pixels in a single cluster is greater than the third pixel count threshold.

[0157] In one embodiment, the device further includes an output unit for outputting the number of defective blocks in each cluster and the number of pixels in each defective block.

[0158] In practical applications, clustering unit 403 can be implemented by a processor in a computer device combined with a communication interface, and acquisition unit 401, image processing unit 402 and output unit can be implemented by a communication interface in an image clustering device.

[0159] It should be noted that the image clustering device provided in the above embodiments is only illustrated by the division of the above-described program modules. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. In addition, the image clustering device and the image clustering method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0160] Based on the hardware implementation of the above program modules, and in order to implement the image clustering method provided in this application embodiment, this application embodiment also provides a computer device, such as... Figure 5 As shown, computer device 500 includes:

[0161] Central processing unit 501, memory 502, and input / output interface 503;

[0162] The memory 502 is a short-term storage memory or a persistent storage memory;

[0163] The central processing unit 501 is configured to communicate with the memory 502 and execute instructions in the memory 502 to perform any of the above-described image clustering methods.

[0164] Of course, in practical applications, the various components in the computer device 500 are coupled together through a bus system 504. It is understood that the bus system 504 is used to realize communication between these components. In addition to a data bus, the bus system 504 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 5 The general designated all buses as Bus System 504.

[0165] The memory 502 in this embodiment is used to store various types of data to support the operation of the computer device 500. Examples of such data include any computer program used to operate on the computer device 500.

[0166] It is understood that when the processor in the computer device described above executes the computer program, it can also realize the functions of each unit in the corresponding device embodiments described above, which will not be repeated here. Exemplarily, the computer program can be divided into one or more modules / units, one or more modules / units are stored in memory and executed by the processor to complete the various embodiments of this application. One or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device. For example, the computer program can be divided into units in the aforementioned computer device, and each unit can implement the specific functions described in the corresponding computer device above.

[0167] Computer equipment can be desktop computers, laptops, handheld computers, and cloud servers, among other computing devices. Computer equipment may include, but is not limited to, processors and memory. Those skilled in the art will understand that processors and memory are merely examples of computer equipment and do not constitute a limitation on the computer equipment. It may include more or fewer components, or combinations of certain components, or different components. For example, computer equipment may also include input / output devices, network access devices, buses, etc.

[0168] A processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of a computer device, connecting all parts of the computer device through various interfaces and lines.

[0169] Memory can be used to store computer programs and / or modules. The processor performs various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can primarily include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a given function, etc.; the data storage area can store data created based on terminal usage, etc. Furthermore, memory can include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart media cards (SMC), secure digital cards (SD), flash cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.

[0170] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, performs any of the image clustering methods described above.

[0171] This application also provides a computer program product storing a computer program / instruction, which, when executed by a processor, is used to implement the image clustering method described in the first aspect or any specific implementation of the first aspect of this application.

[0172] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0173] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0174] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0175] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0176] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.< / waferpointdataelement> < / waferpointdataelement> < / waferpointdataelement> < / waferpointdataelement>

Claims

1. An image clustering method, characterized in that, include: Obtain preset clustering parameters and pixel information of each defect block in each original workpiece image; The preset clustering parameters include the target clustering radius and the initial clustering radius; The target clustering radius is determined based on the image size of the original workpiece image; the initial clustering radius is used to indicate the clustering accuracy or image size that the workpiece image needs to meet when using a graph clustering algorithm. If the target cluster radius is smaller than the initial cluster radius, then the original workpiece image is determined to be larger than the image size indicated by the initial cluster radius, and the original workpiece image is compressed to the image size indicated by the initial cluster radius; A spatial clustering algorithm is used to perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image to obtain at least one cluster; wherein, the spatial clustering algorithm includes at least a graph clustering algorithm and a distance clustering algorithm; For each obtained cluster, based on the number of pixels in the cluster, a spatial clustering algorithm corresponding to the cluster is determined, and multiple clustering iterations are performed on the cluster until a preset stopping condition is met, and the obtained clusters are output. If the number of pixels in the cluster is less than a second pixel count threshold, the spatial clustering algorithm corresponding to the cluster is determined to be a distance clustering algorithm; if the number of pixels in the cluster is greater than or equal to the second pixel count threshold, the spatial clustering algorithm corresponding to the cluster is determined to be the graph clustering algorithm.

2. The method according to claim 1, characterized in that, The spatial clustering algorithm is used to perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image to obtain at least one cluster, including: The graph clustering algorithm is used to cluster the pixels of each defect block in each compressed workpiece image to obtain at least one cluster after graph clustering. For at least one cluster after graph clustering, a distance clustering algorithm is used to cluster the clusters whose total number of pixels is less than a first pixel number threshold, thus obtaining at least one cluster after distance clustering.

3. The method according to claim 1, characterized in that, For each obtained cluster, based on the number of pixels in the cluster, a spatial clustering algorithm corresponding to the cluster is determined, and multiple clustering iterations are performed on the cluster until a preset stopping condition is met. The resulting clusters are then output, including: For each of the obtained clusters, if the number of pixels in the cluster is less than the second pixel number threshold, then the cluster is clustered using a distance clustering algorithm to obtain the cluster after this clustering process. If the number of pixels in the cluster is greater than the second pixel number threshold, then based on the pixel information of each defect block, the local area of ​​the target defect block corresponding to the pixel in the cluster is determined and magnified in the original workpiece image. The graph clustering algorithm is used to cluster the magnified projected local image to obtain the clusters after this clustering process; Determine whether the current clustering process meets the preset stopping condition. If the current clustering process meets the preset stopping condition, stop the clustering iteration and output the multiple clusters that have been obtained.

4. The method according to claim 3, characterized in that, The step of determining and magnifying the local region of the target defect block corresponding to the pixels within the cluster in the original workpiece image based on the pixel information of each defect block includes: Based on the pixel information of each defect block, determine the position coordinates of the target defect block corresponding to the pixel in the cluster in the original workpiece image, as well as the actual physical size of the target defect block; Based on the position coordinates of the target defect block in the original workpiece image, determine the local region of the target defect block in the original workpiece image; Calculate the target magnification size of the local region based on the actual physical size of the target defect block and the current cluster radius; Based on the target magnification size, the local area is projected to obtain a magnified local image.

5. The method according to claim 3, characterized in that, The step of determining and magnifying the local region of the target defect block corresponding to the pixels within the cluster in the original workpiece image based on the pixel information of each defect block includes: Based on the pixel information of each defect block, determine the position coordinates of the target defect block corresponding to the pixel in the cluster in the original workpiece image, as well as the actual physical size of the target defect block; Based on the position coordinates of the target defect block in the original workpiece image, determine the local region of the target defect block in the original workpiece image; The target magnification size of the local region is calculated based on the size of the local region of the target defect block in the compressed workpiece image, and the ratio between the clustering accuracy corresponding to the compressed workpiece image and the clustering accuracy corresponding to the current clustering radius. Based on the target magnification size, the local area is projected to obtain a magnified local image.

6. The method according to claim 1, characterized in that, The preset stopping conditions include one of the following: the current cluster radius is smaller than the target cluster radius; the clustering time is greater than the clustering timeout threshold; the total number of defective blocks in a single cluster is greater than the defective block count threshold. There exists a single cluster whose number of pixels exceeds the threshold for the number of third pixels.

7. The method according to claim 1, characterized in that, For each obtained cluster, based on the number of pixels in the cluster, the method determines the spatial clustering algorithm corresponding to the cluster and performs multiple clustering iterations on the cluster until a preset stopping condition is met. After outputting the multiple obtained clusters, the method further includes: Output the number of defective blocks in each cluster and the number of pixels in each defective block.

8. An image clustering device, characterized in that, include: The acquisition unit is used to acquire preset clustering parameters and pixel information of each defect block in each original workpiece image; The preset clustering parameters include a target clustering radius and an initial clustering radius; the target clustering radius is determined based on the image size of the original workpiece image; the initial clustering radius is used to indicate the clustering accuracy or image size that the workpiece image needs to meet when using a graph clustering algorithm; An image processing unit is configured to determine that the original workpiece image is larger than the image size indicated by the initial cluster radius if the target cluster radius is smaller than the initial cluster radius, and to compress the original workpiece image to the image size indicated by the initial cluster radius; A clustering unit is used to perform preliminary clustering processing on the pixels of each defect block in each compressed workpiece image using a spatial clustering algorithm to obtain at least one cluster; wherein, the spatial clustering algorithm includes at least a graph clustering algorithm and a distance clustering algorithm; The clustering unit is further configured to, for each obtained cluster, determine the spatial clustering algorithm corresponding to the cluster based on the number of pixels in the cluster and perform multiple clustering iterations on the cluster until a preset stopping condition is met, and output the multiple obtained clusters; wherein, if the number of pixels in the cluster is less than a second pixel number threshold, the spatial clustering algorithm corresponding to the cluster is determined to be a distance clustering algorithm; if the number of pixels in the cluster is greater than or equal to the second pixel number threshold, the spatial clustering algorithm corresponding to the cluster is determined to be the graph clustering algorithm.

9. A computer device, characterized in that, include: Central processing unit, memory, and input / output interfaces; The memory is either a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the image clustering method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it performs the image clustering method as described in any one of claims 1 to 7.

11. A computer program product having a computer program / instructions stored thereon, characterized in that, When executed by a processor, the computer program / instructions are used to implement the image clustering method according to any one of claims 1 to 7.