A method and system for diamond grading
By adding a multi-scale feature fusion module and an ordered regressor to a convolutional neural network, combined with multi-focus image fusion and edge detection algorithms, the problem of low accuracy in diamond classification and grading was solved, and rapid and accurate diamond classification and grading were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, diamond classification and grading methods based on convolutional neural networks suffer from a gradual decrease in detailed features, making it difficult to accurately determine the high-level abstract features and minute inclusions of diamonds, resulting in low accuracy in diamond classification and grading.
By adding multi-scale feature fusion modules to the penultimate, third, and fourth MBConv layers of the convolutional neural network and adding an ordered regressor at the end, a multi-scale ordered regression network is constructed. Combined with multi-focus image fusion and edge detection algorithms, diamond slice images are preprocessed to obtain clear diamond feature image data, and diamond clarity score and grade are calculated through ordered regression.
It improves the accuracy and efficiency of diamond classification and grading, enabling the task to be completed quickly and accurately, and enhancing the reliability and practicality of the classification results.
Smart Images

Figure CN117036766B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image classification technology, and in particular to a classification method and system for diamond grading. Background Technology
[0002] Diamonds are polished diamonds, which are characterized by a wide variety of types, shapes, and subtle features. The differences between some types are even very small and the boundaries are blurred. Therefore, grading diamonds manually is a very difficult technical problem. As a result, classification methods for grading diamonds based on deep learning technology using machine vision have emerged on the market.
[0003] Currently, diamonds are typically classified and graded using convolutional neural network technology based on diamond images. While this method has achieved good results, the detailed features in the image gradually decrease after the convolutional neural network is applied layer by layer. Diamond classification and grading not only require advanced abstract features but also rely on the features of some very small inclusions to assist in the judgment, resulting in low accuracy in diamond classification and grading. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a classification method and system for diamond grading, which solves the technical problem of insufficient accuracy in diamond grading and achieves the goal of further improving the accuracy of diamond grading.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a classification method for diamond grading, comprising the following steps:
[0006] Acquire slice images of diamonds at different depths to be classified and graded, captured by an image acquisition device;
[0007] The slice images of diamonds to be classified and graded are preprocessed to obtain preprocessed image data;
[0008] The preprocessed image data is input into a pre-built classification and grading model for feature processing and regression calculation to obtain the diamond clarity score.
[0009] The diamonds to be classified and graded are divided into M classification intervals according to the preset classification threshold in the classification and grading model, and regression labels are calculated based on the classification intervals.
[0010] The diamond clarity score is compared with the classification threshold and regression label to determine the diamond classification level.
[0011] Furthermore, the specific steps for constructing the classification and ranking model include:
[0012] Acquire a number of labeled image data to form a training dataset;
[0013] Multi-scale feature fusion modules are added to the penultimate, third, and fourth MBConv layers of the convolutional neural network, and the ordered regressor is fused to the end of the convolutional neural network to obtain a multi-scale ordered regression network.
[0014] The multi-scale ordered regression network is trained using the training dataset to obtain a classification and ranking model.
[0015] Further, the step of inputting the preprocessed image data into a pre-built classification and grading model for feature processing and regression calculation to obtain a diamond clarity score includes the following steps:
[0016] The preprocessed image data is convolved to obtain a feature map;
[0017] The feature map is downsampled to obtain the corresponding first feature vector;
[0018] The first feature vector is concatenated and fused according to the feature dimension to obtain the fused second feature vector;
[0019] Regression calculations are performed on the second feature vector to obtain the diamond clarity score.
[0020] Furthermore, the expression for the regression label is:
[0021]
[0022] In the above formula, y i t represents the regression label for the i-th grade diamond. i This represents the element in the classification threshold, where a represents the offset and a > 0, and M represents the total number of classification intervals.
[0023] Furthermore, the method also includes:
[0024] The preprocessed image data is converted into a heatmap using a gradient-based class activation graph algorithm, and the heatmap and the corresponding diamond classification grade result are output together.
[0025] Furthermore, the labeled image data refers to images that clearly display all inclusions and include the diamond grade indicated by a professional as a label.
[0026] Furthermore, the preprocessing of the slice image of the diamond to be classified and graded to obtain preprocessed image data includes the following steps:
[0027] The multi-focus image fusion algorithm is used to fuse multiple slice images of the same diamond sequentially to obtain a fused image of the diamond to be classified and graded.
[0028] An edge detection algorithm was used to detect the position of the diamond in the fused image and the diamond was cropped to obtain preprocessed image data with the diamond background removed.
[0029] This invention also provides a technical solution: a system for implementing a classification method for diamond grading, comprising:
[0030] A slice image acquisition module is used to acquire slice images of diamonds at different depths to be classified and graded, which are acquired by an image acquisition device.
[0031] The slice image preprocessing module is used to preprocess the slice images of diamonds to be classified and graded to obtain preprocessed image data.
[0032] A diamond clarity score calculation module is used to input the preprocessed image data into a pre-built classification and grading model for feature processing and regression calculation to obtain the diamond clarity score.
[0033] The regression label generation module is used to divide the diamond to be classified and graded into M classification intervals according to the preset classification threshold in the classification and grading model, and calculate the regression label according to the classification intervals.
[0034] The diamond classification and grading module is used to compare the diamond clarity score with the classification threshold and regression label to determine the diamond classification and grading.
[0035] Furthermore, it also includes:
[0036] The image conversion output module is used to convert the preprocessed image data into a heatmap according to the gradient-based class activation map algorithm, and output the heatmap and the corresponding diamond classification grade result together.
[0037] By employing the above technical solution, the present invention provides a classification method and system for diamond grading, which has at least the following beneficial effects:
[0038] 1. This invention preprocesses slice images of diamonds at different depths to obtain preprocessed image data that clearly displays all inclusions and removes the background. After convolution to obtain the corresponding feature vectors, a multi-scale feature fusion module fuses abstract and fine-grained features of different scales to facilitate the subsequent extraction of detailed features of the diamond. Then, based on the extracted features, a diamond clarity score is calculated to measure the number of inclusions in the diamond. Finally, based on the ordered relationship between diamond grades, a threshold-based ordered regressor is used to map the diamond classification and grading, thereby making the classification and grading results closer to the correct direction and greatly improving the accuracy of diamond classification and grading.
[0039] 2. This invention uses a gradient-based class activation graph algorithm to convert preprocessed image data into a heat map that highlights diamond inclusions, and outputs the heat map along with the corresponding diamond classification grade results. By visualizing diamond inclusions, the grading results are easier to interpret, thus verifying the reliability of the classification and grading model.
[0040] 3. This invention trains a convolutional neural network based on multi-scale feature fusion and an improved ordered regressor as a classification and grading model. After inputting the preprocessed diamond image to be classified and graded into the classification and grading model, it can quickly and accurately complete the classification and grading task of the diamond image to be classified automatically, and further improve the accuracy of diamond classification and grading, improve classification efficiency, and enhance practicality. Attached Figure Description
[0041] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0042] Figure 1 A flowchart of the classification method provided by the present invention;
[0043] Figure 2 This is a flowchart of the slice image preprocessing in the classification method provided by the present invention;
[0044] Figure 3 A flowchart for calculating diamond clarity score in the classification method provided by this invention;
[0045] Figure 4 This is a schematic diagram of regression labels in the classification method provided by the present invention;
[0046] Figure 5 An example diagram illustrating the method for determining diamond classification grades provided by this invention;
[0047] Figure 6 This is a flowchart illustrating the construction of a classification and grading model in the classification method provided by the present invention;
[0048] Figure 7 This is a framework diagram of the multi-scale ordered regression network constructed in the classification method provided by this invention;
[0049] Figure 8 A schematic diagram of the classification system provided by this invention.
[0050] In the diagram: 10, slice image acquisition module; 20, slice image preprocessing module; 30, diamond clarity score calculation module; 40, regression label generation module; 50, diamond classification grade determination module; 60, image conversion output module. Detailed Implementation
[0051] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. This will allow for a full understanding of how the present application uses technical means to solve technical problems and achieve technical effects, and to facilitate its implementation.
[0052] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0053] Application Overview
[0054] Existing convolutional neural networks (CNNs) consist of an initial convolutional layer, seven stacked MBConv layers, and a classifier. When classifying and grading diamond images using existing CNNs, nine stages are involved. The first stage is a standard convolutional layer with a kernel size of 3x3 and a stride of 2. Stages two through eight consist of repeatedly stacked MBConv structures. The ninth stage comprises a standard 1x1 convolutional layer, an average pooling layer, and a fully connected layer. However, as diamond images undergo layer-by-layer convolution, their detail features gradually decrease. Diamond classification and grading require not only high-level abstract features but also features of very small inclusions to aid in judgment. Therefore, this application proposes adding a multi-scale feature fusion module to the penultimate, third, and fourth-to-last MBConv layers of the existing CNN structure. This module fuses abstract features and fine-grained features at different scales, facilitating the subsequent capture of detailed diamond features and improving the accuracy of diamond classification and grading.
[0055] In addition, existing convolutional neural networks do not consider the ordered relationship between diamond clarity grades when performing diamond classification tasks, which leads to errors in diamond classification. To address this, this application proposes to add an ordered regressor to the end of the existing convolutional neural network. The ordered regressor includes a fully connected layer, a regressor layer, and a threshold. The ordered regressor ensures that the classification results always move in the correct direction, thereby improving the performance of diamond classification and grading.
[0056] Example
[0057] Please refer to Figures 1-7 This paper illustrates a specific implementation of a classification method for diamond grading. This embodiment trains a convolutional neural network based on multi-scale feature fusion and ordered regressors as a classification and grading model, which can quickly and accurately complete the classification and grading task of diamond images to be classified, making diamond classification and grading more accurate.
[0058] like Figure 1 As shown, a classification method for diamond grading includes the following steps:
[0059] S1. Acquire slice images of diamonds at different depths to be classified and graded by image acquisition equipment.
[0060] In this embodiment, the image acquisition device for collecting slice images of the diamond to be classified and graded at different depth directions is set as a high-definition camera. Since the focusing range of the high-definition camera is limited, it can only produce clear images of well-focused targets. In addition, since diamond inclusions are often located in different positions, it is necessary to use multiple different focusing distances to focus and image the diamond inclusions located in different positions to obtain slice images of the diamond at different depths.
[0061] S2. Preprocess the slice images of the diamonds to be classified and graded to obtain preprocessed image data. For example... Figure 2 As shown, it specifically includes:
[0062] S21. According to the multi-focus image fusion algorithm, multiple slice images of the same diamond are fused sequentially to obtain the fused image of the diamond to be classified and graded.
[0063] Specifically, in order to display inclusions in different locations within the same diamond more clearly in a single image, a multi-focus image fusion algorithm is used to fuse multiple slice images of the same diamond. This improves the quality of the image data, facilitating the rapid and accurate extraction of diamond features, and thus enhancing the accuracy and efficiency of diamond classification and grading. The multi-focus image fusion algorithm involved here is common knowledge to those skilled in the art and will not be described in detail further.
[0064] S22. The edge detection algorithm is used to detect the position of the diamond in the fused image and the diamond is cropped to obtain the preprocessed image data after removing the diamond background.
[0065] Because the background of the fused image contains a lot of noise such as dust, which can easily confuse the inclusions, it is necessary to remove the diamond background in order to see the diamond inclusions clearly. The specific process is as follows: First, the Canny edge detection algorithm is used to automatically find the edge of the diamond in the fused image to obtain the position of the diamond in the fused image. Then, the fused image is cropped along the edge of the diamond to obtain the preprocessed image data after removing the diamond background. This can eliminate the influence of the image background on the model's learned features, thereby improving the accuracy of diamond classification and grading.
[0066] S3. Input the preprocessed image data into the pre-built classification and grading model for feature processing and regression calculation to obtain the diamond clarity score.
[0067] Specifically, the pre-built classification and ranking model is obtained by training a convolutional neural network based on multi-scale feature fusion and an ordered regressor using labeled image data of several different levels. For example... Figure 3 As shown, calculating a diamond's clarity grade involves the following steps:
[0068] S31. Perform a convolution operation on the preprocessed image data to obtain a feature map.
[0069] The preprocessed image data is input into a pre-built classification and ranking model for convolution. The feature map output after passing through the nth-to-last MBConv layer is denoted as F. n Feature map F n The size is C n xH n xW n .
[0070] S32. Perform downsampling on the feature map to obtain the corresponding first feature vector.
[0071] Since the feature maps of the last two MBConvs are relatively small, this embodiment uses a global average pooling layer for processing. That is, the average value of the elements in the window is taken to obtain the corresponding first feature vector, and the size of the first feature vector is Nnx1. The feature maps of the third and fourth MBConvs are relatively large. They first pass through a convolutional module, and then a global average pooling layer is used to obtain the corresponding first feature vector. The convolutional module involved here consists of the following four parts connected in series: a convolution with a kernel size of 3x3 and a stride of 1, batch normalization (BN), a convolution with a kernel size of 1x1, and the activation function ReLU. The number of all convolutional kernels is the same as the number of input channels.
[0072] Specifically, for feature maps to obtain Fn The process of obtaining the corresponding first feature vector through processing can be represented by the following formula:
[0073] f1 = Pool(F1)
[0074] f2 = Pool(F2)
[0075] f3=Pool[Conv2(ReLU(BN(Conv1(F3))))]
[0076] f4=Pool[Conv2(ReLU(BN(Conv1(F4))))]
[0077] In the above formula, F n (n = 1, 2, 3, 4) represents the feature map output after passing through the nth-to-last MBConv layer, f1, f2, f3, f4 represent the corresponding first feature vectors, Conv1 and Conv2 represent two different convolutional layers, BN represents batch normalization, ReLU represents the activation function, and Pool represents the global average pooling layer.
[0078] S33. The first feature vector is concatenated and fused according to the feature dimension to obtain the fused second feature vector.
[0079] Multiple first feature vectors are concatenated and fused according to their feature dimensions to obtain a fused second feature vector. The size of the second feature vector is Nx1, where N = N1 + N2 + N3 + N4, which facilitates the subsequent extraction of detailed features of the diamond. The specific concatenation process can be represented by the following formula:
[0080] f = Concat(f1, f2, f3, f4)
[0081] In the above formula, f represents the second feature vector after fusion, and Concat represents the concatenation function.
[0082] S34. Perform regression calculation on the second eigenvector to obtain the diamond clarity score.
[0083] After regression calculation using a fully connected layer and a regressor, a diamond clarity score s is obtained to measure the number of inclusions in a diamond. The higher the diamond clarity score s, the lower the grade of the diamond.
[0084] S4. Divide the diamonds to be classified and graded into M classification intervals according to the preset classification threshold in the classification and grading model, and calculate the regression labels according to the classification intervals.
[0085] In this embodiment, five classification thresholds, denoted as T = [t1, t2, t3, t4, t5], are preset when training the classification and grading model according to the diamond classification standards. These thresholds divide the diamond clarity into six grades, denoted as [0, 1, 2, 3, 4, 5]. Grade 0 is the highest grade, with almost no inclusions; grade 5 is the lowest grade, with many inclusions. Each grade corresponds to a classification interval on a number axis, resulting in six classification intervals, as shown in the following expression:
[0086] [-inf, t1), [t1, t2), [t2, t3), [t3, t4), [t4, t5), [t5, +inf]
[0087] In the above formula, inf represents infinity, and the six levels correspond to each other from left to right.
[0088] To ensure that the classification and grading results always move in the correct direction, this embodiment uses the midpoint of the intermediate classification interval as the regression label, while the boundary intervals are calculated based on the offset. Let the regression label be y. i The specific expression is as follows:
[0089]
[0090] In the above formula, y i t represents the regression label for the i-th grade diamond. i This represents the element in the classification threshold, where 'a' represents the offset and 'a > 0', and M represents the total number of classification intervals. In this embodiment, M is set to 6.
[0091] Specifically, when classifying diamonds based on the number of inclusions, a natural threshold is typically chosen, i.e., classification threshold T = [0.5, 1.5, 2.5, 3.5, 4.5], with an offset a = 0.5. The calculated regression labels are [0, 1, 2, 3, 4, 5]. Figure 4 As shown.
[0092] S5. Compare the diamond clarity score with the classification threshold and regression label to determine the diamond classification grade.
[0093] To quickly and accurately determine the grade of a diamond to be classified, it is necessary to construct a mapping function G(s) that converts diamond clarity score into diamond classification grade. The specific expression is as follows:
[0094]
[0095] In the above formula, s represents the diamond clarity score, and t i represents the classification threshold, and M represents the total number of classification intervals.
[0096] According to the mapping function G(s), when t i ≤s<t i+1 When the diamond classification level is i, the corresponding regression label is y. i =0.5(t) i +t i+1 To make diamond classification and grading results more accurate, this embodiment sets up a threshold-based ordered regressor. If s < y i If s > y, the diamond classification result will be biased towards a higher grade. i If the diamond's clarity score s = 2.6, the diamond's classification grade falls within the range [2.5, 3.5), and the classification grade is 3. Since s < y, the diamond's classification grade will tend towards a higher level. Figure 5 As shown.
[0097] S6. Convert the preprocessed image data into a heatmap using the gradient-based class activation graph algorithm, and output the heatmap along with the corresponding diamond classification grade results.
[0098] By employing a gradient-based class activation map algorithm to transform preprocessed image data into a heat map that can highlight diamond inclusions, the inclusions are visualized. The heat map, along with the corresponding diamond classification results, is output together, enabling interpretation of the diamond classification results and enhancing reliability.
[0099] Among them, such as Figure 6 As shown, the steps for constructing the classification and ranking model in step S3 include:
[0100] S100. Obtain several labeled image data to form a training dataset.
[0101] Specifically, firstly, multiple slice images of each diamond are captured using an image acquisition device at different focusing distances. Then, a multi-focus image fusion algorithm is used to fuse multiple slice images of the same diamond to obtain a fused image that clearly shows all inclusions. Next, the Canny edge detection algorithm is used to find the diamond edges and crop them to obtain a diamond image with the background removed. Finally, professionals grade the diamond according to the type and location of the inclusions and use the diamond grade as a label to obtain labeled image data. Several labeled image data sets constitute a training set.
[0102] S200. Add multi-scale feature fusion modules to the penultimate, third, and fourth MBConv structure of the convolutional neural network, and fuse the ordered regressor to the end of the convolutional neural network to obtain a multi-scale ordered regression network.
[0103] like Figure 7As shown, a multi-scale feature fusion module is added to the penultimate and penultimate MBConv layers of the existing convolutional neural network to fuse abstract features and fine-grained features to obtain better feature representation. In addition, an ordered regressor is added to the end of the existing convolutional neural network to make the output result directional, that is, the classification and ranking result always moves towards the correct direction. The ordered regressor includes a fully connected layer FC, a regressor layer Reg, and a threshold T.
[0104] S300. Train the multi-scale ordered regression network based on the training dataset to obtain the classification and ranking model.
[0105] Specifically, the parameters of the multi-scale ordered regression network are initialized, and the training dataset is input for optimization training. During the training of the multi-scale ordered regression network, in order to enhance the robustness of the classification and ranking model, the L1 loss function and SGD optimization method are used to optimize the multi-scale ordered regression network. At the same time, by setting the ordered regressor, it is ensured that the training process continuously iterates towards more accurate classification results. In addition, a random deactivation strategy is adopted during the training process, which can effectively prevent overfitting and improve the accuracy and stability of the classification and ranking model.
[0106] In this embodiment, preprocessing slice images of diamonds at different depths to be classified and graded yields preprocessed image data that clearly displays all inclusions and removes the diamond background. After convolution to obtain corresponding feature vectors, a multi-scale feature fusion module fuses abstract and fine-grained features at different scales, facilitating the subsequent extraction of detailed diamond features. Based on the extracted features, a diamond clarity score is calculated to measure the number of inclusions. Then, a threshold-based ordered regressor is used to map the diamond classification and grading based on the ordered relationship between diamond grades, ensuring the classification and grading results are closer to the correct direction and significantly improving accuracy. Furthermore, a gradient-based class activation map algorithm is used to convert the preprocessed image data into a heatmap that highlights diamond inclusions. The heatmap and the corresponding diamond classification and grading results are output together, visualizing the inclusions and facilitating interpretation of the grading results, thus verifying the reliability of the classification and grading model.
[0107] Please refer to Figure 8 This embodiment also provides a system for implementing the above-described diamond grading classification method, comprising:
[0108] The slice image acquisition module 10 is used to acquire slice images of diamonds at different depths to be classified and graded, taken by an image acquisition device using multiple different focusing distances.
[0109] The slice image preprocessing module 20 is used to fuse slice images of diamonds to be classified and graded using a multi-focus image fusion algorithm, and then use edge detection to detect the position of the diamond in the fused image and crop to remove the diamond background, so as to obtain preprocessed image data that can clearly display all the inclusions of the diamond at the same time.
[0110] The diamond clarity score calculation module 30 is used to input the pre-processed image data into a pre-built classification and grading model for feature fusion processing, to obtain feature vectors that integrate abstract features and fine-grained features of different scales, and then perform regression analysis and calculation on the feature vectors to obtain the diamond clarity score.
[0111] The regression label generation module 40 is used to divide the diamonds to be classified and graded into M classification intervals according to the preset classification threshold in the classification and grading model, and calculate the regression label according to the classification interval corresponding to the classification level, so that the classification and grading results move closer to the correct direction.
[0112] The diamond classification and grading module 50 is used to compare the diamond clarity score with the classification threshold and regression label to determine the diamond classification grade, thereby enabling rapid and accurate classification of diamonds to be classified.
[0113] The image conversion output module 60 is used to convert the preprocessed image data into a heat map that can highlight the inclusions in the diamond according to the gradient-based class activation map algorithm, and output the heat map and the corresponding diamond classification grade result together to facilitate the interpretation of the diamond classification grade result.
[0114] This invention trains a convolutional neural network based on multi-scale feature fusion and an improved ordered regressor as a classification and grading model. After inputting the preprocessed diamond image to be classified and graded into the classification and grading model, it can quickly and accurately complete the classification and grading task of the diamond image to be classified automatically, and further improve the accuracy of diamond classification and grading, improve classification efficiency, and enhance practicality.
[0115] The above embodiments provide a detailed description of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A classification method for grading diamonds, characterized in that, Includes the following steps: Acquire slice images of diamonds at different depths to be classified and graded, captured by an image acquisition device; The slice images of diamonds to be classified and graded are preprocessed to obtain preprocessed image data; The preprocessed image data is input into a pre-built classification and grading model for feature processing and regression calculation to obtain the diamond clarity score. The specific steps for constructing the classification and grading model include: Acquire a number of labeled image data to form a training dataset; Multi-scale feature fusion modules are added to the penultimate, third, and fourth MBConv layers of the convolutional neural network, and the ordered regressor is fused to the end of the convolutional neural network to obtain a multi-scale ordered regression network. The multi-scale ordered regression network is trained based on the training dataset to obtain a classification and ranking model; Includes the following steps: The preprocessed image data is convolved to obtain a feature map; The feature map is downsampled to obtain the corresponding first feature vector; The first feature vector is concatenated and fused according to the feature dimension to obtain the fused second feature vector; Regression calculation is performed on the second feature vector to obtain the diamond clarity score; The diamonds to be classified and graded are divided into M classification intervals according to the preset classification threshold in the classification and grading model, and regression labels are calculated based on the classification intervals. The expression for the regression label is: ; In the above formula, Indicates the first The return of graded diamond labels This represents the elements in the classification threshold. Indicates the offset and , Indicates the total number of classification intervals; The diamond clarity score is compared with the classification threshold and regression label to determine the diamond classification level.
2. The classification method according to claim 1, characterized in that, The method also includes: The preprocessed image data is converted into a heatmap using a gradient-based class activation graph algorithm, and the heatmap and the corresponding diamond classification grade result are output together.
3. The classification method according to claim 1, characterized in that, The labeled image data refers to images that clearly display all inclusions and are labeled with the diamond grade indicated by professionals.
4. The classification method according to claim 1, characterized in that, The process of preprocessing the slice images of diamonds to be classified and graded to obtain preprocessed image data includes the following steps: The multi-focus image fusion algorithm is used to fuse multiple slice images of the same diamond sequentially to obtain a fused image of the diamond to be classified and graded. An edge detection algorithm was used to detect the position of the diamond in the fused image and the diamond was cropped to obtain preprocessed image data with the diamond background removed.
5. A system for implementing the classification method for diamond grading as described in any one of claims 1-4, characterized in that, include: The slice image acquisition module (10) is used to acquire slice images of diamonds at different depths to be classified and graded by the image acquisition device. The slice image preprocessing module (20) is used to preprocess the slice image of the diamond to be classified and graded to obtain preprocessed image data; Diamond clarity score calculation module (30), the diamond clarity score calculation module (30) is used to input the preprocessed image data into the pre-built classification and grading model for feature processing and regression calculation to obtain the diamond clarity score; The regression label generation module (40) is used to divide the diamond to be classified and graded into M classification intervals according to the preset classification threshold in the classification and grading model, and to calculate the regression label according to the classification interval; The diamond classification grade determination module (50) is used to compare the diamond clarity score with the classification threshold and regression label to determine the diamond classification grade.
6. The system for the classification method for diamond grading according to claim 5, characterized in that, Also includes: Image conversion output module (60) is used to convert the preprocessed image data into a heat map according to the gradient-based class activation map algorithm, and output the heat map and the corresponding diamond classification grade result together.
Citation Information
Patent Citations
Intelligent method for grading diamond cleanliness
CN110766036A
Intelligent method for multi-scale grading and content visualization of diamonds
CN110766663A