Tea leaf impurity content detection method, device, equipment and medium

Through multi-view image acquisition and three-dimensional reconstruction of deep learning technology, the pre-trained model is used to identify tea impurities, which solves the problems of low tea impurity detection efficiency and low accuracy in the existing technology, and achieves fast and accurate tea impurity content. detection.

CN118674969APending Publication Date: 2024-09-20MENGHAI TEA IND +1

Patent Information

Application Number
CN202410674496.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

In the existing technology, the detection efficiency of tea impurity content is low and the accuracy is not high. It requires manual sorting and calculation, which is time-consuming, labor-intensive and error-prone.

Method used

Using multi-view image acquisition, three-dimensional reconstruction and pre-trained model classification, the tea leaves are converted into three-dimensional point cloud data through deep learning technology, and the impurity content is identified and calculated.

Benefits of technology

It achieves rapid and accurate detection of tea impurity content, improves detection efficiency and reduces the possibility of manual errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118674969A
    Figure CN118674969A
Patent Text Reader

Abstract

The invention discloses a tea leaf impurity content detection method, device and equipment and a medium, and belongs to the technical field of tea leaf detection. The tea impurity content detection method comprises the steps that a multi-view image of to-be-detected tea is acquired, and the to-be-detected tea comprises a tea body and tea impurities; performing three-dimensional reconstruction on the multi-view image to generate a three-dimensional point cloud data set corresponding to the to-be-detected tea; inputting the three-dimensional point cloud data set into a pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set; according to the data category of any three-dimensional point cloud data, determining the three-dimensional point cloud data of which the data category is an impurity category in the three-dimensional point cloud data set; and determining the impurity content of the to-be-detected tea according to the three-dimensional point cloud data of which the data category is the impurity category. The tea leaf impurity content detection method can improve the tea leaf impurity content detection efficiency and improve the tea leaf impurity content detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of tea detection, and in particular to a method for detecting the impurity content of tea, a detection device, an electronic device and a computer-readable medium. Background Art

[0002] Tea leaves (such as Pu'er tea) after picking generally contain a large amount of impurities, such as hair, branches, insects, tea fruits, etc., and the impurity content needs to be tested.

[0003] Under the traditional method of detecting the impurity content of tea, the impurities in the tea need to be manually sorted out and weighed and calculated, which is not only time-consuming and labor-intensive, but also cannot guarantee the accuracy of the detection of the impurity content of tea. Summary of the invention

[0004] To this end, the present invention provides a method, device, equipment and medium for detecting impurity content of tea leaves, so as to solve the problem of slow efficiency and low accuracy of detecting impurity content of tea leaves caused by manual impurity sorting and calculation of tea leaves in the prior art.

[0005] In order to achieve the above object, the present invention provides a method for detecting impurity content of tea leaves in a first aspect, comprising:

[0006] Acquire multi-view images of tea leaves to be detected, wherein the tea leaves to be detected include:

[0007] Tea leaves and tea impurities;

[0008] Performing three-dimensional reconstruction on the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected;

[0009] Inputting the three-dimensional point cloud data set into a pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set;

[0010] According to the data category of any one of the three-dimensional point cloud data, determine the three-dimensional point cloud data of which the data category is an impurity category in the three-dimensional point cloud data set;

[0011] The impurity content of the tea leaves to be tested is determined based on the three-dimensional point cloud data whose data category is the impurity category.

[0012] Furthermore, the multi-perspective image includes a plurality of single-perspective images, and the step of obtaining the multi-perspective image of the tea leaves to be detected includes:

[0013] Capturing images of the tea leaves to be detected from different acquisition angles to obtain the multiple single-view images corresponding to the different acquisition angles;

[0014] There is an overlapping area between two single-view images at adjacent acquisition angles, and the angle difference between the two adjacent acquisition angles is the same.

[0015] Furthermore, the multi-view images are taken based on a multi-spectral camera;

[0016] The three-dimensional reconstruction of the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected includes:

[0017] Inputting the multi-view images into a preset three-dimensional reconstruction model;

[0018] By using the three-dimensional reconstruction model, when it is detected that there is an obstructed area in the tea leaves to be detected, at least two single-view images containing the obstructed area are acquired;

[0019] Three-dimensional point cloud data of the blocked area is predicted based on the at least two single-view images containing the blocked area.

[0020] Furthermore, the image background of the multi-view image is a solid color background, and the three-dimensional point cloud data set includes three-dimensional point cloud data corresponding to the image background;

[0021] Then the data category of the three-dimensional point cloud data also includes: background category;

[0022] The step of determining, according to the data category of any one of the three-dimensional point cloud data, that the three-dimensional point cloud data in the three-dimensional point cloud data set is of the impurity category comprises:

[0023] According to the data category of any one of the three-dimensional point cloud data, determining the three-dimensional point cloud data of the background category in the three-dimensional point cloud data set as invalid point cloud data;

[0024] From the valid point cloud data in the three-dimensional point cloud data set, three-dimensional point cloud data of which the data category is an impurity category in the three-dimensional point cloud data set is determined.

[0025] Furthermore, the tea impurity detection model is trained in the following way:

[0026] Inputting the three-dimensional point cloud training data set of tea leaves containing impurities into a preset three-dimensional image segmentation model to obtain a predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set;

[0027] According to the predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set and the label information of any three-dimensional point cloud training data in the three-dimensional point cloud training data set, the preset three-dimensional image segmentation model is trained, and the trained three-dimensional image segmentation model is used as the tea impurity detection model.

[0028] Furthermore, the preset three-dimensional image segmentation model is a three-dimensional image segmentation model integrating an attention mechanism, including: a target convolution layer, an attention mechanism layer connected to the output end of the target convolution layer, and a target fully connected layer; wherein the target fully connected layer is a KAN network layer.

[0029] A second aspect of the present invention provides a tea impurity content detection device, the device comprising:

[0030] An acquisition module is used to acquire multi-view images of tea leaves to be detected, wherein the tea leaves to be detected include: tea leaves and tea leaves impurities;

[0031] A generating module, used for performing three-dimensional reconstruction on the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected;

[0032] A classification module, used for inputting the three-dimensional point cloud data set into a pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set;

[0033] A first determination module is used to determine the three-dimensional point cloud data of which the data category is an impurity category in the three-dimensional point cloud data set according to the data category of any three-dimensional point cloud data;

[0034] The second determination module is used to determine the impurity content of the tea leaves to be tested according to the three-dimensional point cloud data whose data category is the impurity category.

[0035] A third aspect of the present invention provides an electronic device, comprising:

[0036] one or more processors;

[0037] A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the methods for detecting the impurity content of tea leaves;

[0038] One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.

[0039] A fourth aspect of the present invention provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, any one of the methods described in the method for detecting the impurity content of tea leaves is implemented.

[0040] A fifth aspect of the present invention provides a computer program product, comprising a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes any one of the methods described in the method for detecting impurity content in tea leaves.

[0041] The present invention has the following advantages:

[0042] The tea impurity content detection method provided by the embodiment of the present invention first obtains a multi-view image of the tea to be detected, which includes the spatial information of the tea to be detected; secondly, the multi-view image is three-dimensionally reconstructed to generate a three-dimensional point cloud data set corresponding to the tea to be detected, thereby realizing three-dimensional mapping of the tea to be detected; then, the three-dimensional point cloud data set is input into a pre-trained tea impurity detection model to obtain the data category of any three-dimensional point cloud data in the three-dimensional point cloud data set, thereby realizing efficient classification of the three-dimensional point cloud data corresponding to the tea to be detected; finally, according to the data category of any three-dimensional point cloud data, the three-dimensional point cloud data with the data category of the impurity category in the three-dimensional point cloud data set is determined, thereby determining the impurity content of the tea to be detected according to the three-dimensional point cloud data with the data category of the impurity category, thereby realizing rapid detection of the impurity content in the tea to be detected, while improving the efficiency of tea impurity content detection and ensuring the accuracy of tea impurity content detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention, but do not constitute a limitation of the present invention.

[0044] Figure 1 A flow chart of a method for detecting impurity content of tea leaves provided by an embodiment of the present invention;

[0045] Figure 2 A schematic diagram of a process for detecting impurity content of tea leaves provided by an embodiment of the present invention;

[0046] Figure 3 A block diagram of a tea impurity content detection device provided by an embodiment of the present invention;

[0047] Figure 4 A block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.

[0049] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0050] The terms used in the present invention are only used to describe specific embodiments and are not intended to limit the present invention. As used in the present invention, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0051] When the terms “comprising” and / or “made of…” are used in the present invention, it specifies the existence of the stated features, integers, steps, operations, elements and / or components, but does not exclude the existence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0052] The embodiments of the present invention may be described with reference to plan views and / or cross-sectional views by way of ideal schematic views of the present invention. Therefore, the exemplary illustrations may be modified according to manufacturing techniques and / or tolerances.

