A diamond sorting method and system based on image recognition
Through multi-angle macro image acquisition and adaptive bilateral filter processing, combined with Canny edge detection and HU moment algorithm, the SVM model is used for supervised learning, which solves the problem of light interference and reflected light in traditional image processing methods, and realizes high-precision automatic sorting of rough diamonds.
Patent Information
- Application Number
- CN202411342544.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-09-25
AI Technical Summary
When traditional image processing methods process rough diamond images, it is difficult to effectively eliminate light interference and reflected light, resulting in blurred defects and blurred details, and it is impossible to accurately distinguish reflected light from actual defects.
Multi-angle macro image acquisition, brightness histogram analysis and DBSCAN clustering algorithm are used to identify high-reflection areas, and the high-reflection areas are smoothed with adaptive bilateral filters to obtain edge binary images. Shape features are extracted through Canny edge detection and HU moment algorithm, and supervised learning is used to realize automated clarity classification and sorting.
It significantly improves the defect detection capability under the surface reflection problem of rough diamonds, realizes high-precision automatic sorting of rough diamonds, and avoids the problems of loss of details and insufficient processing in traditional methods.
Smart Images

Figure CN119206709B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a diamond sorting method and system based on image recognition. Background Art
[0002] As a precious gemstone, diamond is widely used in the jewelry industry and industry for its extremely high hardness, excellent optical properties and rarity. Traditional natural diamonds are formed in the deep earth under high temperature and high pressure environment and have evolved over millions of years. With the advancement of science and technology, artificially grown diamonds have gradually become a substitute for natural diamonds. Artificially grown diamonds are grown in a laboratory environment through technologies such as simulated geological conditions or chemical vapor deposition, and have the same physical and chemical properties as natural rough diamonds.
[0003] Diamond sorting refers to the process of classifying diamonds by quality grade by evaluating indicators such as color, clarity, cut and carat weight. Clarity assessment is particularly important, so when sorting artificially grown diamonds, a preliminary clarity test can be performed on the rough diamonds produced. Accurately detecting the internal and surface defects of the rough diamonds is the key to clarity grading. However, since the rough diamonds grown also have multiple facets and a smooth surface with high reflectivity, strong light reflection and glare effects will occur during image acquisition, seriously interfering with the identification of defects.
[0004] At present, the technical methods used to eliminate the influence of illumination in images include filtering, image denoising, etc. However, these methods still have defects when applied to rough diamond image processing. For the strong reflection areas in the rough diamond image, traditional filtering may over-smooth these areas, resulting in the smearing of defect details and the inability to accurately distinguish between reflected light and actual defects. Therefore, a more effective and innovative image preprocessing method is urgently needed to deal with the problem of reflected light and illumination interference in rough diamond images, so as to improve the clarity detection effect in the rough diamond sorting process. Summary of the invention
[0005] In view of the problem that illumination interference and reflected light are prone to occur in the above-mentioned rough diamond images, in the first aspect, the present invention proposes a diamond sorting method based on image recognition, comprising: obtaining images of the rough diamond surface at multiple set angles; obtaining a highlight area in the image; performing morphological operations on the highlight area to obtain a high-reflection area; using a bilateral filter to smooth the high-reflection area, wherein the adaptive spatial domain standard deviation of the bilateral filter is positively correlated with the maximum gradient value in the filter window and negatively correlated with the average rate of change of the gradient in the filter window; the adaptive range standard deviation of the bilateral filter is positively correlated with the brightness in the high-reflection area. The invention discloses a method for obtaining a rough diamond image after smoothing by using a binary edge image; annotating a defective area in the binary edge image and obtaining a clarity grade label of the rough diamond corresponding to the binary edge image; extracting shape features of the defective area as a feature vector, training the feature vector and the clarity grade label of the rough diamond as input data of a supervised learning model, and obtaining a trained model; inputting a rough diamond image obtained in subsequent production into the trained model to obtain the clarity grade of the rough diamond, and sorting the rough diamonds produced subsequently according to the clarity grade.
[0006] The present invention acquires multi-angle macro images, combines brightness histogram analysis with clustering algorithms, and accurately identifies areas with strong reflected light on the surface of rough diamonds, avoiding the problem of blurring defect details caused by reflection in traditional image processing methods. The highly reflective area is smoothed by an adaptive bilateral filter, and the filter parameters are adaptively adjusted to retain details while eliminating noise, avoiding the problem of fixed filter parameters in the prior art, resulting in loss of details or insufficient processing. In addition, combined with the manually annotated defect areas, shape features are extracted, and supervised learning is performed using the SVM model to achieve automated clarity classification and sorting.
[0007] Furthermore, the process of obtaining the adaptive spatial domain standard deviation is as follows:
[0008]
[0009] where σ s (ρ s ) represents the adaptive spatial domain standard deviation of the bilateral filter; Indicates the maximum gradient value in the filter window; N indicates the number of pixels in the filter window; Represents the gradient strength of the j-th pixel in the filter window.
[0010] In the present invention, the adaptive spatial domain standard deviation is dynamically adjusted according to the change of local gradient, so that more details can be retained in high gradient change areas, such as the cut surface of the rough diamond surface, and the smoothing effect is enhanced in low gradient areas such as smooth surfaces. Through this adaptive adjustment, the accuracy of image smoothing processing is significantly improved, ensuring that suitable filtering effects can be obtained in different areas. The bilateral filter parameters in the prior art are usually fixed values and cannot be flexibly adjusted according to the local characteristics of the image, resulting in some details being lost or insufficient smoothing.
[0011] Furthermore, the process of obtaining the adaptive range standard deviation is as follows:
[0012]
[0013] where σ r (ΔL) represents the standard deviation of the adaptive range of the bilateral filter; L max Indicates the maximum brightness level in the entire high-reflection area; L min It represents the minimum brightness level in the entire high-reflection area; ΔL represents the extreme difference of the brightness level within the filter window.
[0014] Furthermore, obtaining the highlight area in the image also includes: constructing a brightness histogram of each image, clustering the brightness levels in the brightness histogram; taking the data points contained in the cluster where the cluster center point is located that is greater than a set threshold as highlight pixels, and the area formed by the highlight pixels is the highlight area; the method for obtaining the set threshold is:
[0015] T L =μ+k×σ;
[0016] Where T L represents the set threshold; μ is the mean value of image brightness; σ is the standard deviation of image brightness; k is the empirical coefficient.
[0017] Furthermore, clustering the brightness levels in the brightness histogram further includes: clustering the brightness levels using a DBSCAN clustering algorithm.
[0018] Furthermore, the edge binary image is obtained by using a Canny edge detection algorithm.
[0019] The Canny edge detection algorithm is used in the present invention to extract the facet edges and defect edges of rough diamonds. The algorithm can accurately capture edge information while eliminating noise through steps such as smoothing, gradient calculation, and non-maximum suppression, and can especially extract the subtle defect edges of rough diamonds under complex lighting conditions. The present invention uses the Canny algorithm, which can better suppress noise and extract complete edges, ensuring that defect areas are accurately identified, and is superior to traditional edge detection algorithms.
[0020] Furthermore, extracting shape features from the defect area as a feature vector also includes: extracting shape features from the defect area using an HU moment algorithm; and using the HU moment calculation result as the feature vector of the defect area.
[0021] By extracting shape features from defective areas through the HU moment algorithm, the geometric morphology of surface or internal defects of rough diamonds can be accurately characterized. As an invariant moment, the HU moment can maintain the stability of shape features under different angles, scales and rotation conditions, ensuring the accuracy of feature extraction. Traditional shape feature extraction methods often lead to unstable features when facing images at different angles or rotations, thus affecting classification accuracy.
[0022] Furthermore, the supervised learning model is a SVM support vector machine model.
[0023] The present invention uses SVM support vector machine as a supervised learning model, and constructs an accurate clarity classification model through training through annotated feature vectors and clarity labels. SVM can construct classification boundaries in high-dimensional space to ensure that rough diamonds of different clarity levels can be accurately distinguished. Existing classification methods such as KNN and decision trees are difficult to find accurate classification boundaries when faced with complex features, and the classification effect is poor.
[0024] Furthermore, the rough diamond images obtained in subsequent production are input into the trained model to obtain the clarity grade of the rough diamond, and further includes: for any rough diamond produced subsequently, there are multiple images at different angles, and the lowest level of the corresponding clarity grades obtained after the multiple images are input into the model is used as the clarity grade of the rough diamond.
[0025] In a second aspect, the present invention provides a diamond sorting system based on image recognition, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the diamond sorting method based on image recognition of the present invention is implemented.
[0026] The technical effects of the present invention are:
[0027] The core innovation of the present invention is to use brightness histogram combined with DBSCAN clustering algorithm to accurately identify high-reflection areas, and to process the influence of illumination through adaptive bilateral filter, which significantly improves the defect detection capability under the reflection problem of rough diamond surface. In addition, by combining Canny edge detection and shape features extracted by HU moment algorithm, the SVM model is used for automatic clarity classification, realizing high-precision automatic sorting of rough diamonds. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0029] Figure 1 is a flowchart schematically showing a diamond sorting method based on image recognition in an embodiment of the present invention;
[0030] Figure 2 is a grayscale diagram schematically showing an artificially grown rough diamond according to an embodiment of the present invention;
[0031] Figure 3 is a schematic diagram schematically showing a multi-angle view of a diamond photographed by a camera in an embodiment of the present invention;
[0032] Figure 4 FIG. 1 is a block diagram schematically showing the structure of a diamond sorting system based on image recognition according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0034] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0035] Diamond sorting method embodiment based on image recognition:
[0036] like Figure 1 As shown, the diamond sorting method based on image recognition of the present invention comprises:
[0037] S1. Use a macro camera mounted on a robotic arm to take macro images of the rough diamond surface at multiple angles.
[0038] Artificially grown diamonds, also known as laboratory-grown diamonds or synthetic diamonds, are diamonds made in laboratories or factories under artificially controlled conditions. Although the formation process is different from that of natural diamonds, their chemical composition and crystal structure are basically the same as natural diamonds. They also have extremely high hardness and optical properties. Therefore, artificially grown diamonds are also widely used in the jewelry industry and industrial fields.
[0039] There are two main methods for manufacturing artificially grown diamonds, namely high temperature and high pressure method and chemical vapor deposition method. Although both manufacturing processes are in a relatively stable and clean environment, the artificial diamonds grown contain fewer impurities and have a higher yield rate than natural diamonds, but due to the subtle differences in parameters between different equipment during the production process and slight changes in control parameters during the cultivation process, artificially grown diamonds will also have quality differences. Therefore, in this embodiment, an image recognition method is used to sort artificially grown rough diamonds based on clarity standards. It should be noted that the rough diamonds mentioned later in this embodiment refer to artificially grown rough diamonds, not natural diamonds, and the rest will not be repeated.
[0040] After the rough diamond cultivation phase is completed, it is placed on the material platform, and the automatic diversion equipment transports each rough diamond to the sorting platform in order of size from large to small. In order to accurately capture the surface and internal defects of the rough diamond, a movable surrounding LED light strip is first arranged on the sorting platform to increase the brightness of the detection environment and reduce the shadow area of the object caused by a single light source; then a high-resolution industrial macro camera with at least 50 million pixels is selected to take macro images of the rough diamond. In addition: the camera is mounted on a robotic arm, which has a high-precision motion control system that can accurately adjust the position and angle of the camera in three-dimensional space, so that the camera can shoot rough diamonds at various angles to ensure that all images taken of any rough diamond can include all the cut faces of the rough diamond; at the same time, when shooting at a specific angle, the surrounding LED light strip automatically adjusts its position to prevent blocking the shooting screen.
[0041] In one embodiment, each rough diamond can be taken as the shooting focus, the coordinates of the rough diamond are set as the origin O and a fixed shooting distance is set. In this embodiment, the fixed shooting distance can take an empirical value of 30 cm. A rough diamond macro image is taken every 90° on the horizontal plane determined by the XY axis, and a rough diamond top-view macro image is taken on the Z axis perpendicular to the horizontal plane. The shooting angles are as follows: Figure 2 shown.
[0042] S2. Divide the rough diamond surface image into regions based on the image brightness histogram; and determine the adaptive filter parameters based on the rough diamond characteristics.
[0043] S201, dividing the rough diamond surface image into regions based on the image brightness histogram.
[0044] In step S1, macro images of rough diamond at different angles are obtained, wherein a top view image is as follows: Figure 3As shown in the figure, it can be observed that since rough diamonds have multiple facets after cultivation, and each facet has high reflectivity, it is not easy for traditional methods to distinguish between reflected light and actual defects, and thus the actual defect details may be weakened or blurred when processing reflected light.
[0045] Because the reflection angles of different facets to the light source are not the same, some facets reflect the light source and just shoot it into the camera, resulting in a higher brightness of the facet in the picture; while the light source after the reflection of some facets does not directly shoot into the camera, so the brightness of the facet in the picture is moderate, and it is easy to observe the surface or internal defects of the rough diamond. Therefore, in this embodiment, the facets of the rough diamond are divided into regions, and then the areas with stronger reflection are further refined. By analyzing the histogram of the brightness of the macro image, the areas with the strongest reflection in the macro image are identified, and these areas often cover up the actual defects. Therefore, accurately identifying and processing these highlighted reflection areas is the key to macro image preprocessing.
[0046] The brightness value of each pixel in the rough diamond macro image is counted, and a brightness histogram is constructed based on all brightness values, where the X-axis represents the brightness level and the Y-axis represents the number of pixels at each brightness level. By analyzing the distribution characteristics of the histogram, the intervals with higher brightness values are identified. Usually, these high brightness intervals correspond to areas with strong reflection on the surface of the rough diamond. Since there are too many facets on the surface of the rough diamond, the number of brightness levels in the corresponding brightness histogram will also be large. Therefore, all brightness levels in the brightness histogram are clustered first. The DBSCAN algorithm can be used to cluster the brightness levels. The input of the algorithm includes all brightness levels, neighborhood radius and minimum number of points. The neighborhood radius ε can take the empirical value of 0.6, and the minimum number of points MinPts can take the empirical value of 5. The output of the algorithm includes the cluster label of each data point and the core point of the cluster.
[0047] First, the brightness level corresponding to the core point of the i-th cluster is recorded as L i , the brightness levels of all cluster core points constitute a brightness level sequence, denoted as S L , use the brightness feature of the core point of each cluster to describe the characteristics of the cluster where the core point is located. Then determine a brightness threshold T L , the brightness level sequence S L Greater than the brightness threshold T L The area composed of all pixels in the cluster where the core point is located corresponding to the brightness level is recorded as the highlight area, where the brightness threshold T L The way to obtain is:
[0048] T L =μ+k×σ
[0049] That is, when L i >T L, it means that the brightness level corresponding to the core point of the i-th cluster is greater than the set brightness threshold, then L i The area corresponding to all pixels in the cluster is the highlight area. After obtaining all the highlight areas in the macro image, these areas are further processed using the closing operation in the morphological operation to connect isolated highlight pixels and form connected areas. The connected highlight areas are recorded as high-reflection areas, and the remaining areas are recorded as normal areas.
[0050] S202: Determine adaptive filter parameters based on rough diamond characteristics.
[0051] After obtaining the high-reflection area of the rough diamond macro image in step S201, a filter is used to process it, so that the brightness of the picture is uniform, which is convenient for identifying the defects of the rough diamond. In this embodiment, a bilateral filtering algorithm can be used to process the high-reflection area in the rough diamond macro image, and the macro image is smoothed and denoised while retaining the detailed features of the defect edge. However, the parameters of the conventional bilateral filtering algorithm are fixed, and it is easy to weaken or lose details due to improper parameter selection. Therefore, in this embodiment, the adaptive filter parameters are determined for the high-reflection area of the rough diamond macro image.
[0052] For the bilateral filter, the filtering process depends on two main parameters, namely the spatial domain standard deviation σ s And the range standard deviation σ r , for the brightness image in this embodiment, the range here refers to the brightness range, and the range of the filter involved in the subsequent embodiments refers to the brightness range. These two parameters control the smoothness of the filter in space and in the brightness range respectively. Due to the multi-faceted structural characteristics of rough diamonds, high reflection areas are usually accompanied by large spatial gradient changes. Therefore, the spatial domain standard deviation σ s It should be related to the density of local sections. Specifically, the section density can be estimated by the average rate of change of the local gradient:
[0053]
[0054] where ρ s represents the local section density, that is, the section density within the filter window. In this embodiment, the filter window size can take an empirical value of 5×5; N represents the number of pixels within the filter window; Represents the gradient strength of the jth pixel in the filter window. For the spatial domain standard deviation, its adaptive expression is as follows:
[0055]
[0056] where σ s (ρ s ) represents the adaptive spatial domain standard deviation; Represents the maximum gradient value within the filter window; ρ s Represents the slice density within the filter window.
[0057] When s The larger the value, the larger the facet density in the filter window, that is, the larger the local gradient change, and there may be multiple small facets or reflection points on the surface of the rough diamond. s (ρ s ) is smaller, avoiding over-smoothing of details; when ρ s The smaller it is, the smoother the area in the filter window is, and the smaller the local gradient change is. s (ρ s ) is larger, the noise reduction effect is enhanced. The adaptive processing of the spatial domain standard deviation is shown in the above steps. Similarly, the adaptive logic of the value range standard deviation is the same as above. The specific adaptive formula is as follows:
[0058]
[0059] where σ r (ΔL) represents the standard deviation of the adaptive range; L max Indicates the maximum brightness level in the entire high-reflection area; L min It represents the minimum brightness level in the entire high-reflection area; ΔL represents the extreme difference of the brightness level within the filter window.
[0060] When ΔL is larger, it means that there is a significant change in brightness value in the filter window, which may correspond to the edge or defect detail area of the rough diamond. To avoid excessive smoothing leading to loss of details, σ r The smaller (ΔL), the more sensitive the filter is in the value range, and the details of the macro image are retained; when ΔL is smaller, it means that the brightness of the area changes slowly, which may be the smooth cut surface of the rough diamond surface, then σ r The larger the (ΔL), the greater the smoothing effect of the filter and the less noise interference. The spatial domain standard deviation σ of the bilateral filter s And the range standard deviation σ r After the adaptive improvement, an adaptive bilateral filter is used to process the high reflection area in each rough diamond macro image, while a median filter is used to process the normal area. This algorithm is a well-known technology and will not be described in detail here.
[0061] In the present invention, the adaptive spatial domain standard deviation is dynamically adjusted according to the change of local gradient, so that more details can be retained in high gradient change areas, such as the cut surface of the rough diamond surface, and the smoothing effect is enhanced in low gradient areas such as smooth surfaces. Through this adaptive adjustment, the accuracy of image smoothing processing is significantly improved, ensuring that suitable filtering effects can be obtained in different areas. The bilateral filter parameters in the prior art are usually fixed values and cannot be flexibly adjusted according to the local characteristics of the image, resulting in some details being lost or insufficient smoothing.
[0062] S3, identifying defective areas of the rough diamond image after smoothing; extracting feature vectors for model training.
[0063] S301, identifying defective areas of a rough diamond image after smoothing.
[0064] In step S301, a rough diamond macro image after smoothing by a filter is obtained, and then the rough diamond defects are identified by a feature extraction algorithm. In this embodiment, the Canny edge detection algorithm can be used, which has good noise suppression ability while maintaining the image edge details. These edge information can reflect the boundaries of cracks, scratches or inclusions on the surface of the rough diamond, which is helpful for the judgment of clarity. The input of the algorithm is a rough diamond macro image after eliminating the influence of light, and the output of the algorithm is a binary image, in which white pixels represent the rough diamond edge, facet edge and defect outline, and black pixels represent the smooth facet of the rough diamond. As a known technology, the algorithm will not be described here.
[0065] The Canny edge detection algorithm is used in the present invention to extract the facet edges and defect edges of rough diamonds. The algorithm can accurately capture edge information while eliminating noise through steps such as smoothing, gradient calculation, and non-maximum suppression, and can especially extract the subtle defect edges of rough diamonds under complex lighting conditions. The present invention uses the Canny algorithm, which can better suppress noise and extract complete edges, ensuring that defect areas are accurately identified, and is superior to traditional edge detection algorithms.
[0066] S302: Extract feature vectors for model training.
[0067] In the normal operation process, the sorting of rough diamonds is usually completed by diamond sorters. This process is very important for the grading of rough diamonds. At the same time, the requirements for rough diamond sorters are also very strict, requiring years of experience accumulation and excellent professional skills. Therefore, after obtaining the binary image of the edge of the rough diamond, the rough diamond sorter compares the original image of the rough diamond to mark the defects in the binary image of the edge of the rough diamond and gives a clarity grading label.
[0068] In one embodiment, multi-angle macro images of 100 rough diamonds can be taken, and each rough diamond has 5 images, totaling 500 images, and the corresponding edge binary images are obtained after smoothing and feature extraction. The rough diamond sorter uses the LabelMe annotation tool to compare the original macro image of the rough diamond to annotate the defective area in the edge binary image, and gives the corresponding clarity level of the rough diamond in combination with the original image. After obtaining the defective area in the edge binary image, the HU moment algorithm is used to obtain the HU moment calculation result of each defective area as the feature vector of the defective area. The algorithm is a well-known technology and will not be described here. In addition to 100 rough diamonds, 200, 300 or 500 can also be selected. The implementer can select according to the actual situation to achieve a better model data training effect.
[0069] By extracting shape features from defective areas through the HU moment algorithm, the geometric morphology of surface or internal defects of rough diamonds can be accurately characterized. As an invariant moment, the HU moment can maintain the stability of shape features under different angles, scales and rotation conditions, ensuring the accuracy of feature extraction. Traditional shape feature extraction methods often lead to unstable features when facing images at different angles or rotations, thus affecting classification accuracy.
[0070] In the above content, the labeled rough diamond edge binary image, the feature vector of the labeled image and the clarity level corresponding to the rough diamond image are obtained, and the 100 labeled rough diamond data sets are divided into a training set and a test set, wherein the training set takes 80 labeled rough diamond data sets, and the test set takes 20 labeled rough diamond data sets. The feature vectors of the labeled images in the training set and the corresponding clarity level labels are input into the SVM support vector machine for model training. After the trained model is obtained, the test set is used to evaluate the model. The input of the SVM support vector machine is the feature vector and the clarity level label of the training set, and the output is the trained and evaluated SVM support vector machine model. The algorithm is a well-known technology and will not be described here in detail.
[0071] The present invention uses SVM support vector machine as a supervised learning model, and constructs an accurate clarity classification model through training through annotated feature vectors and clarity labels. SVM can construct classification boundaries in high-dimensional space to ensure that rough diamonds of different clarity levels can be accurately distinguished. Existing classification methods such as KNN and decision trees are difficult to find accurate classification boundaries when faced with complex features, and the classification effect is poor.
[0072] S4. Sorting rough diamonds based on the trained model.
[0073] In summary, for any rough diamond placed on the automatic sorting platform, multi-angle macro images are first taken; then an adaptive bilateral filter is used to smooth the high-reflection area and a median filter is used to smooth the normal area; then edge detection and feature vector extraction are performed on the smoothed rough diamond macro image; the feature vector after image extraction is further put into the SVM support vector machine model trained in step S3. Since each rough diamond has multiple macro images at different angles, there will be a clarity level classification result for different macro images of the same rough diamond. After outputting the clarity classification results corresponding to the multiple macro images, the lowest clarity level among the clarity levels corresponding to the multiple macro images is used as the clarity level of the rough diamond.
[0074] For example, for a rough diamond in subsequent production, a total of 5 images at different angles are taken. After each image is processed and input into the SVM support vector machine model, the output results are (Lv 1 =A+,Lv 2 =B,Lv 3 =C,Lv 4 =C,Lv 5 =A+), where A+, B, C, etc. are the grading standards for the clarity of rough diamonds, which can be customized by manufacturers or organizations such as the Diamond Alliance, and will not be elaborated here. Since the defects shown in images taken at different angles may be different, the lowest level C among the clarity levels corresponding to the 5 images is used as the clarity level of the rough diamond; finally, the sorting equipment transports it to the corresponding storage bin according to the classification results.
[0075] The present invention acquires multi-angle macro images, combines brightness histogram analysis with clustering algorithms, and accurately identifies areas with strong reflected light on the surface of rough diamonds, avoiding the problem of blurring defect details caused by reflection in traditional image processing methods. The highly reflective area is smoothed by an adaptive bilateral filter, and the filter parameters are adaptively adjusted to retain details while eliminating noise, avoiding the problem of fixed filter parameters in the prior art, resulting in loss of details or insufficient processing. In addition, combined with the manually annotated defect areas, shape features are extracted, and supervised learning is performed using the SVM model to achieve automated clarity classification and sorting.
[0076] On the other hand, the present invention also provides a diamond sorting system based on image recognition. Figure 4 As shown, the diamond sorting system based on image recognition includes a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, a diamond sorting method based on image recognition according to the first aspect of the present invention is implemented.
[0077] The diamond sorting system based on image recognition also includes other components well known to those skilled in the art, such as a communication interface, whose configuration and functions are known in the art and will not be described in detail here.
[0078] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that may be used to store the required information and may be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.
[0079] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0080] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A diamond sorting method based on image recognition, characterized in that: The method comprises: Acquire images of the rough diamond surface at multiple set angles; Acquire a highlight area in the image; perform morphological operation on the highlight area to obtain a high-reflection area; The high-reflection area is smoothed using a bilateral filter, wherein the adaptive spatial domain standard deviation of the bilateral filter is positively correlated with the maximum gradient value in the filter window and negatively correlated with the average rate of change of the gradient in the filter window; the adaptive value domain standard deviation of the bilateral filter is positively correlated with the extreme brightness difference in the high-reflection area and negatively correlated with the extreme brightness difference in the filter window; Obtain an edge binary image of the rough diamond image after smoothing; mark the defect area in the edge binary image and obtain the clarity grade label of the rough diamond corresponding to the edge binary image; extract shape features of the defect area as feature vectors, and use the feature vectors and the clarity grade label of the rough diamond as input data of a supervised learning model for training to obtain a trained model; The rough diamond images obtained in subsequent production are input into the trained model to obtain the clarity grade of the rough diamonds, and the rough diamonds produced subsequently are sorted according to the clarity grade.
2. A diamond sorting method based on image recognition according to claim 1, characterized in that: The process of obtaining the adaptive spatial domain standard deviation is as follows: where σ s (ρ s ) represents the adaptive spatial domain standard deviation of the bilateral filter; Indicates the maximum gradient value in the filter window; N indicates the number of pixels in the filter window; Represents the gradient strength of the j-th pixel in the filter window.
3. The diamond sorting method based on image recognition according to claim 1, characterized in that: The process of obtaining the adaptive range standard deviation is as follows: where σ r (ΔL) represents the standard deviation of the adaptive range of the bilateral filter; L max Indicates the maximum brightness level in the entire high-reflection area; L min It represents the minimum brightness level in the entire high-reflection area; ΔL represents the extreme difference of the brightness level within the filter window.
4. The diamond sorting method based on image recognition according to claim 1, characterized in that: Get the highlighted area in the image, including: Construct a brightness histogram of each image, cluster the brightness levels in the brightness histogram; take the data points contained in the cluster where the cluster center point greater than the set threshold is located as the highlight pixel points, and the area formed by the highlight pixel points is the highlight area; the method for obtaining the set threshold is: T L =μ+k×σ; Where T L represents the set threshold; μ is the mean value of image brightness; σ is the standard deviation of image brightness; k is the empirical coefficient.
5. A diamond sorting method based on image recognition according to claim 4, characterized in that: Clustering the brightness levels in the brightness histogram includes: The brightness levels are clustered using the DBSCAN clustering algorithm.
6. The diamond sorting method based on image recognition according to claim 1, characterized in that: The edge binary image is obtained by using the Canny edge detection algorithm.
7. The diamond sorting method based on image recognition according to claim 1, characterized in that: Extracting shape features of the defect area as feature vectors includes: Extracting shape features of the defect area using HU moment algorithm; The HU moment calculation result is used as the feature vector of the defect area.
8. The diamond sorting method based on image recognition according to claim 1, characterized in that: The supervised learning model is a SVM support vector machine model.
9. The diamond sorting method based on image recognition according to claim 1, characterized in that: The rough diamond images obtained in subsequent production are input into the trained model to obtain the clarity grade of the rough diamond, including: A plurality of images of a plurality of set angles of any rough diamond produced subsequently are obtained, and the lowest level among the corresponding clarity levels obtained after the plurality of images are input into the model is used as the clarity level of the rough diamond.
10. A diamond sorting system based on image recognition, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the diamond sorting method based on image recognition according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Black-and-white image colorizing method based on two-sided filter
CN101860655A
A method for removing highlight of image in natural scene
CN111080686A