A method for determining tea fermentation degree based on image recognition
The geometric and texture characteristics of tea are extracted through image segmentation and wavelet transformation, combined with deep neural network, the subjectivity and inefficiency of tea fermentation detection are solved, and automated and efficient tea fermentation determination is achieved.
Patent Information
- Application Number
- CN202410815308.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-06-24
AI Technical Summary
The prior art has problems such as strong subjectivity, low efficiency and limited feature expression ability in tea fermentation detection, making it difficult to achieve automated and efficient tea fermentation determination.
Image segmentation and contour detection technology are used to extract the geometric features of tea, and texture features are extracted through wavelet transformation method, comprehensive visual feature vector is constructed, and automatic learning and prediction are combined with deep neural networks to achieve continuous scoring of tea fermentation degree.
By integrating geometric and texture features, the visual information of tea can be fully described, automatic and efficient tea fermentation detection can be achieved, which significantly improves production and application efficiency and reduces the intensity of labor.
Smart Images

Figure CN118674761B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image recognition, in particular to a method for determining the fermentation degree of tea leaves based on image recognition. Background Art
[0002] In recent years, with the continuous development of artificial intelligence and computer vision technology, intelligent evaluation and detection methods based on image recognition have been widely used in the field of agricultural product quality control.
[0003] As an important beverage in China and even in the world, the quality of tea directly affects the taste experience. The fermentation degree of tea is one of the key factors that determine its quality, so it is of great significance to accurately detect and evaluate the fermentation degree.
[0004] Traditional methods for detecting tea fermentation degree mainly rely on manual sensory judgment, which has many shortcomings such as strong subjectivity, low efficiency, and inability to achieve automation. In order to overcome these shortcomings, researchers have proposed a variety of methods based on image processing and pattern recognition. Early methods mostly used classic computer vision technology routes such as manually designed features and machine learning classifier models. Although they have achieved certain results, they still have limitations such as limited feature expression ability and poor generalization.
[0005] With the rise of deep learning technology, image recognition methods based on deep models such as convolutional neural networks have demonstrated powerful automatic feature learning capabilities and excellent classification performance, and have made breakthrough progress in multiple visual tasks.
[0006] However, how to effectively integrate multimodal image features, design efficient end-to-end deep models, and successfully apply them to specific agricultural product quality prediction tasks remains a key issue that needs to be addressed. Summary of the invention
[0007] In view of the above problems existing in the prior art, the present invention is proposed.
[0008] Therefore, the problem to be solved by the present invention is how to provide a method for determining the fermentation degree of tea leaves based on image recognition.
[0009] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0010] In the first aspect, an embodiment of the present invention provides a method for determining the fermentation degree of tea leaves based on image recognition, which includes collecting a set of standard tea sample images and performing preprocessing; inputting the geometric and texture features of the image into a geometric information extraction algorithm and a texture feature extraction algorithm respectively to extract the geometric features and texture features; fusing the extracted geometric features and texture features to construct a comprehensive visual feature vector; inputting the comprehensive visual feature vector into a deep neural network model to automatically learn and optimize the feature representation and classifier for predicting the fermentation degree of tea leaves; performing forward propagation inference on the newly input tea image to output a continuous score value of the fermentation degree.
[0011] As a preferred solution of the tea fermentation degree determination method based on image recognition of the present invention, the extraction of geometric features includes: using image segmentation and contour detection technology to separate the contour of the tea leaves from the background, including the following steps: considering the gradient amplitude of each pixel point, and combining the consistency between the gradient direction of the pixel point and the ideal edge direction, the formula is as follows:
[0012]
[0013] Among them, C(x,y) is the confidence of the tea leaf contour at a certain point in the image; γ is the influencing factor of the geometric information extraction algorithm F(I); F(I) is the Canny edge detection algorithm; I(x,y) is the original image; for the extracted tea leaf contour, various geometric parameters are calculated as geometric features.
[0014] As a preferred solution of the tea fermentation degree determination method based on image recognition described in the present invention, the extraction of texture features includes: performing multi-scale and multi-directional texture analysis on the image based on the wavelet transform method: performing Gaussian smoothing filtering on the original input image; convolving the image after Gaussian smoothing filtering with wavelet bases in different scale directions respectively to obtain texture features in the corresponding scale direction; weighted summing of texture features in all scale directions to obtain the final result I'(x, y), the formula is as follows:
[0015]
[0016] Where I(x,y) is the original input image; gσ(x,y) is the Gaussian smoothing kernel function; σ is the standard deviation parameter; * represents the convolution operation; is the wavelet basis function, corresponding to scale m and direction n; β m,n The wavelet coefficients corresponding to scale m and direction n; M and N are the maximum values of scale and direction respectively; I'(x, y) is the final texture analysis result image.
[0017] As a preferred solution of the tea fermentation degree determination method based on image recognition of the present invention, the formula for extracting the color distribution characteristics of the tea leaf surface according to the texture analysis result image finally obtained is as follows:
[0018]
[0019] Among them, H c (k) is the color histogram, which counts the number of times each color value k appears in the image; δ() is the discrete Dirac function, which is 1 when I'(x, y) = k, otherwise it is 0; L is the color level; M0×N0 are the length and width of the image.
[0020] As a preferred solution of the tea fermentation degree determination method based on image recognition of the present invention, the construction of the comprehensive visual feature vector includes the following processes: constructing a geometric feature vector: assuming that the geometric features include: area A; perimeter P; aspect ratio AR; roundness R, then the geometric feature vector is expressed as: G = [A, P, AR, R]; constructing a texture feature vector: assuming that the texture features include: color histogram vector H c ; GLCM contrast Con; GLCM entropy Ent; GLCM energy Eng; GLCM homogeneity Hom, then the texture feature vector is expressed as: T = [H c ,Con,Ent,Eng,Hom]; Fusion of geometric and texture feature vectors: First normalize each feature to get G' and T'; directly concatenate the normalized geometric and texture features to get: V = [G', T'] = [A', P', AR', R', H c ',Con',Ent',Eng',Hom']; Different features have different importance to the final task, and different weights are assigned to obtain the comprehensive visual feature vector V w :
[0021] V w =[w1A',w2P',w3AR',w4R',w5H c ',w6Con',w7Ent',w8Eng',w9Hom']
[0022] Among them, w i is the weight of the corresponding feature.
[0023] As a preferred solution of the method for determining the degree of fermentation of tea leaves based on image recognition described in the present invention, wherein: the automatic learning and optimization of the feature representation and classifier for predicting the degree of fermentation of tea leaves includes: optimizing the Adam optimization algorithm; inputting the training data into the deep neural network model in batches for forward propagation and back propagation; and continuously adjusting the network weights through the optimized algorithm to minimize the value of the loss function. As a preferred solution of the method for determining the degree of fermentation of tea leaves based on image recognition described in the present invention, wherein: the optimization of the Adam optimization algorithm includes: setting the initial learning rate α, weight decay coefficient λ; momentum parameters β1 and β2; initial model parameters θ0; small constant ∈; initializing the first-order moment estimate m0=0 and the second-order moment estimate v0=0; for each time step t: calculating the gradient: gt=▽ θ J(θ t-1 ); Update the first-order moment estimate: m t =β1m t-1 +(1-β1)gt; Update the second-order moment estimate: v t =β2v t -1+(1-β2)gt 2 ;
[0024] Compute the bias-corrected estimate: and
[0025] Dynamic learning rate adjustment:
[0026] The parameter update is optimized as follows:
[0027]
[0028] Save the final trained model weights.
[0029] In a second aspect, an embodiment of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the method for determining the fermentation degree of tea leaves based on image recognition as described in the first aspect of the present invention is implemented.
[0030] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the method for determining the fermentation degree of tea leaves based on image recognition as described in the first aspect of the present invention is implemented.
[0031] The beneficial effects of the present invention are as follows: the present invention can well characterize the appearance characteristics of the tea leaves by extracting the geometric contour features of the tea leaves by adopting image segmentation and contour detection technology; the texture feature extraction based on wavelet transform can effectively capture the intrinsic characteristics of the tea leaf surface such as color and texture, and the combination of the two can comprehensively describe the visual information of the tea leaves; and by fusing two different types of features, geometry and texture, a comprehensive visual feature vector is constructed, which can maximize the retention of the rich information contained in the original image; the present invention only needs to perform simple forward propagation reasoning on the newly input tea leaf image, and can quickly output the corresponding continuous scoring value of the fermentation degree, thereby realizing automatic and efficient detection of the fermentation degree of tea leaves, significantly improving production and application efficiency, and reducing manual labor intensity. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0033] Figure 1 This is a flow chart of the method for determining the degree of tea fermentation based on image recognition in Example 1. DETAILED DESCRIPTION
[0034] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0035] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0036] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0037] Example 1
[0038] Reference Figure 1 , which is the first embodiment of the present invention, provides a method for determining the fermentation degree of tea leaves based on image recognition, comprising the following steps:
[0039] S1: Collect a set of standard tea sample images and perform preprocessing.
[0040] Specifically, a large number of standard tea samples of various fermentation levels are collected, multi-view images are taken of each tea sample under a standard lighting environment, and high-quality preprocessing such as denoising, segmentation, and correction is performed on the images.
[0041] Obtain standard tea samples of different fermentation levels (such as blue, green, red, black, etc.) from authoritative organizations or professional manufacturers; prepare a sufficient number (such as 50-100) of tea samples for each fermentation level to ensure the diversity and representativeness of the samples, number each tea sample, and record metadata information such as fermentation level, origin, and variety.
[0042] Set up a standard lighting environment, such as using soft light sources, ensuring uniform lighting, controlling color temperature, etc., and prepare a standard shooting background, such as a high-contrast solid color background or a small corrugated board.
[0043] Spread each tea sample flat on a background board, and take images from multiple angles, such as top and side perspectives. Use a high-resolution digital camera (e.g., 24 megapixels or above) and adopt manual focus mode to ensure clarity. Take images from 3-5 perspectives for each tea sample to ensure that sufficient visual information is captured.
[0044] All captured images were imported into a computer and pre-processed using professional image processing software: denoising was performed on the images to reduce shooting noise, improve image clarity, image segmentation was performed to accurately separate the tea samples from the background, geometric correction was performed to eliminate lens distortion, ensure the accuracy of the image geometric information, and standardize image parameters such as brightness and contrast.
[0045] Finally, the preprocessed high-quality images are classified and stored according to the fermentation degree level, each image is named, and the metadata information is encoded in the file name to construct a standard tea sample image dataset.
[0046] S2: Input the geometric and texture features of the image into the geometric information extraction algorithm and the texture feature extraction algorithm respectively to extract the geometric features and texture features of the tea leaves.
[0047] S2.1: Input the preprocessed standard tea sample image into the optimized geometric information extraction algorithm to extract the tea outline.
[0048] Specifically, the image segmentation and contour detection technology can accurately separate the outline of tea leaves from the complex background, as follows:
[0049] In the Canny algorithm, a key step is non-maximum suppression, which aims to refine the edge to a pixel width. Non-maximum suppression is done by detecting whether each pixel is located at the center of a possible edge based on its gradient value and direction. If not, it is suppressed.
[0050] The confidence score of the present invention first considers the gradient amplitude of the point ▽ 2 I(x,y), the larger the gradient amplitude, the more likely it is an edge point, and combined with the consistency between the gradient direction of the point and the ideal edge direction, the specific formula is as follows:
[0051]
[0052] Among them, C(x,y) is the confidence of the tea leaf contour at a certain point in the image; γ is the influencing factor of the geometric information extraction algorithm F(I); F(I) is the Canny edge detection algorithm; I(x,y) is the original image.
[0053] If the gradient direction of the point is highly consistent with the ideal edge direction, the value of this item is close to 1; if the direction difference is large, the value of this item will be less than 1, thereby reducing the score of the point being judged as an edge point; C(x, y) combines the two factors of gradient amplitude and direction consistency to give a comprehensive edge confidence assessment.
[0054] For the extracted tea leaf contour, its geometric parameters such as area, perimeter, aspect ratio, and roundness are calculated as geometric features.
[0055] S2.2: Input the preprocessed tea sample image into the optimized texture feature extraction algorithm to perform multi-scale and multi-directional texture analysis on the image.
[0056] Among them, the optimized texture feature extraction algorithm is based on the wavelet transform method to perform multi-scale and multi-directional texture analysis on the image, as follows:
[0057] First, the original input image is subjected to Gaussian smoothing filtering;
[0058] The image after Gaussian smoothing filtering is convolved with wavelet bases in different scale directions to obtain the texture features in the corresponding scale direction;
[0059] The texture features of all scale directions are weighted and summed to obtain the final result I'(x,y). The specific formula is as follows:
[0060]
[0061] Where I(x,y) is the original input image; gσ(x,y) is the Gaussian smoothing kernel function used for image denoising; σ is the standard deviation parameter; * represents the convolution operation; is the wavelet basis function, corresponding to scale m and direction n, used for texture feature extraction; β m,n The wavelet coefficients corresponding to scale m and direction n; M and N are the maximum values of scale and direction respectively; I'(x, y) is the final texture analysis result image.
[0062] Through this transformation process, the classical wavelet transform is introduced with the ability of multi-directional analysis, which can better capture the directional texture characteristics of the image.
[0063] The color distribution characteristics of the tea leaf surface are extracted based on the texture analysis result image, as follows:
[0064]
[0065] Among them, H c (k) is the color histogram, which counts the number of times each color value k appears in the image; δ() is the discrete Dirac function, which is 1 when I'(x, y) = k, otherwise it is 0; L is the color level, such as L = 256 for an 8-bit grayscale image; M0×N0 are the length and width of the image.
[0066] Since I'(x,y) has filtered out some noise and details, the histogram more closely reflects the overall color distribution.
[0067] Calculate the gray-level co-occurrence matrix characteristics of the leaf surface and analyze the thickness, regularity, orderliness, etc. of the texture. The specific formula is as follows:
[0068]
[0069] Among them, d is the pixel distance; θ is the direction angle; i and j are pixel values.
[0070] It can be seen that since I'(x, y) has filtered out some noise, GLCM can more accurately reflect the real texture pattern; and I'(x, y) retains and enhances multi-scale and multi-directional texture details, so GLCM can capture richer texture information.
[0071] Most importantly, I'(x,y) itself is obtained by multi-scale wavelet analysis, which is consistent with the multi-scale nature of GLCM, and can make the extracted color and texture features of higher quality.
[0072] Texture features such as contrast, entropy, energy, homogeneity and other statistics can be further calculated from the gray-level co-occurrence matrix features to describe the texture details of the image.
[0073] In general, by further statistically analyzing the texture analysis result image I'(x, y), the features of both color and texture can be extracted, providing effective feature representation for subsequent recognition and classification tasks.
[0074] S3: Fuse the extracted geometric features and texture features to construct a comprehensive visual feature vector.
[0075] S3.1: Construct geometric feature vectors.
[0076] Assume that the geometric features include: area A; perimeter P; aspect ratio AR; roundness R.
[0077] Then the geometric eigenvector can be expressed as: G = [A, P, AR, R].
[0078] S3.2: Construct texture feature vector.
[0079] Assume that texture features include: color histogram H c ; GLCM contrast Con; GLCM entropy Ent; GLCM energy Eng; GLCM homogeneity Hom.
[0080] Then the texture feature vector can be expressed as:
[0081] T=[H c ,Con,Ent,Eng,Hom].
[0082] Where: H c The color histogram vector of length L, Con, Ent, Eng, and Hom are four texture statistics features further extracted based on the previously calculated GLCM matrix.
[0083] S3.3: Fusion of geometric and texture feature vectors.
[0084] Preferably, since the numerical ranges of different features vary greatly, direct concatenation may result in some features being magnified or reduced, and therefore each feature needs to be normalized to obtain G' and T'.
[0085] Directly concatenate the normalized geometric and texture features:
[0086] V=[G',T']=[A',P',AR',R',H c ',Con',Ent',Eng',Hom']
[0087] It should be noted that the splicing and fusion method is simple and direct and will not change the original characteristics of each feature.
[0088] Different features have different importance to the final task and can be assigned different weights to obtain a comprehensive visual feature vector Vw :
[0089] V w =[w1A',w2P',w3AR',w4R',w5H c ',w6Con',w7Ent',w8Eng',w9Hom']
[0090] Among them, w i is the weight of the corresponding feature.
[0091] S4: The comprehensive visual feature vector is input into the deep neural network model for end-to-end training to automatically learn and optimize the feature representation and classifier for predicting the fermentation degree of tea.
[0092] Specifically, a suitable deep neural network architecture is selected, such as a convolutional neural network (CNN), a fully convolutional network, etc. The present invention selects a convolutional neural network, defines the model input as the original image data, and outputs a continuous fermentation degree prediction value.
[0093] The loss function is as follows:
[0094] Since the goal is to predict a continuous fermentation score, the mean square error can be used as the loss function, as follows:
[0095]
[0096] Where n1 is the number of samples; yi is the true fermentation degree of the i-th sample; is the predicted fermentation degree of the ith sample.
[0097] Select the Adam optimization algorithm and set hyperparameters such as learning rate.
[0098] In order to better adapt to the problem of tea fermentation degree prediction, the algorithm is optimized. The training data is input into the deep neural network model in batches for forward propagation and back propagation. The network weights are continuously adjusted through the optimized algorithm to minimize the loss function value. The hyperparameters and early stopping are adjusted in time according to the performance on the validation set.
[0099] Furthermore, the optimization of the Adam optimization algorithm includes the following:
[0100] Set the initial learning rate α, weight decay coefficient λ; momentum parameters β1 and β2; initial model parameters θ0; small constant ∈; initialize the first-order moment estimate m0=0 and the second-order moment estimate v0=0.
[0101] For each time step t:
[0102] Calculate the gradient: gt = ▽ θ J(θ t-1 );
[0103] Update first-order moment estimate: m t =β1m t-1 +(1-β1)gt;
[0104] Update the second moment estimate: v t =β2v t -1+(1-β2)gt 2 ;
[0105] Compute the bias-corrected estimate: and
[0106] Dynamic learning rate adjustment:
[0107] The parameter update is optimized as follows:
[0108]
[0109] Dynamically adjusting the learning rate according to the progress of training can better adapt to the learning needs of different stages and prevent model overfitting through weight decay.
[0110] The performance indicators of the final model were evaluated on the reserved test set: statistics such as the root mean square error and correlation coefficient of fermentation degree prediction were calculated.
[0111] Save the final trained model weights.
[0112] S5: Deploy the trained deep neural network model to the online prediction system, perform forward propagation inference on the newly input tea images, and output a continuous score value of the fermentation degree.
[0113] Specifically, the output quantitative score results are transmitted back to the front-end interface through the API, and the front-end interface renders and visualizes the score results. The fermentation degree scoring results can be intuitively displayed in the form of numerical values or progress bars.
[0114] The image data, intermediate features and final score results of each detection are stored in the database, and a unique ID is generated for each detection task to achieve data traceability.
[0115] It should be noted that in the task of determining the degree of tea fermentation, the source and processing of data are crucial to the credibility of the results, and data traceability can effectively solve the problems of data source and processing, and improve the credibility and reliability of the results.
[0116] This embodiment also provides a computer device, which is suitable for the method of determining the fermentation degree of tea based on image recognition, and includes: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the method of determining the fermentation degree of tea based on image recognition as proposed in the above embodiment.
[0117] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0118] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for determining the fermentation degree of tea leaves based on image recognition as proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0119] In summary, the present invention extracts the geometric contour features of tea leaves by adopting image segmentation and contour detection technology, which can well characterize the appearance characteristics of tea leaves; the texture feature extraction based on wavelet transform can effectively capture the intrinsic characteristics of the tea leaf surface such as color and texture, and the combination of the two can comprehensively describe the visual information of tea leaves; and by fusing two different types of features, geometry and texture, a comprehensive visual feature vector is constructed, which can maximize the retention of rich information contained in the original image; the present invention only needs to perform simple forward propagation reasoning on the newly input tea image, and can quickly output the corresponding continuous score value of fermentation degree, thereby realizing automatic and efficient detection of tea fermentation degree, significantly improving production and application efficiency, and reducing manual labor intensity.
[0120] Example 2
[0121] Reference Figure 1 , which is the second embodiment of the present invention, is provided with experimental data of a method for determining tea fermentation degree based on image recognition in order to further verify the beneficial effects of the present invention.
[0122] In order to verify the effectiveness and superiority of the method of the present invention in the task of determining the degree of tea fermentation, we conducted the following experiments:
[0123] 650 certified standard tea samples were obtained from the national testing center, covering 8 fermentation levels such as green tea, black tea, dark tea, and white tea. 80-100 tea samples of different varieties and origins were prepared for each level. A standard lighting environment was set up, using a 60cm diameter ring LED light source with a color temperature of 5600K. A high-resolution digital camera (24 million effective pixels) was used to photograph each tea sample from a top perspective and a 45-degree side perspective. All images were subjected to high-quality preprocessing such as denoising, segmentation, and correction to construct a standard tea sample image set.
[0124] The preprocessed image is input into the geometric information extraction algorithm to extract the geometric parameters such as the outline, area, and perimeter of the tea leaves. The optimized texture feature extraction algorithm obtains the color histogram, and the geometric and texture feature vectors are fused to obtain V w, And assign weights to different features.
[0125] ResNet50 is used as the network infrastructure, with Vw as input and fermentation degree continuous value score as output. Adam optimization is used, with initial learning rate of 0.001, momentum parameter of 0.9 / 0.999, weight decay of 1e-4, and training for 32 epochs. The learning rate is adjusted for each epoch verification, and an early termination strategy is adopted to achieve the optimal root mean square error of 0.137 and correlation coefficient of 0.948 on the verification set.
[0126] Export the trained model and deploy it on the Alibaba Cloud GPU instance to run the inference service. The front-end interface can upload tea sample images, and the back-end returns the fermentation degree scoring results and displays them visually.
[0127] Some experimental data are as follows:
[0128] Table 1 Experimental data table
[0129]
[0130] It can be seen from the above table that the method of the present invention has achieved relatively accurate continuous scoring prediction results on tea samples with different fermentation levels. Specifically, the absolute value of the prediction error of most samples is within 0.03, and the minimum is only 0.007, which is very close to the true fermentation value, and covers the entire range from micro-fermentation to full fermentation, reflecting the robustness and generalization ability of the method. The geometric feature scores and texture feature scores of each sample are quite different, but the comprehensive score of the two is close to the medium level.
[0131] This shows that this method can well integrate the advantages of two types of heterogeneous features, making the comprehensive feature vector balanced and complementary.
[0132] Compared with the existing methods that only consider the limitations of single visual clues such as color and texture, the present invention incorporates multimodal information such as geometric shapes, so that it can more comprehensively characterize the visual characteristics of tea leaves and improve the accuracy and stability of recognition.
[0133] It can be seen that the present invention significantly improves the automation level and intelligence level of tea fermentation degree detection, and has important theoretical significance and application value in the field of tea quality control and processing.
[0134] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for determining the degree of tea fermentation based on image recognition, characterized in that: include: Collect standard tea sample image sets and perform preprocessing; The geometric and texture features of the image are input into the geometric information extraction algorithm and the texture feature extraction algorithm respectively to extract the geometric features and the texture features; The extracted geometric features and texture features are fused to construct a comprehensive visual feature vector; Inputting the comprehensive visual feature vector into a deep neural network model to automatically learn and optimize feature representation and classifiers for predicting tea fermentation degree; Perform forward propagation inference on the newly input tea image and output a continuous score of the fermentation degree; The extraction of geometric features comprises: Image segmentation and contour detection techniques are used to separate the outline of tea leaves from the background, including the following steps: Considering the gradient amplitude of each pixel, and combining the consistency between the gradient direction of the pixel and the ideal edge direction, the confidence is calculated. The formula is as follows: Where C(x,y) is the confidence of the tea leaf contour at a certain point in the image; γ is the influencing factor of the geometric information extraction algorithm F(I); F(I) is the Canny edge detection algorithm; I(x,y) is the original image; Calculate various geometric parameters as geometric features; The extraction of the texture features includes: Based on the wavelet transform method, multi-scale and multi-directional texture analysis of the image is performed: Perform Gaussian smoothing filtering on the original input image; The image after Gaussian smoothing filtering is convolved with wavelet bases in different scale directions to obtain the texture features in the corresponding scale direction; The weighted sum of texture features in all scale directions is used to obtain the final result I'(x,y), and the formula is as follows: Where I(x,y) is the original input image; gσ(x,y) is the Gaussian smoothing kernel function; σ is the standard deviation parameter; * represents the convolution operation; is the wavelet basis function, corresponding to scale m and direction n; β m,n The wavelet coefficients corresponding to scale m and direction n; M and N are the maximum values of scale and direction respectively; I'(x, y) is the final texture Analyze the result image; The automatic learning and optimization of the feature representation and classifier for predicting the fermentation degree of tea leaves includes: Optimize the Adam optimization algorithm; Input the training data into the deep neural network model in batches for forward propagation and backpropagation; The network weights are continuously adjusted through the optimized algorithm to minimize the loss function value; The Adam optimization algorithm is optimized as follows: Set the initial learning rate α, weight decay coefficient λ; momentum parameters β1 and β2; initial model parameters θ0; small constant ∈; initialize the first-order moment estimate m0 = 0 and the second-order moment estimate v0 = 0; For each time step t: Compute the gradient: Update first-order moment estimate: m t =β1m t-1 +(1-β1)gt; Update the second moment estimate: v t =β2v t -1+(1-β2)gt 2 ; Compute the bias-corrected estimate: and Dynamic learning rate adjustment: The parameter update is optimized as follows: Save the final trained model weights.
2. The method for determining the degree of tea fermentation based on image recognition according to claim 1, characterized in that: The formula for extracting the color distribution characteristics of the tea leaf surface based on the final texture analysis result image is as follows: Among them, H c (k) is the color histogram, which counts the number of times each color value k appears in the image; δ() is the discrete Dirac function, which is 1 when I'(x, y) = k, otherwise it is 0; L is the color level; M0×N0 are the length and width of the image.
3. The method for determining the degree of fermentation of tea leaves based on image recognition according to claim 2, characterized in that: The construction of a comprehensive visual feature vector The process includes: Construct geometric eigenvectors: Assuming that the geometric features include: area A, perimeter P, aspect ratio AR and roundness R, the geometric feature vector is expressed as: G = [A, P, AR, R]; Construct a texture feature vector: Assume that the texture features include: color histogram vector H c ; GLCM contrast Con; GLCM entropy Ent; GLCM energy Eng; GLCM homogeneity Hom, the texture feature vector is expressed as: T = [H c ,Con,Ent,Eng,Hom]; Fuse geometric and texture feature vectors: First, normalize each feature to obtain G' and T'; Directly concatenate the normalized geometric and texture features to obtain: V=[G',T']=[A',P',AR',R',H c ',Con',Ent',Eng',Hom']; Different features have different importance to the final task, and different weights are assigned to obtain the comprehensive visual feature vector V w : In w =[w1A',w2P',w3AR',w4R',w5H c ',w6Con',w7Ent',w8Eng',w9Hom'] Among them, w i is the weight of the corresponding feature.
Citation Information
Patent Citations
Online automatic tobacco leaf grade sorting identification method based on machine vision
CN111274860A
Fresh tea leaf classification method based on multiple features and multiple classifiers
CN111861103A
Method for estimating 6D attitude of transparent object grabbed by mechanical arm
CN114119753A
Multi-feature serial fusion-based rhombus appearance quality grading method
CN115240045A
Precise identification method for tea tender shoot grade in complex environment
CN115810106A