[0053] Unless otherwise defined, all terms (including technical and scientific terms) used in the present invention have the same meaning as those commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present invention, and will not be interpreted as having an idealized or overly formal meaning unless the present invention clearly defines it as such.

[0054] When testing the impurity content of tea leaves, it is necessary to manually select the tea leaves and the tea impurities. After the selection is completed, a weighing tool is used to weigh and calculate the tea impurities to obtain the tea impurity content. This method is not only time-consuming and labor-intensive, but also has a low detection efficiency. It also has high requirements on the staff's concentration. If the staff makes sorting errors or calculation errors, the accuracy of the tea impurity content results cannot be guaranteed.

[0055] In view of this, the embodiments of the present invention provide a method, device, equipment and medium for detecting the impurity content of tea leaves, which are used to improve the efficiency of detecting the impurity content of tea leaves and the accuracy of detecting the impurity content of tea leaves.

[0056] In a first aspect, an embodiment of the present invention provides a method for detecting impurity content of tea leaves. Figure 1 A flowchart of a method for detecting impurity content of tea leaves provided in an embodiment of the present invention, referring to Figure 1 , the method comprising:

[0057] Step S110: Acquire multi-view images of tea leaves to be inspected, wherein the tea leaves to be inspected include tea leaves themselves and tea leaves impurities.

[0058] The tea leaves to be tested are the tea leaves that need to be tested for impurity content and the tea impurity mixture. The tea leaves are the tea leaves without impurities after picking, and the tea impurities are other sundries mixed in when picking tea leaves, such as hair, branches, insects, tea fruits, stones, weeds, etc.

[0059] It should be noted that in order to improve the three-dimensional reconstruction effect and the accuracy of impurity content detection, the tea leaves and tea impurities in the tea to be tested must exist in the visible area, that is, each tea leaf body and tea impurity are not completely covered, thereby ensuring that each tea leaf body and tea impurity in the multi-view image can provide effective visual information.

[0060] The multi-perspective image of the tea leaves to be detected is a multi-perspective image generated based on image acquisition of the tea leaves to be detected by an imaging device.

[0061] Among them, the multi-perspective image is a collection of multiple single-perspective images, each single-perspective image corresponds to an image acquisition angle. By generating multi-perspective images of the tea to be detected based on different image acquisition angles, the comprehensive spatial information of the tea to be detected can be obtained.

[0062] It should be noted that the imaging device can be an RGB (Red Green Blue) camera, a multispectral camera, a hyperspectral camera, a laser scanner, a three-dimensional scanner, etc. In actual application, it can be adaptively selected according to the needs of collecting spectral information.

[0063] Correspondingly, the multi-view image generated by the imaging device based on the image acquisition of the tea leaves to be detected can be an RGB image, a multi-spectral image, a hyperspectral image, etc., which is not limited in the embodiment of the present invention.

[0064] For example, when it is necessary to collect more spectral information of the tea to be tested, multispectral cameras and hyperspectral cameras can be used for multi-view image acquisition. Multispectral cameras and hyperspectral cameras both use multispectral technology. Compared with ordinary imaging technology, they can simultaneously acquire multiple optical spectrum bands and expand to infrared and ultraviolet light based on visible light, so they can collect rich spectral information.

[0065] In some optional implementations, in order to enable the multi-view images to contain richer visual information, images at corresponding viewpoints may be captured from different acquisition angles, and there must be overlapping areas between images captured at adjacent acquisition angles.

[0066] Correspondingly, the multi-perspective image includes multiple single-perspective images, and the multi-perspective image of the tea to be detected is obtained, including: respectively capturing images of the tea to be detected from different acquisition angles to obtain multiple single-perspective images corresponding to different acquisition angles; wherein, there is an overlapping area between two single-perspective images of adjacent acquisition angles, and the angle difference between two adjacent acquisition angles is the same. Alternatively, the angle difference between two adjacent acquisition angles is not greater than a preset angle threshold. It can be seen that by making the angle difference between two adjacent acquisition angles approximately equal, it can ensure that the shooting angles of multiple single-perspective images are more comprehensive, so that the multi-perspective image composed of multiple single-perspective images can contain richer visual information.

[0067] The range of the collection angle is between 0 and 360 degrees, and the angle difference between adjacent collection angles can be adaptively set according to the actual distribution of the tea leaves to be detected. For example, when the actual distribution of the tea leaves to be detected is sparse, the angle difference can be set slightly larger, and when the actual distribution of the tea leaves to be detected is dense, the angle difference can be adaptively set slightly smaller.

[0068] Exemplarily, the angle difference between adjacent acquisition angles is set to 20 degrees, so that a single-view image of the tea leaves to be detected at that angle is generated every 20 degrees, thereby improving the richness of visual information of the multi-view images of the tea leaves to be detected.

