Tobacco leaf quality judgment method, device and equipment and storage medium
By iteratively clustering the color type area to identify the tobacco leaf images, the problem of insufficient grading accuracy and efficiency of tobacco leaf quality caused by artificial experience dependence in the prior art is solved, and more efficient and accurate quality judgment is achieved.
Patent Information
- Application Number
- CN202510211265.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-06-10
AI Technical Summary
The prior art mainly relies on manual experience when grading tobacco leaf quality, resulting in insufficient grading accuracy and efficiency.
By acquiring the tobacco leaf images, iterative clustering automatically recognizes the color type area, and determines the tobacco leaf quality level based on the number of areas and area proportion.
It improves the accuracy and efficiency of tobacco quality judgment and reduces artificial errors.
Smart Images

Figure CN120125546A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of tobacco detection, and in particular, to a method, device, equipment and storage medium for determining the quality of tobacco leaves. Background Art
[0002] Imported tobacco leaves have a unique fragrance and are one of the indispensable raw materials for Chinese flue-cured tobacco cigarettes. At present, the total amount of imported tobacco leaves in China has reached 13,000 tons, and there is still a growing trend. However, imported tobacco leaves require a long transportation time during transportation. The long transportation time will extend the storage time of imported tobacco leaves. After being stored for a long time, imported tobacco leaves will change in appearance, and the color of the tobacco leaves will change. Long-term storage will cause the color of the tobacco leaves to become darker and the quality to decline.
[0003] The color of tobacco leaves is one of the important factors for identifying the quality of tobacco leaves. It determines the economic value of tobacco leaves and is also closely related to the chemical composition and internal quality of tobacco leaves. Therefore, tobacco leaves can be divided into different grades according to the different colors of imported tobacco leaves, and different grades of tobacco leaves are used to produce different grades of Chinese flue-cured tobacco cigarettes.
[0004] When grading and selecting imported tobacco leaves, the current main grading method is manual selection. Workers identify imported tobacco leaves through their experience and knowledge. However, due to the subjective judgment of workers, it is difficult to judge uniformly the tobacco leaves whose quality is at the qualified edge, and it is difficult to unify the quality classification standard of imported tobacco leaves. Summary of the Invention
[0005] The embodiments of the present invention provide a method, device, equipment and storage medium for determining the quality of tobacco leaves, which can automatically identify various color regions in tobacco leaves based on tobacco leaf images, and determine the quality of tobacco leaves according to the number and area of the color regions, improving the accuracy and efficiency of determining the quality of tobacco leaves.
[0006] In a first aspect, the embodiments of the present invention provide a method for determining the quality of tobacco leaves, the method comprising:
[0007] Obtain a target tobacco leaf image of a target tobacco leaf; perform iterative clustering on the color types in the target tobacco leaf image to determine at least one color type region in the target tobacco leaf image and the area ratio of each color type region; determine the tobacco leaf quality grade of the target tobacco leaf according to the number of color type regions in the target tobacco leaf image and the area ratio of each color type region.
[0008] In a second aspect, the embodiments of the present invention provide a device for determining the quality of tobacco leaves, the device comprising:
[0009] A tobacco leaf image acquisition module for acquiring a target tobacco leaf image of a target tobacco leaf; a color region determination module for iteratively clustering the color types in the target tobacco leaf image to determine at least one color type region in the target tobacco leaf image and the area proportion of each color type region; a tobacco leaf quality determination module for determining the tobacco leaf quality grade of the target tobacco leaf according to the number of color type regions in the target tobacco leaf image and the area proportion of each color type region.
[0010] In a third aspect, an embodiment of the present invention provides a computer device, which includes:
[0011] One or more processors;
[0012] A memory for storing one or more programs;
[0013] When the one or more programs are executed by the one or more processors, the one or more processors implement the tobacco leaf quality determination method described in any embodiment.
[0014] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the tobacco leaf quality determination method described in any embodiment.
[0015] The technical solution provided by the embodiment of the present invention includes: acquiring a target tobacco leaf image of a target tobacco leaf; iteratively clustering the color types in the target tobacco leaf image to determine at least one color type region in the target tobacco leaf image and the area proportion of each color type region; determining the tobacco leaf quality grade of the target tobacco leaf according to the number of color type regions in the target tobacco leaf image and the area proportion of each color type region. The technical solution of the embodiment of the present invention solves the problem that in the prior art, when grading the quality of tobacco leaves, it is mainly judged based on manual experience, which is prone to insufficient grading accuracy and efficiency. It can automatically identify various color regions in tobacco leaves based on tobacco leaf images, and determine the quality of tobacco leaves according to the number and area of color regions, improving the accuracy and efficiency of determining the quality of tobacco leaves. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flowchart of a tobacco leaf quality determination method provided by an embodiment of the present invention;
[0017] Figure 2 is another flowchart of a tobacco leaf quality determination method provided by an embodiment of the present invention;
[0018] Figure 3 is a schematic structural diagram of a tobacco leaf quality determination device provided by an embodiment of the present invention;
[0019] Figure 4 It is a schematic structural diagram of a computer device provided by an embodiment of the present invention. Specific embodiments
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0021] Figure 1 It is a flowchart of a method for determining the quality of tobacco leaves provided by an embodiment of the present invention. The embodiments of the present invention are applicable to scenarios for determining the quality of tobacco leaves. This method can be executed by a tobacco leaf quality determination device, and this device can be implemented in a software and / or hardware manner.
[0022] As Figure 1 shown, the method for determining the quality of tobacco leaves includes the following steps:
[0023] S110. Obtain a target tobacco leaf image of the target tobacco leaf.
[0024] Among them, the target tobacco leaf can be a tobacco leaf for which quality determination is required. The target tobacco leaf image can be an image of the target tobacco leaf. Specifically, the target tobacco leaf can be photographed based on a preset camera device, and then the target tobacco leaf image of the target tobacco leaf can be obtained. Preferably, when photographing the target tobacco leaf, the background of the tobacco leaf uses a background color that can be significantly distinguished from the color of the tobacco leaf. For example, the background color can be white, and the tobacco leaf is placed in a black box for photographing. The inner side wall of the black box is provided with a black background cloth to prevent light reflection, and the light source uses a light source that simulates natural light.
[0025] S120. Perform iterative clustering on the color types in the target tobacco leaf image, and determine at least one color type area in the target tobacco leaf image and the area ratio of each color type area.
[0026] Among them, the color type area can be an area occupied by one color type in the target tobacco leaf image. That is, if it is recognized that the target tobacco leaf image includes multiple color types, each color type can have a corresponding color type area. Specifically, iterative clustering can be performed on the pixel points in the target tobacco leaf image based on the gray value to obtain multiple clustering clusters. Each clustering cluster can be used as a color type, and all the pixel points in a clustering cluster can form the color type area corresponding to the clustering cluster. The area ratio can be the ratio of the area of the color type area to the total area of the target tobacco leaf image.
[0027] Specifically, for each color type area, the area of the color type area can be compared with the total area of the target tobacco leaf image, and the obtained ratio can be used as the area proportion corresponding to the color type area. By determining the color type areas in the target tobacco leaf image and the area proportion of each color type area, the quality of the target tobacco leaf can be determined based on the number and area proportion of the color type areas in the subsequent steps.
[0028] S130. Determine the tobacco leaf quality grade of the target tobacco leaf according to the number of color type areas in the target tobacco leaf image and the area proportion of each color type area.
[0029] Among them, the tobacco leaf quality grade can be the quality grade of the target tobacco leaf. Specifically, multiple quality grades can be preset, and different quality grades correspond to different degrees of superiority and inferiority of tobacco leaves. Further, the number of color type areas in the target tobacco leaf image and the area proportion of each color type area can be evaluated based on a preset quality evaluation standard, and the tobacco leaf quality grade of the target tobacco leaf can be determined according to the evaluation result.
[0030] The technical solution provided by the embodiments of the present invention obtains a target tobacco leaf image of a target tobacco leaf; performs iterative clustering on the color types in the target tobacco leaf image to determine at least one color type area in the target tobacco leaf image and the area proportion of each color type area; and determines the tobacco leaf quality grade of the target tobacco leaf according to the number of color type areas in the target tobacco leaf image and the area proportion of each color type area. The technical solution of the embodiments of the present invention solves the problem that in the prior art, when grading the quality of tobacco leaves, it is mainly judged based on manual experience, which is prone to insufficient grading accuracy and efficiency. It can automatically identify various color areas in tobacco leaves based on tobacco leaf images, and determine the quality of tobacco leaves according to the number and area of color areas, improving the accuracy and efficiency of determining the quality of tobacco leaves.
[0031] Figure 2 It is a flowchart of another method for determining the quality of tobacco leaves provided by the embodiments of the present invention. The embodiments of the present invention can be applied to the scenario of determining the quality of tobacco leaves. On the basis of the above embodiments, it further illustrates how to perform iterative clustering on the color types in the target tobacco leaf image to determine at least one color type area in the target tobacco leaf image; and how to determine the tobacco leaf quality grade of the target tobacco leaf according to the number of color type areas in the target tobacco leaf image and the area proportion of each color type area. This device can be implemented in software and / or hardware and integrated into a computer device with application development functions.
[0032] As Figure 2 shown, the method for determining the quality of tobacco leaves includes the following steps:
[0033] S210. Obtain a target tobacco leaf image of the target tobacco leaf.
[0034] Optionally, to facilitate subsequent analysis of the tobacco leaf image, after obtaining the target tobacco leaf image, background removal processing and grayscale processing can be performed on the target tobacco leaf image. Exemplarily, when removing the background part of the tobacco leaf image, a combination of truncation thresholding processing and super-threshold zero processing is used for background removal. Super-threshold zero processing: According to the lower threshold set for the image of the tobacco leaf surface, when removing the background part, each pixel point in the collected tobacco leaf image is compared with the lower threshold. The part smaller than the lower threshold is considered the background part and is removed, and the remaining part is retained for the image. Truncation thresholding processing: According to the upper threshold set for the image of the tobacco leaf surface, when removing the background part, each pixel point in the collected tobacco leaf image is compared with the upper threshold. The part larger than the upper threshold is considered the background part and is removed, and the remaining part is retained for the image. Among them, the setting process of the upper and lower thresholds is as follows: First, take a separate photo of the tray, convert the true-color image into a black-and-white image, divide the black-and-white image into multiple regions, read the grayscale values of each position of the tray, and determine the grayscale value range that does not belong to the characteristics of the tobacco leaf according to the grayscale value characteristics of the tray image; then, perform grayscale value characteristic analysis on the collected tobacco leaf image to determine the grayscale value range that belongs to the characteristics of the tobacco leaf, and select appropriate upper and lower thresholds in the transition area between the grayscale value range that does not belong to the characteristics of the tobacco leaf and the grayscale value range that belongs to the characteristics of the tobacco leaf.
[0035] Furthermore, the image after background removal processing can be grayscale processed so that the tobacco leaf image becomes a grayscale image, and the obtained grayscale image is used for subsequent image analysis processes.
[0036] S220. Perform iterative clustering on the color types in the target tobacco leaf image, determine at least one color type region in the target tobacco leaf image, and the area proportion of each color type region.
[0037] Optionally, performing iterative clustering on the color types in the target tobacco leaf image to determine the number of color type regions in the target tobacco leaf image includes:
[0038] Step 1: Perform initial clustering on the color type regions in the target tobacco leaf image, determine the clustering evaluation score after initial clustering, and determine the initial clustering number and at least one initial clustering center based on the clustering evaluation score;
[0039] Step 2: For each image pixel point in the target tobacco leaf image, respectively determine the clustering distance between the image pixel point and each initial clustering center, determine the target clustering center from the initial clustering center based on the clustering distance, and cluster the image pixel point towards the clustering center to obtain at least one candidate clustering cluster;
[0040] Step 3: For each candidate clustering cluster, re-determine the clustering center according to the image pixel points in the candidate clustering cluster, and determine the newly updated clustering center corresponding to the candidate clustering cluster;
[0041] Step 4: When the newly updated clustering center of each candidate clustering cluster is the same as the initial clustering center, take the number of candidate clustering clusters as the number of color type regions. When the newly updated clustering center of any candidate clustering cluster is inconsistent with the initial clustering center, take the newly updated clustering center as the initial clustering center and jump to Step 2 to re-perform clustering.
[0042] Among them, in Step 1, a preset clustering model can be used to perform initial clustering on the pixel points in the target tobacco leaf image. The weight vectors connecting the input nodes to each output node can be randomly set, and the number of iterations can be set. Then the model outputs at least one initial clustering cluster. Among them, the clustering model can be obtained by training based on the SOM (Self-Organizing Map) model. This model is an unsupervised neural network model. The input nodes refer to the first layer of the neural network, which receive data or signals from the outside world and correspond to each pixel value in the image. The weights are important parameters connecting each neuron. They determine the intensity of the input signal transmitted to the next layer. The weights can be regarded as the intensity or influence of the edge connecting two neurons and are one of the main parameters adjusted during the learning process. The neural network adjusts these weights to minimize the error between the predicted output and the actual output, thereby achieving learning and pattern recognition of the data. The output nodes are located in the last layer of the neural network, and they generate the final output of the network, that is, the prediction result of the model.
[0043] Furthermore, the clustering evaluation score can be an evaluation index for the clustering result of the initial clustering. Specifically, the clustering evaluation score can be determined based on the similarity of the data within the cluster and the difference between different clusters. The number of initial clusters can be the number of clustering clusters obtained after the initial clustering. The initial clustering center can be the center point of each clustering cluster after the initial clustering. Specifically, each clustering cluster can have one initial clustering center, that is, the number of initial clustering centers is the same as the number of initial clusters. Furthermore, the clustering result after the initial clustering can be adjusted based on the clustering evaluation score, and then the number of initial clusters and the initial clustering center can be determined according to the adjusted clustering result.
[0044] Optionally, when determining the clustering evaluation score after the initial clustering, the first evaluation score can be determined based on the within-cluster data distance and the between-cluster data distance after the initial clustering; the second evaluation score can be determined based on the within-cluster data covariance and the between-cluster data covariance after the initial clustering; the first evaluation score and the second evaluation score are weighted and summed to obtain the clustering evaluation score. Among them, the weights of the first evaluation score and the second evaluation score can be set according to needs.
[0045] Among them, the first evaluation score can be a distance evaluation parameter for the data between and within the clustering clusters. Exemplarily, the SC (Silhouette Coefficient) score can be selected as the first evaluation score. The calculation of the SC score is as follows:
[0046]
[0047] In the formula, a(i) represents the mean of the distances from sample i to all other points in its belonging cluster, and b(i) represents the minimum of the average distances from sample i to all points in the clusters it does not belong to. The closer the SC score is to 1, the better the clustering effect.
[0048] The second evaluation score can be a difference degree evaluation parameter for the data between and within the clustering clusters. Exemplarily, the CH (Calinski-Harabasz) score can be selected as the second evaluation score. The calculation of the CH score is as follows:
[0049]
[0050] In the formula, h is the number of clusters, N is the number of samples in the input space, B h is the between-cluster dispersion matrix, W h is the within-cluster dispersion matrix, c l is the center in cluster l, n l is the number of points in cluster l, C l is the center of cluster l, c is the center of the remaining clusters, x is the data in cluster l. If the covariance of the within-cluster data is smaller and the covariance of the between-clusters is larger, the CH score is larger, indicating a good clustering effect. That is, the samples of the same category in the clustering result are close in distance, and the samples of different categories are far apart.
[0051] In step two, the clustering distance can be the distance parameter between the image pixel points and the initial clustering centers. Specifically, the distance parameter between the image pixel points and each initial clustering center can be calculated, and then the clustering distance corresponding to each initial clustering center can be obtained. The target clustering center can be the clustering center to which the current image pixel point belongs. Specifically, the clustering distances corresponding to the current image pixel point and each initial clustering center can be compared, and the initial clustering center with the smallest clustering distance can be used as the target clustering center corresponding to the current image pixel point. The candidate clustering clusters can be the clustering clusters obtained after reclustering. Specifically, all the image pixel points can be clustered towards the corresponding clustering centers, and then at least one candidate clustering cluster can be obtained.
[0052] Optionally, determining the clustering distance between the image pixel points and each initial clustering center respectively, and determining the target clustering center from the initial clustering centers based on the clustering distance includes: for each initial clustering center, determining the Manhattan distance and the Chebyshev distance between the image pixel points and the initial clustering center; summing the Manhattan distance and the Chebyshev distance to obtain the clustering distance corresponding to the initial clustering center, and using the initial clustering center with the smallest clustering distance as the target clustering center.
[0053] Exemplarily, when determining the Manhattan distance and the Chebyshev distance between the image pixel points and the initial clustering center, they can be first transformed into vector forms.
[0054] For the vectors (x 1 , y 1 , z 1 ) and (x 2 , y 2 , z 2 ), the Manhattan distance and the Chebyshev distance are calculated as follows:
[0055] d = abs(x 1 - x 2 ) + abs(y 1 - y 2 ) + abs(z 1 - z 2 )
[0056] d = max{abs(x 1 - x 2 ), abs(y 1 - y 2 ), abs(z 1 - z 2 )}
[0057] where d is the distance.
[0058] By combining the Manhattan distance with the Chebyshev distance to form a new distance model, on the basis of calculating the distance between image pixels, other information between pixels can also be retained, including which dimension has the largest difference in the image and what the distance is, etc. It can retain more basic features of the image and express the information of the target tobacco leaf image more effectively.
[0059] In step three, the newly updated cluster center can be the cluster center re-determined from the candidate clusters. Specifically, the newly updated cluster center can be re-determined according to the data distribution in the candidate clusters. Exemplarily, the mean value of all data points in the candidate clusters can be calculated and used as the newly updated cluster center.
[0060] In step four, for each candidate cluster, it can be compared whether the newly updated cluster center and the original initial cluster center of the candidate cluster are the same data point. If the two are the same, there is no need to perform iterative clustering. If the two are different, the newly updated cluster center can be used as the initial cluster center, and it can be re-jumped to step two to perform clustering again until the newly updated cluster center of the re-determined candidate cluster is the same as the initial cluster center.
[0061] S230. For each color type region, evaluate the tobacco leaf quality of the color type region based on a preset evaluation index, and determine the index evaluation score corresponding to the color type region.
[0062] Among them, the preset evaluation index can be an index preset for evaluating the quality of tobacco leaves. Specifically, the preset evaluation index can include at least one of the following: the proportion of black smoke, gray value, saturation, yellowishness, and uniformity. Among them, the proportion of black smoke represents the percentage of the area with a darker color in the whole area. The higher the proportion of black smoke, the worse the quality. The overall gray value represents the brightness of the main color distribution of the whole area. Calculate its average gray value. The lower the gray value, the darker the overall color tends to be, and the worse the quality. Saturation represents the color vividness under the international color model LCH and is calculated according to the main color and its proportion. The higher the saturation, the brighter the overall color, and the better the quality. Yellowishness represents the degree of deviation towards positive yellow under the international color model LAB. The main base color of tobacco leaves is yellow. Calculate the similarity between the picture and yellow. The higher the yellowishness, the more the tobacco leaf color tends to yellow, and the better the quality of the tobacco leaf. Uniformity represents the overall color difference. Calculate its standard deviation according to the main color and its proportion. The better the uniformity, the closer the color level of the target tobacco leaf is.
[0063] The index evaluation score can be the evaluation score of a preset evaluation index in the color type area. Exemplarily, for each color type area, the proportion of black smoke, grayscale value, saturation, yellowishness, and uniformity of the color type area can be obtained. For each preset evaluation index, the index value in the color type area is compared with the preset standard index value, and the index evaluation score of each preset evaluation index is determined according to the comparison result.
[0064] S240. Compare the index evaluation score and the area proportion of the color type area in the target tobacco leaf image with a preset quality classification standard, and determine the tobacco leaf quality grade according to the comparison result.
[0065] Among them, the preset quality classification standard can be a preset standard for classifying the tobacco leaf quality grade. The tobacco leaf quality grade can be the quality grade of the target tobacco leaf. Specifically, in the preset quality classification standard, there are reference evaluation scores corresponding to multiple preset evaluation indexes and reference area proportions corresponding to multiple color type areas. The index evaluation score and the area proportion of the color type area in the target tobacco leaf image can be compared with the reference standard in the preset quality classification standard, and the tobacco leaf quality grade of the target tobacco leaf is determined according to the comparison result.
[0066] Optionally, after determining the tobacco leaf quality grade, a target selection instruction can be generated according to the tobacco leaf quality grade, and the target selection instruction is sent to the tobacco leaf selection device, so that the tobacco leaf selection device selects the target tobacco leaf into the storage device corresponding to the tobacco leaf quality grade.
[0067] Among them, the target selection instruction can be a control instruction for selecting the target tobacco leaf. Further, a corresponding storage device can be configured for each tobacco leaf quality grade. After determining the tobacco leaf quality grade of the target tobacco leaf, the target storage device corresponding to the target tobacco leaf can be determined, and then the target selection instruction is generated, so that the tobacco leaf selection device selects the target tobacco leaf into the target storage device based on the target selection instruction, completing the automatic selection process of the tobacco leaf.
[0068] The technical solution of the embodiment of the present invention can automatically and quickly analyze the color condition of the target tobacco leaf, perform multi-dimensional analysis according to the color condition of the target tobacco leaf, compare with the selected sample to judge the quality of the tobacco leaf, and improve the detection efficiency and stability of the quality of the target tobacco leaf.
[0069] The technical solution provided by the embodiments of the present invention includes: obtaining a target tobacco leaf image of a target tobacco leaf; performing iterative clustering on the color types in the target tobacco leaf image to determine at least one color type area in the target tobacco leaf image and the area proportion of each color type area; for each color type area, evaluating the tobacco leaf quality of the color type area based on a preset evaluation index to determine the index evaluation score corresponding to the color type area; comparing the index evaluation score and the area proportion of the color type area in the target tobacco leaf image with a preset quality classification standard, and determining the tobacco leaf quality grade according to the comparison result. The technical solution of the embodiments of the present invention solves the problem that in the prior art, when grading the quality of tobacco leaves, it is mainly determined based on manual experience, which is prone to insufficient grading accuracy and efficiency. It can automatically identify various color areas in tobacco leaves based on the tobacco leaf image, and determine the quality of tobacco leaves according to the number and area of the color areas, improving the accuracy and efficiency of determining the quality of tobacco leaves.
[0070] Figure 3 FIG. is a schematic structural diagram of a tobacco leaf quality determination device provided by an embodiment of the present invention. The embodiment of the present invention is applicable to the scenario of determining the quality of tobacco leaves. The device can be implemented in the form of software and / or hardware and integrated in a computer device with application development functions.
[0071] As Figure 3 shown, the tobacco leaf quality determination device includes: a tobacco leaf image acquisition module 310, a color area determination module 320, and a tobacco leaf quality determination module 330.
[0072] Among them, the tobacco leaf image acquisition module 310 is configured to obtain a target tobacco leaf image of a target tobacco leaf; the color area determination module 320 is configured to perform iterative clustering on the color types in the target tobacco leaf image to determine at least one color type area in the target tobacco leaf image and the area proportion of each color type area; the tobacco leaf quality determination module 330 is configured to determine the tobacco leaf quality grade of the target tobacco leaf according to the number of color type areas in the target tobacco leaf image and the area proportion of each color type area.
[0073] The technical solution provided by the embodiments of the present invention includes: obtaining a target tobacco leaf image of a target tobacco leaf; performing iterative clustering on the color types in the target tobacco leaf image to determine at least one color type region in the target tobacco leaf image and the area proportion of each color type region; and determining the tobacco leaf quality grade of the target tobacco leaf according to the number of color type regions in the target tobacco leaf image and the area proportion of each color type region. The technical solution of the embodiments of the present invention solves the problem that in the prior art, when grading the quality of tobacco leaves, it is mainly determined based on manual experience, which is prone to insufficient grading accuracy and efficiency. It can automatically identify various color regions in tobacco leaves based on tobacco leaf images, and determine the quality of tobacco leaves according to the number and area of color regions, improving the accuracy and efficiency of determining the quality of tobacco leaves.
[0074] In an alternative embodiment, the color region determination module 320 includes: a color region number determination unit, configured to: Step 1: perform initial clustering on the color type regions in the target tobacco leaf image, determine the clustering evaluation score after the initial clustering, and determine the initial clustering number and at least one initial clustering center based on the clustering evaluation score; Step 2: for each image pixel point in the target tobacco leaf image, respectively determine the clustering distance between the image pixel point and each initial clustering center, determine the target clustering center from the initial clustering centers based on the clustering distance, and cluster the image pixel point towards the target clustering center to obtain at least one candidate clustering cluster; Step 3: for each candidate clustering cluster, re-determine the clustering center according to the image pixel points in the candidate clustering cluster, and determine the newly updated clustering center corresponding to the candidate clustering cluster; Step 4: in the case where the newly updated clustering center of each candidate clustering cluster is the same as the initial clustering center, use the number of the candidate clustering clusters as the number of the color type regions, and in the case where the newly updated clustering center of any candidate clustering cluster is different from the initial clustering center, use the newly updated clustering center as the initial clustering center and jump to Step 2 to perform clustering again.
[0075] In an alternative embodiment, the color region number determination unit includes: a clustering evaluation subunit, configured to: determine a first evaluation score according to the intra-cluster data distance and the inter-cluster data distance after the initial clustering; determine a second evaluation score according to the intra-cluster data covariance and the inter-cluster data covariance after the initial clustering; and perform weighted summation on the first evaluation score and the second evaluation score to obtain the clustering evaluation score.
[0076] In an alternative embodiment, the color area quantity determination unit includes: a clustering center determination subunit, configured to: for each initial clustering center, determine the Manhattan distance and the Chebyshev distance between the image pixel points and the initial clustering center; sum up the Manhattan distance and the Chebyshev distance to obtain the clustering distance corresponding to the initial clustering center, and use the initial clustering center with the minimum clustering distance as the target clustering center.
[0077] In an alternative embodiment, the tobacco leaf quality determination module 330 is specifically configured to: for each color type area, evaluate the tobacco leaf quality of the color type area based on a preset evaluation index, and determine the index evaluation score corresponding to the color type area; compare the index evaluation score and the area proportion of the color type area in the target tobacco leaf image with a preset quality classification standard, and determine the tobacco leaf quality grade according to the comparison result.
[0078] In an alternative embodiment, the preset evaluation index includes at least one of: the proportion of black smoke, the gray value, the saturation, the yellowishness, and the uniformity.
[0079] In an alternative embodiment, the tobacco leaf quality determination device further includes: a tobacco leaf processing module, configured to: generate a target selection instruction according to the tobacco leaf quality grade, and send the target selection instruction to a tobacco leaf selection device, so that the tobacco leaf selection device selects the target tobacco leaves into a storage device corresponding to the tobacco leaf quality grade.
[0080] The tobacco leaf quality determination device provided by the embodiments of the present invention can execute the tobacco leaf quality determination method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.
[0081] Figure 4 It is a schematic structural diagram of a computer device provided by an embodiment of the present invention. Figure 4 A block diagram of an exemplary computer device 12 suitable for implementing the embodiments of the present invention is shown. Figure 4 The shown computer device 12 is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present invention. The computer device 12 can be any terminal device with computing capabilities and can be configured in a tobacco leaf quality determination device.
[0082] As Figure 4 shown, the computer device 12 is presented in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).
[0083] The bus 18 can be one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an Accelerated Graphics Port, a processor bus, or a local bus using any of a variety of bus structures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
[0084] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including both volatile and nonvolatile media, removable and non-removable media.
[0085] System memory 28 can include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache 32. The computer device 12 can further include other removable / non-removable, volatile / nonvolatile computer system storage media. By way of example only, storage system 34 can be used for reading and writing non-removable, nonvolatile magnetic media ( Figure 4 not shown and typically called a "hard disk drive"). Although Figure 4 not shown in the figures, a disk drive for reading and writing removable nonvolatile disks (such as a "floppy disk"), and an optical disk drive for reading and writing removable nonvolatile optical disks (such as a CD-ROM, DVD-ROM or other optical media) can be provided. In these instances, each drive can be connected to the bus 18 by one or more data media interfaces. System memory 28 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the present invention.
[0086] A program / utility 40 having a set (at least one) of program modules 42 can be stored, for example, in system memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may include an implementation of a network environment. The program modules 42 typically carry out the functions and / or methods of the embodiments described herein.
[0087] The computer device 12 can also communicate with one or more external devices 14 (such as a keyboard, a pointing device, a display 24, etc.), and can also communicate with one or more devices that enable a user to interact with the computer device 12, and / or communicate with any device that enables the computer device 12 to communicate with one or more other computing devices (such as a network card, a modem, etc.). Such communication can be carried out through the input / output (I / O) interface 22. Moreover, the computer device 12 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 20. As Figure 4 shown, the network adapter 20 communicates with other modules of the computer device 12 through the bus 18. It should be understood that although Figure 4 not shown in the figure, other hardware and / or software modules can be used in combination with the computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0088] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28. For example, it implements the tobacco leaf quality determination method provided by the embodiments of the present invention. The method includes:
[0089] Obtaining a target tobacco leaf image of a target tobacco leaf; performing iterative clustering on the color types in the target tobacco leaf image to determine at least one color type region in the target tobacco leaf image and the area proportion of each color type region; and determining the tobacco leaf quality grade of the target tobacco leaf according to the number of color type regions in the target tobacco leaf image and the area proportion of each color type region.
[0090] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the tobacco leaf quality determination method provided by any embodiment of the present invention, including:
[0091] Obtaining a target tobacco leaf image of a target tobacco leaf; performing iterative clustering on the color types in the target tobacco leaf image to determine at least one color type region in the target tobacco leaf image and the area proportion of each color type region; and determining the tobacco leaf quality grade of the target tobacco leaf according to the number of color type regions in the target tobacco leaf image and the area proportion of each color type region.
[0092] The computer storage medium of the embodiments of the present invention may adopt any combination of one or more computer-readable media. The computer-readable media may be computer-readable signal media or computer-readable storage media. The computer-readable storage media may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage media may be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0093] The computer-readable signal media may include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal media may also be any computer-readable media other than the computer-readable storage media, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0094] The program code contained on the computer-readable media may be transmitted by any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0095] The computer program code for performing the operations of the present invention may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).
[0096] Those of ordinary skill in the art should understand that the various modules or steps of the present invention described above can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Optionally, they can be implemented with program codes executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0097] Note that the above is only a preferred embodiment of the present invention and the technical principles applied. Those skilled in the art will understand that the present invention is not limited to the specific embodiments here. Various obvious changes, re-adjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, more other equivalent embodiments can be included, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for determining tobacco leaf quality, characterized in that: include: Acquire a target tobacco leaf image of the target tobacco leaf; Iteratively clustering the color types in the target tobacco leaf image to determine at least one color type region in the target tobacco leaf image and the area proportion of each color type region; The tobacco quality grade of the target tobacco leaf is determined according to the number of color type regions in the target tobacco leaf image and the area proportion of each color type region.
2. The method according to claim 1, characterized in that: The iterative clustering of the color types in the target tobacco leaf image to determine the number of color type regions in the target tobacco leaf image includes: Step 1: performing initial clustering on the color type areas in the target tobacco leaf image, determining a clustering evaluation score after the initial clustering, and determining the initial cluster number and at least one initial cluster center based on the clustering evaluation score; Step 2: for each image pixel in the target tobacco leaf image, respectively determine the clustering distance between the image pixel and each initial clustering center, determine the target clustering center from the initial clustering center based on the clustering distance, and cluster the image pixel toward the target clustering center to obtain at least one candidate clustering cluster; Step 3: for each candidate cluster, re-determine the cluster center according to the image pixels in the candidate cluster, and determine the newly updated cluster center corresponding to the candidate cluster; Step 4: When the newly updated cluster center of each candidate cluster is consistent with the initial cluster center, the number of the candidate clusters is used as the number of the color type areas. When the newly updated cluster center of any candidate cluster is inconsistent with the initial cluster center, the newly updated cluster center is used as the initial cluster center and jump to step 2 to re-cluster.
3. The method according to claim 2, characterized in that The determining of the clustering evaluation score after the initial clustering includes: Determine a first evaluation score according to the intra-cluster data distance and the inter-cluster data distance after the initial clustering; Determine a second evaluation score according to the intra-cluster data covariance and the inter-cluster data covariance after the initial clustering; The first evaluation score and the second evaluation score are weightedly summed to obtain the cluster evaluation score.
4. The method according to claim 2, characterized in that: The respectively determining the cluster distance between the image pixel point and each initial cluster center, and determining the target cluster center from the initial cluster center based on the cluster distance, comprises: For each initial cluster center, determining the Manhattan distance and Chebyshev distance between the image pixel and the initial cluster center; The Manhattan distance and the Chebyshev distance are summed to obtain the cluster distance corresponding to the initial cluster center, and the initial cluster center with the smallest cluster distance is used as the target cluster center.
5. The method according to claim 1, characterized in that Determining the tobacco leaf quality grade of the target tobacco leaf according to the number of color type regions in the target tobacco leaf image and the area proportion of each color type region includes: For each color type area, the tobacco leaf quality of the color type area is evaluated based on a preset evaluation index, and an index evaluation score corresponding to the color type area is determined; The index evaluation score and area proportion of the color type area in the target tobacco leaf image are compared with the preset quality classification standard, and the tobacco leaf quality grade is determined according to the comparison result.
6. The method according to claim 5, characterized in that The preset evaluation index includes: at least one of black smoke proportion, gray value, saturation, yellowishness and uniformity.
7. The method according to claim 1, characterized in that The method further comprises: A target picking instruction is generated according to the tobacco leaf quality grade, and the target picking instruction is sent to a tobacco leaf picking device, so that the tobacco leaf picking device picks the target tobacco leaves into a storage device corresponding to the tobacco leaf quality grade.
8. A tobacco leaf quality determination device, characterized in that: The device comprises: A tobacco leaf image acquisition module, used for acquiring a target tobacco leaf image of a target tobacco leaf; A color region determination module, used for iteratively clustering the color types in the target tobacco leaf image, and determining at least one color type region in the target tobacco leaf image, and an area proportion of each color type region; The tobacco leaf quality determination module is used to determine the tobacco leaf quality grade of the target tobacco leaf according to the number of color type areas in the target tobacco leaf image and the area proportion of each color type area.
9. A computer device, characterized in that: The computer device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the tobacco leaf quality determination method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the tobacco leaf quality determination method as described in any one of claims 1 to 7 is implemented.