[0069] There must be an overlapping area between two single-view images of adjacent acquisition angles, so that the single-view images can be spliced ​​to obtain visual information of the tea leaves to be detected at full viewing angles. The size of the overlapping area can be adaptively set according to the needs of data splicing.

[0070] Exemplarily, the overlapping area between the monoscopic images at adjacent viewing angles is set between 20% and 30%. By combining and splicing different monoscopic images, full visual information of the tea leaves to be detected at 360 degrees can be obtained.

[0071] Step S120: reconstruct the multi-view images in three dimensions to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected.

[0072] Among them, 3D reconstruction refers to restoring the 3D structure of the tea leaves to be tested from the multi-view images of the tea leaves to be tested, and rendering it to achieve a virtual reality expression of the tea leaves to be tested. By performing 3D reconstruction on the multi-view images, a 3D point cloud data set corresponding to the tea leaves to be tested can be generated.

[0073] The 3D point cloud data set includes a series of 3D point cloud data. Each 3D point cloud data may include 3D coordinates and attribute information such as color information and reflection intensity information. By generating a 3D point cloud data set, the shape, surface, texture and other information of the space object of the tea to be detected can be intuitively represented, which is convenient for type identification.

[0074] It should be noted that the three-dimensional point cloud data can be represented by any three-dimensional representation form, for example, by three-dimensional voxel representation, three-dimensional point representation, three-dimensional grid representation, etc., and the embodiment of the present invention does not limit this.

[0075] In some optional implementations, the multi-view images are reconstructed in three dimensions to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected, including: performing depth estimation on the multi-view images to generate a depth map corresponding to the multi-view images; converting the pixels in the depth map into three-dimensional point cloud data based on the calibration parameters of the camera; and fusing the three-dimensional point cloud data corresponding to different multi-view images to generate a three-dimensional point cloud data set.

[0076] Among them, for the depth map corresponding to the multi-view image, the pixel value of the pixel point in the depth map represents the distance between the pixel point and the camera.

[0077] It should be noted that when constructing a depth map, the relative depth difference between different pixels in the same multi-view image can be predicted in the form of monocular prediction, or multi-view prediction can be used. For the same area, the depth can be calculated based on the disparity information of multi-view images under binocular or multi-view perspectives. The embodiments of the present invention do not limit this.

[0078] It should also be noted that the calibration parameters of the camera include the camera intrinsic parameters and distortion parameters. When converting the pixels in the depth map into three-dimensional point cloud data, the pixels in the depth map can be converted into three-dimensional coordinate points according to the calibration parameters of the camera and the pixel values ​​of the pixels in the depth map, so that the three-dimensional coordinate points and the attribute information can be constructed into three-dimensional point cloud data according to the attribute information of the pixels in the corresponding multi-view images.

[0079] Step S130: inputting the three-dimensional point cloud data set into a pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set.

[0080] Among them, the tea impurity detection model is a three-dimensional image segmentation model, such as 3D U-Net, V-Net, DeepMedic and other models.

[0081] By inputting the three-dimensional point cloud data set into the tea impurity detection model, the data category of each three-dimensional point cloud data in the three-dimensional point cloud data set can be obtained.

[0082] The data category can be adaptively set according to the content information contained in the multi-view images. For example, the data category can be tea category, tea impurity category, and background category.

[0083] Step S140: according to the data category of any three-dimensional point cloud data, determine the three-dimensional point cloud data of which the data category is the impurity category in the three-dimensional point cloud data set.

[0084] Since the tea leaves to be tested may contain different tea impurities, the corresponding three-dimensional point cloud data must be determined for each type of tea impurity, so as to obtain the three-dimensional point cloud data volume, volume information, quality information, etc. of this type of impurity.

[0085] In some optional implementations, determining the three-dimensional point cloud data whose data category is an impurity category in the three-dimensional point cloud data set includes: in the case where there are multiple impurity categories, determining the data volume of the three-dimensional point cloud data of each impurity category respectively. Accordingly, during the training process, the tea impurity detection model can learn the characteristics of multiple different categories of impurities respectively, so as to achieve fine-grained classification for impurities. For example, the impurity category in the data category of the three-dimensional point cloud data can be further subdivided into multiple categories, specifically according to the shape of the impurities (long strips, circles, etc.), attributes (such as edible, or non-edible, harmful, harmless), etc. Various subdivisions can be made. By counting the data volume of the three-dimensional point cloud data of each impurity category respectively, and combining the density information of each impurity, the volume, mass and other information of each impurity category can be obtained.

[0086] In some optional implementations, the impurities in the tea leaves may be classified into first-category impurities, second-category impurities, and third-category impurities based on their attribute information such as aspect ratio, volume, and shape.

[0087] The first type of impurities are filamentous impurities, such as hair, feathers, etc. The volume of such impurities is relatively light, and its internal composition or overall shape is a filamentous structure. When the aspect ratio of the tea impurities is greater than the first threshold or the volume of the tea impurities is less than the first volume threshold, the tea impurities are determined as the first type of impurities.

[0088] The second type of impurities are spherical impurities, such as insect eggs, soil, etc. The volume of this type of impurities is larger than that of the first type of impurities, and its internal composition or overall shape is a spherical or granular structure. When the aspect ratio of the tea impurities is less than the first threshold or the volume of the tea impurities is between the first volume threshold and the second volume threshold, the tea impurities are determined as the second type of impurities.

[0089] Among them, the third type of impurities are irregular impurities, such as branches, stones, etc. This type of tea impurities has no uniform regular shape, but accounts for a large volume. When the volume of the tea impurities is greater than the second volume threshold, the tea impurities are determined as the third type of impurities.

[0090] Different tea impurities are subdivided according to the attribute information of tea impurities, so that the tea impurity detection model can distinguish different categories of tea impurities according to the attribute information of tea impurities, which can effectively improve the generalization ability of the tea impurity detection model.

[0091] Step S150: determining the impurity content of the tea leaves to be tested according to the three-dimensional point cloud data of the impurity category.

[0092] The impurity content of the tea leaves to be tested may be the relative volume ratio of the impurities to the tea leaves to be tested, or may be the relative mass ratio of the impurities to the tea leaves to be tested, which is not limited in the embodiment of the present invention.

[0093] In some optional implementations, the impurity content of the tea leaves to be tested can be determined based on the ratio of the number of three-dimensional point cloud data of the impurity category to the total number of three-dimensional point cloud data of the tea leaves to be tested. Accordingly, in the case where the impurity content is a relative mass percentage, the impurity content of the tea leaves to be tested is determined based on the three-dimensional point cloud data whose data category is the impurity category, including: obtaining the relative volume ratio of tea impurities to the tea leaves to be tested based on the number of three-dimensional point cloud data whose data category is the impurity category and the total number of three-dimensional point cloud data of the tea leaves to be tested; obtaining the relative mass of tea impurities to the tea leaves to be tested based on the density of tea impurities, the total density of the tea leaves to be tested, and the relative volume ratio; obtaining the impurity content of the tea leaves to be tested based on the relative mass and the total mass of the tea leaves to be tested.

[0094] Among them, the density of tea impurities and the total density of tea to be tested are prior information. Before testing the impurity content of tea to be tested, it is necessary to count all possible impurities in the tea to be tested (recorded as impurity set Z) and their corresponding densities (recorded as density set ρ). For each impurity z j ∈Z, calculate z respectively j The density ρ j , where ρ j ∈ρ.

[0095] By calculating the relative volume ratio of each category of impurities and tea, and then multiplying the numerator and denominator of the relative volume ratio by the corresponding density, the relative mass of tea impurities and the tea to be tested is obtained, and then the impurity content of the tea to be tested can be obtained according to the ratio of the relative mass to the total mass of the tea to be tested. After identifying the category of the three-dimensional point cloud data, the impurity content of the tea to be tested can be calculated by combining the prior density information of impurities and tea, avoiding the impurity content detection method of manual sorting and calculation.

[0096] According to the tea impurity content detection method provided by the embodiment of the present invention, the multi-view images of the tea to be detected are converted into a high-quality tea and impurity mixed three-dimensional point cloud data set through three-dimensional reconstruction, and then the type of each three-dimensional point cloud data in the three-dimensional point cloud data set is identified according to the tea impurity detection model, so as to realize rapid tea impurity detection, and finally, the impurity content of the tea to be detected can be determined according to the three-dimensional point cloud data whose data category is the impurity category, thereby realizing rapid detection of the impurity content of the tea.

[0097] Those skilled in the art may also make various modifications and variations to the above embodiments:

[0098] In some possible implementations, the inventors found that it is impossible to generate the corresponding three-dimensional point cloud data for the obstructed area in the tea leaves to be detected, which affects the integrity of the three-dimensional point cloud data. The spectral information carried by the multi-view images can be analyzed through a three-dimensional reconstruction model, so as to predict the three-dimensional point cloud data of the obstructed area and construct complete three-dimensional point cloud data. Accordingly, the multi-view images are shot based on a multi-spectral camera; the multi-view images are three-dimensionally reconstructed to generate a set of three-dimensional point cloud data corresponding to the tea leaves to be detected, including: inputting the multi-view images into a preset three-dimensional reconstruction model; through the three-dimensional reconstruction model, when it is detected that there is an obstructed area in the tea leaves to be detected, obtaining at least two single-view images containing the obstructed area; based on the at least two single-view images containing the obstructed area, predicting the three-dimensional point cloud data of the obstructed area.

[0099] The preset 3D reconstruction model is a multi-view stereo vision model, such as MVSNET. The 3D reconstruction model is used to extract features from at least two single-view images of the occluded area, so that the spectral information of the occluded area in the single-view image can be effectively extracted, and the corresponding depth information is obtained according to the visual difference between the extracted single-view image features of the occluded area, so as to construct the corresponding 3D point cloud data according to the depth information.

[0100] It should be noted that when using a 3D reconstruction model to predict 3D point cloud data, it is necessary to convert a single-view image into a corresponding depth map, and then convert the depth map into the corresponding 3D point cloud data. Therefore, the prediction effect of the 3D point cloud data in the occluded area depends on the generation effect of the depth map.

[0101] In some optional implementations, in order to improve the prediction effect of the preset 3D reconstruction model on the 3D point cloud data of the occluded area, the preset 3D reconstruction model can be trained in the following way: input the single-view images under the predetermined view and the reference view containing the occluded area into the initial 3D reconstruction model to obtain the corresponding feature map; generate a predicted depth map of the predetermined view based on the visual difference information between the feature maps of the predetermined view and the reference view; train the initial 3D reconstruction model based on the error between the predicted depth map and each pixel in the labeled depth map and the error between the predicted depth map and the pixel corresponding to the occluded area in the labeled depth map, so as to obtain the preset 3D reconstruction model that meets the convergence conditions.

[0102] Among them, when training the initial 3D reconstruction model, the error between the predicted depth map and each pixel in the label depth map and the error of the pixel corresponding to the occluded area in the label depth map have corresponding weight coefficients, thereby improving the prediction effect of the 3D reconstruction model on the depth features of the occluded area.

[0103] In some optional implementations, the multi-view image contains a lot of invalid information, which affects the three-dimensional reconstruction effect and the classification effect of the three-dimensional point cloud data. Therefore, the background of the multi-view image can be a solid color background, so that only the three-dimensional point cloud data corresponding to the solid color background in the three-dimensional point cloud data set is invalid three-dimensional point cloud data, which is convenient for data screening and data classification of the three-dimensional point cloud data. Correspondingly, the image background of the multi-view image is a solid color background, and the three-dimensional point cloud data set contains the three-dimensional point cloud data corresponding to the image background; then the data category of the three-dimensional point cloud data also includes: background category; according to the data category of any three-dimensional point cloud data, determining the three-dimensional point cloud data with the data category of the impurity category in the three-dimensional point cloud data set includes: according to the data category of any three-dimensional point cloud data, determining the three-dimensional point cloud data with the data category of the background category in the three-dimensional point cloud data set as invalid point cloud data; from the valid point cloud data in the three-dimensional point cloud data set, determining the three-dimensional point cloud data with the data category of the impurity category in the three-dimensional point cloud data set.

[0104] Among them, the invalid point cloud data is the three-dimensional point cloud data that is irrelevant to the detection of tea impurity content, and the valid point cloud data is the three-dimensional point cloud data corresponding to the tea to be detected, which includes the three-dimensional point cloud data of the tea body and the three-dimensional point cloud data of the tea impurities.

[0105] The image background of the multi-view image may be a solid color background with a large contrast to the color of the tea to be detected. For example, the image background of the multi-view image is white, which facilitates type recognition of the corresponding three-dimensional point cloud data.

[0106] By setting the multi-view image as a solid color background, when constructing the three-dimensional point cloud data of the tea to be tested, the three-dimensional point cloud data corresponding to the background can be clearly distinguished, and the three-dimensional point cloud data of the background can be classified into one category, avoiding confusion of three-dimensional point cloud data of different categories.

[0107] In some optional implementations, the tea impurity detection model is trained in the following manner: a three-dimensional point cloud training data set containing impure tea is input into a preset three-dimensional image segmentation model to obtain a predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set; a preset three-dimensional image segmentation model is trained according to the predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set and the label information of any three-dimensional point cloud training data in the three-dimensional point cloud training data set, and the trained three-dimensional image segmentation model is used as a tea impurity detection model.

[0108] Among them, the preset 3D image segmentation model is used to identify the type of input 3D point cloud data, and the preset 3D image segmentation model can be a 3D U-Net, V-Net, DeepMedic and other models.

[0109] The label information of the 3D point cloud training data can be generated by annotating the 3D point cloud training data through an annotation tool. The data category of the 3D point cloud training data needs to be adaptively set according to the actual content of the 3D point cloud training data.

[0110] Exemplarily, the data categories of the three-dimensional point cloud training data include a tea category, a tea impurity category, and a background category.

[0111] Among them, the 3D point cloud data corresponding to the occluded area may be confused with other 3D point cloud data. When annotating the label information, it is necessary to set the corresponding label information in the real scene according to the actual distribution of the occluded area corresponding to the 3D point cloud data. Among them, the tea impurity category can be divided into the first type of impurities, the second type of impurities and the third type of impurities; when training the tea impurity detection model, the attribute information of different tea impurity categories can be used as a priori feature vectors to train the tea impurity detection model, thereby improving the sub-classification effect of the tea impurity detection model.

[0112] Correspondingly, the tea impurity detection model can also be trained in the following way: constructing prior features corresponding to different data categories according to the attribute information of tea containing impurities under different data categories; inputting the three-dimensional point cloud training data set of tea containing impurities into a preset three-dimensional image segmentation model to obtain the feature vector of any three-dimensional point cloud training data in the three-dimensional point cloud training data set; performing regional clustering on the feature vectors to obtain the cluster set after regional clustering and the attribute features of the cluster set; determining the predicted category of any three-dimensional point cloud training data in the cluster set according to the similarity between the prior features and the attribute features; training the preset three-dimensional image segmentation model according to the predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set and the label information of any three-dimensional point cloud training data in the three-dimensional point cloud training data set, and using the trained three-dimensional image segmentation model as the tea impurity detection model.

[0113] Among them, the prior features include the volume, shape and other attribute information of tea impurities in different data categories, and the attribute features of the cluster set include the volume, shape and other attribute information corresponding to the cluster set. By calculating the similarity between the prior features and the attribute features, it is possible to determine the data category to which the attribute features of the cluster set belong, that is, the predicted category of the three-dimensional point cloud training data in the cluster set.

[0114] In an embodiment of the present invention, by using the attribute information of each tea impurity category as a priori feature vector, the three-dimensional image segmentation model can be trained in combination with the attribute information of each tea impurity category, and then the model parameters are optimized according to the prediction results of the three-dimensional image segmentation model for the three-dimensional point cloud training data and the label information of the three-dimensional point cloud training data, which can effectively improve the three-dimensional image segmentation model's ability to recognize the type of three-dimensional point cloud data.

[0115] In some optional implementations, in order to improve the feature extraction effect and type recognition ability of the three-dimensional image segmentation model for three-dimensional point cloud data, the preset three-dimensional image segmentation model is a three-dimensional image segmentation model that integrates an attention mechanism, which includes: a target convolution layer, an attention mechanism layer connected to the output end of the target convolution layer, and a target fully connected layer; wherein the target fully connected layer is a KAN network layer.

[0116] Among them, the target convolution layer is used to extract features of 3D point cloud data. The attention mechanism layer connected to the output end of the target convolution layer is used to further screen important feature information from the features extracted by the target convolution layer, so as to obtain the representative features of the 3D point cloud data. The target fully connected layer is used to reduce the dimension and classify the features.

[0117] Among them, the attention mechanism layer can be an Attention layer, a CBAM (Convolutional Block Attention Module) layer, a SE (Squeeze-and-Excitation) layer, etc., which is not limited in this embodiment of the present invention.

[0118] The target fully connected layer is the KAN (Kolmogorov Arnold Network) network layer. The KAN network layer consists of nodes and edges, where nodes are used to perform addition operations and edges carry nonlinear activation functions. Therefore, each weight parameter of the KAN network is a learnable single variable function, which is used to improve parameter learning performance and parameter convergence efficiency, and facilitates learning of complex relationships between 3D point cloud data features.

[0119] It should be noted that in the 3D image segmentation model integrating the attention mechanism, conventional convolutional layers and conventional fully connected layers can also be included for the feature extraction stage and feature dimension reduction and classification stage of the model respectively. The number of network layers of the model and the positions of different network layers can be adaptively set according to the actual feature extraction and feature dimension reduction requirements.

[0120] Among them, the output end of the conventional convolutional layer does not need to be connected to the attention mechanism layer. The conventional fully connected layer is an MLP (MultiLayer Perceptron) network layer. The conventional fully connected layer is used in the feature dimensionality reduction stage of the model, and its input end can be any one except the target convolutional layer.

[0121] It should also be noted that the convolution kernel sizes of the conventional convolution layer and the target convolution layer can be adaptively set according to the need for feature extraction. Exemplarily, both the conventional convolution layer and the target convolution layer use a 3×3×3 convolution kernel for convolution operation.

[0122] According to the tea impurity content detection method provided by an embodiment of the present invention, an attention mechanism layer is added to the three-dimensional image segmentation model to further extract key features in the three-dimensional point cloud data after the target convolution layer, thereby improving the feature extraction capability of the three-dimensional image segmentation model for the three-dimensional point cloud data, and by setting the target fully connected layer to the KAN network layer, the model's relationship learning capability for the three-dimensional point cloud features is improved, thereby improving the classification effect of the three-dimensional point cloud data.

[0123] In some optional implementations, in order to improve the three-dimensional image segmentation model's ability to recognize the type of three-dimensional point cloud data, the trained three-dimensional image segmentation model must meet the following preset convergence conditions: obtain a training loss value based on the predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set and the label information of any three-dimensional point cloud training data in the three-dimensional point cloud training data set; obtain a verification similarity coefficient based on the predicted category of any three-dimensional point cloud verification data in the three-dimensional point cloud verification data set and the label information of any three-dimensional point cloud verification data in the three-dimensional point cloud verification data set according to the preset three-dimensional image segmentation model; when the training loss value is less than a first threshold and the verification similarity coefficient is greater than a second threshold, it is determined that the trained three-dimensional image segmentation model meets the preset convergence conditions.

[0124] The training loss value may be calculated based on classification losses such as cross entropy loss, Dice loss, and Hausdorff loss, which is not limited in this embodiment of the present invention.

[0125] Among them, the verification similarity coefficient can be determined based on the Dice coefficient, and the formula is as follows:

[0126]

[0127] Among them, |X| represents the number of label information of the 3D point cloud verification data, |Y| represents the number of predicted categories of the 3D point cloud verification data, and |X∩Y| represents the number of intersections between label information and predicted categories. By determining the similarity coefficient between the predicted category and the label information, the classification effect of the 3D image segmentation model on the verification data set can be determined.

[0128] It should be noted that the 3D point cloud training data set and the 3D point cloud verification data set are both 3D point cloud data generated by multi-view image generation and 3D reconstruction of tea leaves containing impurities.

[0129] The embodiment of the present invention does not limit the data ratio of the 3D point cloud training data set to the 3D point cloud verification data set. Exemplarily, the data ratio of the 3D point cloud training data set to the 3D point cloud verification data set may be 7:3.

[0130] Furthermore, the trained 3D image segmentation model can also be tested using a 3D point cloud test dataset. For example, the data ratio of the 3D point cloud training dataset, the 3D point cloud verification dataset, and the 3D point cloud test set can be 7:2:1.

[0131] It should also be noted that, since there is little 3D point cloud training data of tea leaves containing impurities available in real scenarios, it is possible to obtain a data-enhanced 3D point cloud training data set by performing data enhancement on the 3D point cloud training data.

[0132] Among them, data enhancement operations can include rotating, cutting, splicing, color temperature enhancement, adding noise, random erasing, etc. of the 3D point cloud training data. By performing data enhancement on the 3D point cloud data, the number of 3D point cloud training data sets can be effectively expanded, and the training effect of the 3D image segmentation model can be improved.

[0133] According to the tea impurity content detection method provided by an embodiment of the present invention, when training a three-dimensional image segmentation model, when the training loss value and the verification similarity coefficient both meet the preset threshold conditions, it is determined that the trained three-dimensional image segmentation model meets the preset convergence conditions, so that it is used as a tea impurity detection model, thereby improving the classification accuracy of the three-dimensional point cloud data set of the tea to be detected and improving the detection accuracy of the tea impurity content.

[0134] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.

[0135] For ease of understanding, the technical implementation details in the above embodiment are described in detail below using a specific example:

[0136] For picked tea leaves, such as Pu'er tea, there are generally a lot of impurities, such as hair, branches, insects, tea fruit, etc. In the related technology, the traditional detection of impurity content in tea leaves requires sorting out the tea impurities in the tea leaves and weighing and calculating them. This method is not only time-consuming and labor-intensive, but also has high requirements for the concentration of the staff. The efficiency of tea impurity content detection is low, and the accuracy of tea impurity content detection cannot be guaranteed.

[0137] At present, deep learning has achieved great success in the field of image processing. Multispectral technology is also becoming more and more sophisticated. Compared with ordinary cameras, multispectral information dimensions are more diverse and can provide more visual information.

[0138] In view of this, an embodiment of the present invention provides a method for detecting the impurity content of tea leaves, which combines deep learning with multi-spectral technology to achieve rapid detection of the impurity content of tea leaves.

[0139] The professional terms used in the embodiments of the present invention are explained as follows:

[0140] Deep learning: Deep learning is a field of artificial intelligence that generally refers to building models using multi-layer neural networks. Deep learning is widely used in computer vision, natural language processing, speech recognition and other fields.

[0141] Multispectral technology: refers to the spectrum detection technology that can simultaneously obtain multiple optical spectrum bands (usually greater than or equal to 3) and expand to infrared and ultraviolet light based on visible light.

[0142] Image segmentation: Image segmentation refers to dividing an image into several non-intersecting regions based on grayscale, color, spatial texture, geometric shape and other features, so that these features show consistency or similarity in the same region, but show obvious differences between different regions. Simply put, it is to separate the target from the background in an image.

[0143] 3D Reconstruction: Recovering the 3D structure of an object from a stack of 2D images, rendering it, and finally expressing the virtual reality of the objective world in a computer.

[0144] 3D U-Net: A 3D image segmentation model designed to process 3D image data, such as volumetric images or voxel data. This model is often used in medical image segmentation, 3D image analysis, and other fields.

[0145] Figure 2 A schematic diagram of a tea impurity content detection method provided by an embodiment of the present invention, referring to Figure 2 , the method comprising:

[0146] Step S200: Acquire multi-view images of tea leaves containing impurities.

[0147] Among them, the background for placing tea leaves containing impurities must be clean, tidy and of a single color. The density of the tea leaves and tea impurities in the tea leaves containing impurities must be moderate, and neither the tea leaves nor the tea impurities are completely covered.

[0148] Exemplarily, if the background on which the tea leaves containing impurities are placed is white, then the image background of the multi-viewing image of the tea leaves containing impurities is white.

[0149] The multi-view images include single-view images at different viewing angles. Different single-view images can be generated by photographing tea leaves containing impurities from different collection angles using imaging devices corresponding to multispectral technology, such as multispectral cameras and hyperspectral cameras.

[0150] For single-view images of adjacent acquisition angles, there needs to be an overlapping area, and the angle differences between adjacent acquisition angles are the same.

[0151] Exemplarily, the overlapping area between single-view images at adjacent acquisition angles accounts for 20%-30%, and the angle difference between adjacent acquisition angles is 20 degrees.

[0152] Step S210: generating a three-dimensional point cloud data set of the tea leaves containing impurities based on the multi-view images of the tea leaves containing impurities.

[0153] In this step, the depth of the multi-view image is first estimated using a preset 3D reconstruction model to obtain a depth map corresponding to the multi-view image.

[0154] Then, according to the camera intrinsic parameters and calibration parameters of the multi-view image acquisition device (such as a multispectral camera), the pixels in the depth map are converted into three-dimensional point cloud data.

[0155] Finally, the 3D point cloud data from different perspectives are fused to generate a complete 3D point cloud dataset.

[0156] Step S220: annotating the three-dimensional point cloud data set to generate label information of the three-dimensional point cloud data set.

[0157] Among them, point cloud annotation tools can be used to annotate the three-dimensional point cloud dataset, such as PCL (PointCloud Library), Open3D, etc.

[0158] It should be noted that when labeling data, each type of tea impurities is marked as one category, the background is marked as one category, and the tea leaves are marked as one category. When there is 3D point cloud data corresponding to the occluded area in the 3D point cloud dataset, such as when tea impurities or the tea leaves are covered by other impurities or tea leaves, it is necessary to annotate the corresponding label information in the real scene according to the actual distribution of the tea leaves or tea impurities.

[0159] It should also be noted that the above steps S200 to S220 can be repeated until enough three-dimensional point cloud data sets and their label information are generated.

[0160] Step S230: dividing the data set according to the three-dimensional point cloud data set and the label information of the three-dimensional point cloud data set.

[0161] The division ratio can be adaptively set according to the training requirements. For example, the training set, the validation set, and the test set are divided in a ratio of 7:2:1.

[0162] Among them, after dividing the training set, data enhancement operations can be performed on the training set, such as rotation, shearing, splicing, color temperature enhancement, adding noise, random erasing and other enhancement methods to fully expand the training set.

[0163] Step S240: training a preset three-dimensional image segmentation model according to the divided training set, and using the trained three-dimensional image segmentation model as a tea impurity detection model.

[0164] Exemplarily, a 3D U-Net model can be used as a preset three-dimensional image segmentation model, the input channel number input_size of the 3D U-Net is set to the height of the three-dimensional point cloud data, and the output channel number output is set to be the same as the input channel number input_size.

[0165] Among them, the convolution kernel of each convolution layer in the 3D U-Net model can adopt a three-dimensional convolution kernel size of 3×3×3.

[0166] Among them, the loss function of the 3D image segmentation model can use the Dice loss function, the formula is as follows:

[0167]

[0168] Among them, |X| represents the number of label information of 3D point cloud data, |Y| represents the number of predicted categories of 3D point cloud data, and |X∩Y| represents the number of intersections between label information and predicted categories.

[0169] During training, the classification effect of the model can be verified through a verification set. For example, the Dice coefficient can be used as a verification indicator of the classification effect of the model.

[0170] After the training is completed, the trained three-dimensional image segmentation model is tested on the test set to test the classification effect of the trained three-dimensional image segmentation model. When the classification effect reaches the preset conditions, the trained three-dimensional image segmentation model is used as a tea impurity detection model to detect the tea impurity content of the tea to be tested.

[0171] Step S250: Acquire multi-view images of the tea leaves to be inspected, wherein the tea leaves to be inspected include: tea leaves themselves and tea leaves impurities.

[0172] In this step, the implementation method of obtaining the multi-view images of the tea leaves to be detected can refer to step S200, which will not be described in detail here.

[0173] Step S260: reconstruct the multi-view images in three dimensions to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected.

[0174] Step S270: inputting the three-dimensional point cloud data set into the pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set.

[0175] Step S280: According to the data category of any three-dimensional point cloud data, determine the three-dimensional point cloud data of which the data category is the impurity category in the three-dimensional point cloud data set.

[0176] Step S290: determining the impurity content of the tea leaves to be tested according to the three-dimensional point cloud data whose data category is the impurity category.

[0177] The impurity content of the tea leaves to be tested may be a relative volume ratio of the impurities to the tea leaves, or a relative mass ratio of the tea leaves to the impurities, which is not limited in the embodiment of the present invention.

[0178] Exemplarily, when the impurity content of the tea to be tested is a relative mass ratio, the impurity content of the tea to be tested is determined based on the three-dimensional point cloud data whose data category is the impurity category, including: obtaining the relative volume ratio of tea impurities to the tea to be tested based on the number of three-dimensional point cloud data whose data category is the impurity category and the total number of three-dimensional point cloud data of the tea to be tested; obtaining the relative mass of the tea impurities and the tea to be tested based on the density of the tea impurities, the total density of the tea to be tested, and the relative volume ratio; obtaining the impurity content of the tea to be tested based on the relative mass and the total mass of the tea to be tested.

[0179] Among them, according to the classification results of 3D U-Net on the three-dimensional point cloud data, the number of three-dimensional point cloud data of different impurity categories and the total number of three-dimensional point cloud data of the tea to be tested can be counted, so that the ratio of the number to the total number is the relative volume ratio of each type of tea impurities to the tea.

[0180] By multiplying the numerator and denominator of the relative volume ratio of each type of tea impurities to tea by the corresponding density, the relative mass of each type of tea impurities to tea can be obtained.

[0181] The density of various tea impurities, the density of the tea itself and the total density of the tea to be tested are all prior information obtained by statistical analysis before the impurity content of the tea is tested.

[0182] After obtaining the relative masses of various tea impurities and the tea to be tested, the relative masses are accumulated to obtain the total relative mass, and then the total relative mass is divided by the total mass of the tea to be tested to obtain the impurity content of the tea to be tested.

[0183] In an embodiment of the present invention, high-quality three-dimensional point cloud data of the tea to be tested can be generated by using three-dimensional reconstruction technology, and then a trained three-dimensional image segmentation model such as 3DU-Net is used to accurately segment the tea body and the tea impurity area, thereby achieving accurate classification of the three-dimensional point cloud data. Finally, the impurity content in the tea can be calculated based on the classification results of the tea impurities and the tea body combined with the prior density information, thereby achieving rapid detection of the impurity content of the tea.

[0184] In a second aspect, an embodiment of the present invention provides a tea impurity content detection device. Figure 3 A block diagram of a tea impurity content detection device provided by an embodiment of the present invention, referring to Figure 3 , the device 300 comprises:

[0185] The acquisition module 301 is used to acquire multi-view images of tea leaves to be detected, wherein the tea leaves to be detected include: tea leaves and tea impurities.

[0186] The generating module 302 is used to perform three-dimensional reconstruction on the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected.

[0187] The classification module 303 is used to input the three-dimensional point cloud data set into a pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set.

[0188] The first determination module 304 is used to determine the three-dimensional point cloud data of which the data category is the impurity category in the three-dimensional point cloud data set according to the data category of any three-dimensional point cloud data.

[0189] The second determination module 305 is used to determine the impurity content of the tea leaves to be tested according to the three-dimensional point cloud data whose data category is the impurity category.

[0190] In some optional implementations, the multi-perspective image includes multiple single-perspective images, and the method of obtaining the multi-perspective image of the tea to be detected includes: performing image acquisition on the tea to be detected from different acquisition angles, respectively, to obtain the multiple single-perspective images corresponding to different acquisition angles; wherein there is an overlapping area between two single-perspective images of adjacent acquisition angles, and the angle difference between the two adjacent acquisition angles is the same.

[0191] In some optional implementations, the multi-view images are taken based on a multi-spectral camera; the three-dimensional reconstruction of the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected includes: inputting the multi-view images into a preset three-dimensional reconstruction model; through the three-dimensional reconstruction model, when it is detected that there is an obstructed area in the tea leaves to be detected, obtaining at least two single-view images containing the obstructed area; based on the at least two single-view images containing the obstructed area, predicting the three-dimensional point cloud data of the obstructed area.

[0192] In some optional implementations, the image background of the multi-view image is a solid color background, and the three-dimensional point cloud data set contains three-dimensional point cloud data corresponding to the image background; then the data category of the three-dimensional point cloud data also includes: background category; determining the three-dimensional point cloud data with data category of impurity category in the three-dimensional point cloud data set according to the data category of any three-dimensional point cloud data includes: determining the three-dimensional point cloud data with data category of background category in the three-dimensional point cloud data set as invalid point cloud data according to the data category of any three-dimensional point cloud data; and determining the three-dimensional point cloud data with data category of impurity category in the three-dimensional point cloud data set from the valid point cloud data in the three-dimensional point cloud data set.

[0193] In some optional implementations, the tea impurity detection model is trained in the following manner: a three-dimensional point cloud training data set containing impure tea leaves is input into a preset three-dimensional image segmentation model to obtain a predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set; the preset three-dimensional image segmentation model is trained according to the predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set and the label information of any three-dimensional point cloud training data in the three-dimensional point cloud training data set, and the trained three-dimensional image segmentation model is used as the tea impurity detection model.

[0194] In some optional implementations, the preset three-dimensional image segmentation model is a three-dimensional image segmentation model that integrates an attention mechanism, including: a target convolution layer, an attention mechanism layer connected to the output end of the target convolution layer, and a target fully connected layer; wherein the target fully connected layer is a KAN network layer.

[0195] According to the tea impurity content detection device provided by the embodiment of the present invention, the multi-perspective image of the tea to be detected obtained by the acquisition module is converted into a high-quality tea and impurity mixed three-dimensional point cloud data set through a generation module, so that according to the classification module, based on a pre-trained tea impurity detection model, each three-dimensional point cloud data in the three-dimensional point cloud data set is type identified to achieve rapid tea impurity detection, and finally, according to the first determination module, the three-dimensional point cloud data with data category of the impurity category in the three-dimensional point cloud data set is determined, and according to the second determination module based on the three-dimensional point cloud data with data category of the impurity category, the impurity content of the tea to be detected is determined, thereby achieving rapid detection of the impurity content of the tea.

[0196] The functions or modules included in the device provided in the embodiment of the present invention can be used to execute the method described in the first aspect method embodiment above. Its specific implementation and technical effects can refer to the description of the above method embodiment. For the sake of brevity, they will not be repeated here.

[0197] It should be noted that all modules involved in this embodiment are logic modules. In practical applications, a logic unit may be a physical unit, or a part of a physical unit, or may be implemented as a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.

[0198] In a third aspect, an embodiment of the present invention provides an electronic device, Figure 4 A block diagram of an electronic device provided by an embodiment of the present invention, referring to Figure 4 , which includes:

[0199] One or more processors 401;

[0200] A memory 402, on which one or more programs are stored, when the one or more programs are executed by one or more processors, the one or more processors implement any one of the above-mentioned methods for detecting impurity content of tea leaves;

[0201] One or more I / O interfaces 403 are connected between the processor and the memory and are configured to implement information exchange between the processor and the memory.

[0202] Among them, the processor 401 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 402 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 403 is connected between the processor 401 and the memory 402, and can realize information interaction between the processor 401 and the memory 402, including but not limited to a data bus (Bus), etc.

[0203] In some embodiments, the processor 401, the memory 402, and the I / O interface 403 are connected to each other through a bus, and further connected to other components of the computing device.

[0204] This embodiment also provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method for detecting the impurity content of tea leaves provided in this embodiment is implemented. To avoid repeated description, the specific steps of the method for detecting the impurity content of tea leaves will not be repeated here.

[0205] This embodiment also provides a computer program product, which includes a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the tea impurity content detection method provided in this embodiment.

[0206] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the invented method described above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0207] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0208] Those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present embodiment and to form different embodiments.

[0209] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A method for detecting impurity content of tea leaves, characterized in that: include: Acquire multi-view images of tea leaves to be detected, wherein the tea leaves to be detected include: tea leaves and tea leaves impurities; Performing three-dimensional reconstruction on the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected; Inputting the three-dimensional point cloud data set into a pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set; According to the data category of any one of the three-dimensional point cloud data, determine the three-dimensional point cloud data of which the data category is an impurity category in the three-dimensional point cloud data set; The impurity content of the tea leaves to be tested is determined based on the three-dimensional point cloud data whose data category is the impurity category.

2. The method according to claim 1, characterized in that The multi-view image includes a plurality of single-view images, and the step of obtaining the multi-view image of the tea leaves to be detected includes: Capturing images of the tea leaves to be detected from different acquisition angles to obtain the multiple single-view images corresponding to the different acquisition angles; There is an overlapping area between two single-view images at adjacent acquisition angles, and the angle difference between the two adjacent acquisition angles is the same.

3. The method according to claim 2, characterized in that The multi-view images are taken based on a multi-spectral camera; The three-dimensional reconstruction of the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected includes: Inputting the multi-view images into a preset three-dimensional reconstruction model; By using the three-dimensional reconstruction model, when it is detected that there is an obstructed area in the tea leaves to be detected, at least two single-view images containing the obstructed area are acquired; Three-dimensional point cloud data of the blocked area is predicted based on the at least two single-view images containing the blocked area.

4. The method according to claim 1, wherein the image background of the multi-view image is a solid color background, and the three-dimensional point cloud data set includes three-dimensional point cloud data corresponding to the image background; Then the data category of the three-dimensional point cloud data also includes: background category; The step of determining, according to the data category of any one of the three-dimensional point cloud data, that the three-dimensional point cloud data in the three-dimensional point cloud data set is of the impurity category comprises: According to the data category of any one of the three-dimensional point cloud data, determining the three-dimensional point cloud data of the background category in the three-dimensional point cloud data set as invalid point cloud data; From the valid point cloud data in the three-dimensional point cloud data set, three-dimensional point cloud data of which the data category is an impurity category in the three-dimensional point cloud data set is determined.

5. According to the method of claim 1, the tea impurity detection model is trained by the following method: Inputting the three-dimensional point cloud training data set of tea leaves containing impurities into a preset three-dimensional image segmentation model to obtain a predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set; According to the predicted category of any three-dimensional point cloud training data in the three-dimensional point cloud training data set and the label information of any three-dimensional point cloud training data in the three-dimensional point cloud training data set, the preset three-dimensional image segmentation model is trained, and the trained three-dimensional image segmentation model is used as the tea impurity detection model.

6. According to the method of claim 5, the preset 3D image segmentation model is a 3D image segmentation model integrating an attention mechanism, comprising: A target convolutional layer, an attention mechanism layer connected to an output end of the target convolutional layer, and a target fully connected layer; wherein the target fully connected layer is a KAN network layer.

7. A tea impurity content detection device, the device comprising: An acquisition module is used to acquire multi-view images of tea leaves to be detected, wherein the tea leaves to be detected include: tea leaves and tea leaves impurities; A generating module, used for performing three-dimensional reconstruction on the multi-view images to generate a three-dimensional point cloud data set corresponding to the tea leaves to be detected; A classification module, used for inputting the three-dimensional point cloud data set into a pre-trained tea impurity detection model to obtain a data category of any three-dimensional point cloud data in the three-dimensional point cloud data set; A first determination module is used to determine the three-dimensional point cloud data of which the data category is an impurity category in the three-dimensional point cloud data set according to the data category of any three-dimensional point cloud data; The second determination module is used to determine the impurity content of the tea leaves to be tested according to the three-dimensional point cloud data whose data category is the impurity category.

8. An electronic device, characterized in that: include: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6; One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.

9. A computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises a computer-readable code or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image segmentation method and device

    CN113256668A

  • Tea leaf impurity detection method and device, electronic equipment and storage medium

    CN114972196A

  • Vegetable seedling strengthening judgment model determination method and system

    CN115880429A

  • Coarse aggregate grading, needle and flake content and irregular particle content detection method

    CN116148143A

  • Object pose estimation method and device in disordered grabbing process and electronic equipment

    CN117456002A

Cited By

  • Automatic and rapid picking method for nut green peel fruits in hilly areas

    CN119344091A

  • Tea leaf detection device and method and computer storage medium

    CN119862535A

  • Raw tea grade screening method, medium and equipment

    CN120765950A