Tea quality detection and analysis method and system
Through the fusion of hyperspectral images and RGB images and multimodal feature analysis, a comprehensive quality evaluation model was constructed, which solved the problem of the separation of the internal quality and appearance evaluation of tea, achieved a comprehensive and objective evaluation of tea quality, and improved the evaluation efficiency and market. Optional.
Patent Information
- Application Number
- CN202411773622.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing tea quality detection methods separate the internal quality and appearance for evaluation, and the lack of a unified evaluation system has led to chaos in the tea market and it is difficult for consumers to choose.
Hyperspectral image acquisition and RGB images are fused, and a comprehensive quality evaluation model is constructed through multimodal feature analysis and feature vector decoupling, which can realize objective and quantitative evaluation of internal quality and appearance quality, and generate a tea quality level report.
It realizes comprehensive, objective and refined evaluation of tea quality, improves the efficiency and practicality of quality evaluation, provides a unified evaluation system, and solves the problem of separation between internal quality and appearance evaluation.
Smart Images

Figure CN119246441A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tea quality detection, and in particular to a tea quality detection and analysis method and system. Background Art
[0002] In the early days, tea quality was mainly evaluated by sensory evaluation, relying on the experience and senses (vision, smell, taste, touch) of tea tasters to comprehensively evaluate the appearance, aroma, taste, soup color, etc. of tea. This method is simple and easy to use, but it is highly subjective. The experience and personal preferences of tea tasters will have a great impact on the evaluation results, lacking objectivity and consistency. In recent years, various advanced instrumental analysis technologies have been applied to tea quality testing, such as electronic nose, electronic tongue, near-infrared spectroscopy, hyperspectral imaging, etc. These technologies can simulate human senses to objectively evaluate the aroma and taste of tea, or quickly and non-destructively obtain the spectral information of tea for component analysis and quality prediction. These technologies have improved detection efficiency and objectivity.
[0003] However, the existing tea quality evaluation methods still have some limitations. For example, most methods separate the internal quality and appearance and evaluate them separately, lacking a unified evaluation system. Internal quality and appearance are two important aspects of tea quality. The two are interrelated and jointly affect the overall quality of tea. Evaluating the two separately cannot fully reflect the true quality of tea. The evaluation results of internal quality and appearance obtained separately are difficult to be effectively integrated and utilized, and cannot provide comprehensive guidance for the production, processing, and sales of tea. The lack of a unified evaluation system makes it difficult to establish a scientific tea quality grading standard, resulting in chaos in the tea market and difficulty for consumers to choose. Summary of the invention
[0004] Based on this, it is necessary to provide a tea quality detection and analysis method and system to solve at least one of the above technical problems.
[0005] To achieve the above purpose, a tea quality detection and analysis method comprises the following steps: Step S1: performing hyperspectral image acquisition on tea samples and performing RGB image acquisition to obtain an original hyperspectral image and an RGB image; performing spatial information registration on the original hyperspectral image according to the RGB image to obtain a registered hyperspectral image; performing spectral-spatial data fusion on the registered hyperspectral image and the RGB image to obtain spectral-spatial fusion data; Step S2: Analyze the intrinsic and external features of the spectral-spatial fusion data to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain an intrinsic decoupling feature and an external decoupling feature; Step S3: Analyze the component concentration according to the endoplasmic decoupling characteristics to obtain component concentration data; quantify the endoplasmic quality index according to the component concentration data to obtain the endoplasmic quality index data; quantify the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain the appearance quality index data; construct a quality index data set for the endoplasmic quality index data and the appearance quality index data to obtain the quality index data set; Step S4: construct a comprehensive quality evaluation model based on the quality indicator data set, and perform model performance evaluation and optimization to obtain a comprehensive quality evaluation model; perform a comprehensive quality score based on the comprehensive quality evaluation model to obtain a comprehensive quality score; Step S5: Classify the tea quality grades according to the comprehensive quality scores and obtain a tea quality grade report to implement tea quality detection and analysis.
[0006] The present invention acquires fused data containing rich spectral information and spatial information by collecting hyperspectral and RGB images, and performing image registration and fusion, thereby laying a data foundation for the subsequent comprehensive analysis of tea quality and improving the accuracy and reliability of the analysis. Through multimodal feature analysis and feature vector decoupling, the internal quality characteristics and appearance characteristics of tea leaves are effectively separated, mutual interference between the characteristics is avoided, and the subsequent quality index quantification is more accurate, which improves the objectivity of quality evaluation. Through component concentration analysis and quality index quantification, the spectral data is converted into specific quality index data, such as internal quality component content, leaf integrity, curling and glossiness, etc., to achieve an objective and quantitative evaluation of the internal quality and appearance quality of tea leaves. By constructing and optimizing a comprehensive quality evaluation model, a mapping relationship between quality indicators and comprehensive quality scores is established, a comprehensive evaluation of tea quality is achieved, and the interpretability of the model is improved through SHAP value analysis, making the evaluation results more convincing. By classifying tea quality grades according to the comprehensive quality score and generating a report, complex quality data is converted into intuitive grade classification results and detailed reports, which is convenient for users to understand and use, and improves the efficiency and practicality of tea quality evaluation. Therefore, the present invention provides a method for detecting and analyzing the quality of tea leaves, which constructs a unified evaluation system by organically combining the internal quality and appearance evaluation of tea leaves, thereby achieving a comprehensive, objective and refined evaluation of the quality of tea leaves, and effectively solving the shortcomings of the existing methods that separate the internal quality and appearance evaluation of tea leaves and lack a unified evaluation system.
[0007] Preferably, step S1 comprises the following steps: Step S11: collecting hyperspectral images of tea samples by a hyperspectral imaging system to obtain an original hyperspectral image; collecting RGB images of tea samples by a high-resolution RGB camera to obtain an RGB image; Step S12: performing spatial information registration on the original hyperspectral image according to the RGB image to obtain a registered hyperspectral image; Step S13: calibrating the spectral data of the registered hyperspectral image to obtain a calibrated hyperspectral image; Step S14: performing spectral preprocessing on the calibrated hyperspectral image to obtain a preprocessed hyperspectral image; Step S15: performing spectral-spatial data fusion on the preprocessed hyperspectral image and the RGB image to obtain spectral-spatial fused data.
[0008] The present invention collects the original hyperspectral image and RGB image of the tea sample respectively through the hyperspectral imaging system and the high-resolution RGB camera, obtains the rich spectral information and clear texture information of the tea sample, and provides a data basis for the subsequent quality analysis. The spatial information registration of the original hyperspectral image is performed through the RGB image, and the spatial deviation existing in the acquisition process is eliminated, so that the hyperspectral image and the RGB image are aligned in the spatial position, and the accuracy of the subsequent analysis is guaranteed. The spectral data calibration of the registered hyperspectral image eliminates the influence of factors such as dark current and light source inhomogeneity on the spectral data, improves the reliability and accuracy of the spectral data, and lays a foundation for the subsequent spectral analysis. The spectral preprocessing of the calibrated hyperspectral image, such as smoothing filtering and normalization processing, removes spectral noise and irrelevant information, enhances the signal-to-noise ratio and comparability of the spectral data, and is conducive to the subsequent feature extraction and component analysis. The spectral-spatial data fusion of the preprocessed hyperspectral image and the RGB image effectively combines the spectral information and the spatial information, forming a more comprehensive and richer data representation, and providing a more powerful data support for the subsequent multimodal feature analysis and quality evaluation.
[0009] Preferably, step S12 comprises the following steps: Step S121: extracting feature points from the RGB image and the original hyperspectral image, and performing feature point matching to obtain feature point matching pairs; Step S122: using the feature point matching pairs as control points, estimating a geometric transformation model based on a thin plate spline interpolation model to obtain an initial geometric transformation model; Step S123: resampling and interpolating the original hyperspectral image according to the initial geometric transformation model to obtain an initial registered hyperspectral image; Step S124: performing mutual information calculation on the initial registration hyperspectral image and the RGB image to obtain mutual information; Step S125: optimizing the parameters of the initial geometric transformation model according to the mutual information to obtain an optimized geometric transformation model; Step S126: optimizing the registration accuracy of the initial registered hyperspectral image using the optimized geometric transformation model to obtain a registered hyperspectral image.
[0010] The present invention extracts and matches feature points of an RGB image and an original hyperspectral image, obtains a feature point matching pair of the corresponding relationship between the two images, and provides a reliable control point for the subsequent geometric transformation model estimation. Using the feature point matching pair as a control point, the geometric transformation model is estimated based on the thin plate spline interpolation model, and the spatial mapping relationship between the RGB image and the original hyperspectral image is established, providing a preliminary transformation model for image registration. The original hyperspectral image is resampled and interpolated according to the initial geometric transformation model to obtain a preliminary registered hyperspectral image, and the spatial deviation between the images is preliminarily corrected. By calculating the mutual information between the initial registered hyperspectral image and the RGB image, the registration degree between the two images is quantitatively evaluated, and an evaluation index is provided for the subsequent optimization of the geometric transformation model parameters. The parameters of the initial geometric transformation model are optimized according to the mutual information, and the accuracy of the model is improved, so that the optimized geometric transformation model can more accurately describe the spatial correspondence between the two images. The registration accuracy of the initial registered hyperspectral image is optimized using the optimized geometric transformation model, and finally a precisely registered hyperspectral image is obtained, which effectively eliminates the spatial deviation between the images and provides reliable data for subsequent feature analysis and quality evaluation.
[0011] Preferably, step S2 comprises the following steps: Step S21: extracting spectral features from the spectral-spatial fusion data to obtain spectral feature data; Step S22: extracting spatial features from the spectral-spatial fusion data to obtain spatial feature data; Step S23: obtaining standard spectral data of tea endoplasmic components; performing endoplasmic correlation analysis on the spectral feature data and the standard spectral data to obtain endoplasmic correlation spectral features; Step S24: obtaining manually evaluated tea appearance indicators; performing appearance correlation analysis on the spatial feature data and the tea appearance indicators to obtain appearance-related spatial features; Step S25: perform feature fusion on the endoplasm-related spectral features and the shape-related spatial features to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain endoplasm decoupling features and shape decoupling features.
[0012] The present invention effectively reduces the dimension and retains the key spectral information by extracting spectral features (for example, using PCA) from the spectral-spatial fusion data, removes redundant information and noise, and facilitates subsequent analysis. The spatial features of the image such as texture and shape are extracted by extracting spatial features (for example, using GLCM) from the spectral-spatial fusion data, providing important information for the subsequent appearance quality analysis. By obtaining the standard spectral data of the endoplasmic components of tea leaves, and performing an endoplasmic correlation analysis with the extracted spectral feature data, the features highly correlated with the endoplasmic components are screened out, thereby improving the accuracy and efficiency of the endoplasmic component analysis. By obtaining the manually evaluated tea appearance indexes, and performing an appearance correlation analysis with the extracted spatial feature data, the features highly correlated with the appearance indexes are screened out, providing a basis for the quantification of the appearance quality. The endoplasmic-related spectral features and the appearance-related spatial features are fused to obtain a multimodal feature vector, which integrates the endoplasmic and appearance information of the tea leaves, and effectively separates the endoplasmic and appearance features through feature vector decoupling, thereby avoiding mutual interference between the two features, and making the subsequent quality index quantification more accurate.
[0013] Preferably, step S3 comprises the following steps: Step S31: Determine the chemical composition of the tea sample to obtain chemical composition reference data; obtain pure substance spectrum data of the tea sample; Step S32: performing component concentration analysis based on pure substance spectrum data, chemical component reference data, and endoplasmic decoupling characteristics to obtain component concentration data; performing endoplasmic quality index quantification based on the component concentration data to obtain endoplasmic quality index data; Step S33: quantifying the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain appearance quality index data; Step S34: construct a quality indicator data set for the internal quality indicator data and the external quality indicator data to obtain a quality indicator data set.
[0014] The present invention obtains chemical component reference data through chemical component determination (such as HPLC) and obtains pure substance spectral data, which provides important reference basis and basic data for subsequent component concentration analysis and quantification of internal quality indicators. Combining pure substance spectral data, chemical component reference data and internal quality decoupling characteristics, the MCR-ALS algorithm is used to perform component concentration analysis to obtain more accurate component concentration data, and the internal quality indicators are quantified based on this data and quality standards, thereby achieving an objective evaluation of the internal quality of tea. The appearance quality indicators of the spectral-spatial fusion data are quantified according to the appearance decoupling characteristics, such as calculating the integrity, curl and gloss of the leaves, thereby achieving an objective and automated evaluation of the appearance quality of tea and avoiding the subjectivity of human factors. The internal quality indicator data and the appearance quality indicator data are integrated to construct a quality indicator data set, which provides complete data support for the subsequent construction of a comprehensive quality evaluation model and achieves a unified expression of the internal quality and appearance quality of tea.
[0015] Preferably, step S32 includes the following steps: Step S321: constructing a data matrix for the endoplasmic decoupling feature to obtain a spectral data matrix; constructing a pure substance spectral matrix for the pure substance spectral data to obtain a pure substance spectral matrix; Step S322: Estimating an initial concentration matrix according to the spectrum data matrix and the pure substance spectrum matrix to obtain an initial concentration matrix; Step S323: performing MCR-ALS iterative optimization according to the spectral data matrix, the initial concentration matrix and the pure substance spectral matrix to obtain an iteratively optimized concentration matrix; Step S324: extracting component concentration data from the iteratively optimized concentration matrix to obtain component concentration data; Step S325: constructing a multiple linear regression model according to the component concentration data and the chemical composition reference data to obtain a multiple linear regression model; Step S326: Use the multivariate linear regression model to predict the absolute concentration of the component concentration data to obtain the predicted absolute concentration data; generate the endogenous quality index data based on the predicted absolute concentration data to obtain the endogenous quality index data.
[0016] The present invention provides a necessary input data format for the application of the MCR-ALS algorithm by constructing the endoplasmic decoupling characteristics and the pure substance spectral data into a spectral data matrix and a pure substance spectral matrix respectively, so that the component concentration analysis can be carried out. The initial concentration matrix is estimated according to the spectral data matrix and the pure substance spectral matrix, and the initial value is provided for the iterative optimization of the MCR-ALS algorithm, which accelerates the convergence speed of the algorithm. Through the MCR-ALS iterative optimization, the concentration matrix and the pure substance spectral matrix are continuously updated, the accuracy of the component concentration analysis is improved, and the obtained iterative optimization concentration matrix is closer to the true value. The component concentration data is extracted from the iterative optimization concentration matrix, and the concentration information of various components at each pixel point is obtained, which provides a data basis for the subsequent quantification of the endoplasmic quality index. A multivariate linear regression model is constructed according to the component concentration data and the chemical component reference data, and the relationship between the component concentration data and the actual chemical component content is established, which provides model support for the absolute concentration prediction. The component concentration data is predicted by the multivariate linear regression model to obtain a more accurate component content prediction value, and the endoplasmic quality index data is generated according to the predicted absolute concentration data, so as to realize the objective and quantitative evaluation of the endoplasmic quality of tea.
[0017] Preferably, step S33 includes the following steps: Step S331: converting the spectral-spatial fusion data into a grayscale image according to the shape decoupling feature to obtain a grayscale image; Step S332: performing edge detection according to the grayscale image to obtain edge detection data; filling the broken parts of the leaf edge according to the edge detection data, and filling the hollow areas within the leaf contour to obtain a leaf binary mask image; Step S333: performing defect area detection on the leaf binary mask image and edge detection data to obtain the regional defect rate; performing integrity assessment according to the regional defect rate to obtain leaf integrity data; Step S334: extracting the complete contour of the blade edge data to obtain a contour point set; calculating the curvature of the contour point set to obtain blade contour curvature data; and quantifying the curl according to the blade contour curvature data to obtain blade curl data; Step S335: extracting the gray value matrix of the leaf area from the gray image to obtain the gray value matrix; performing gloss area detection according to the gray value matrix and the gray image to obtain gloss area data; performing gloss uniformity analysis on the gloss area data to obtain gloss uniformity data; Step S336: Calculate the glossiness score according to the glossiness area data and the glossiness uniformity data to obtain the glossiness score; perform glossiness result calibration on the glossiness score to obtain the leaf glossiness data; Step S337: Generate appearance quality index according to the blade integrity data, the blade curl data and the blade gloss data to obtain appearance quality index data.
[0018] The present invention simplifies the image data by converting the spectral-spatial fusion data into a grayscale image, and provides a basis for subsequent image processing and feature extraction steps (such as edge detection and gloss area detection). Through edge detection and morphological processing, a clear and continuous leaf edge is obtained, and a leaf binary mask image is generated, which provides accurate image segmentation results for subsequent defect area detection, contour extraction and other operations. By performing defect area detection and integrity evaluation on the leaf binary mask image and edge detection data, the integrity of the leaf is quantified, providing an important indicator for the evaluation of the appearance quality of tea. By performing complete contour extraction and curvature calculation on the leaf edge, the curvature information of the leaf contour is obtained, and based on this, the curl of the leaf is quantified, providing another important indicator for the evaluation of the appearance quality of tea. By extracting the gray value matrix of the leaf area, performing gloss area detection and gloss uniformity analysis, the distribution and uniformity information of the leaf gloss area is obtained, providing a data basis for gloss scoring. The gloss score is calculated based on the gloss area data and gloss uniformity data, and calibration is performed to obtain accurate leaf gloss data, providing another important indicator for the evaluation of the appearance quality of tea. The leaf integrity data, leaf curl data and leaf gloss data are integrated to generate appearance quality index data, achieving a comprehensive and objective evaluation of the appearance quality of tea.
[0019] Preferably, step S4 comprises the following steps: Step S41: constructing a comprehensive quality evaluation model according to the quality indicator data set and the preset quality indicator weights to obtain an initial comprehensive quality evaluation model; Step S42: selecting target tea data from the quality index data set to obtain a target tea data subset; fine-tuning the initial comprehensive quality evaluation model through transfer learning using the target tea data subset to obtain a fine-tuned comprehensive quality evaluation model; Step S43: performing model performance evaluation and optimization on the fine-tuned comprehensive quality evaluation model to obtain a comprehensive quality evaluation model; Step S44: performing SHAP value analysis according to the comprehensive quality evaluation model and the quality index data set to obtain SHAP value interpretation data; Step S45: Perform a comprehensive quality score on the tea sample according to the SHAP value interpretation data, the comprehensive quality evaluation model and the quality index data set to obtain a comprehensive quality score.
[0020] The present invention constructs an initial comprehensive quality evaluation model (such as SVR) according to the quality index data set and the preset quality index weights, establishes a preliminary mapping relationship between the quality index and the comprehensive quality score, and provides a basis for subsequent model optimization. By selecting a target tea data subset and performing transfer learning fine-tuning, the model is better adapted to the characteristics of the target tea, and the prediction accuracy and generalization ability of the model are improved. The performance of the fine-tuned comprehensive quality evaluation model is evaluated and optimized, and the prediction performance and robustness of the model are further improved by adjusting the model parameters or replacing the model, thereby ensuring the reliability of the final model. Through SHAP value analysis, the contribution of each quality index to the comprehensive quality score is quantified, the interpretability of the model is improved, and it is helpful to understand the decision-making process of the model. The comprehensive quality score of the tea samples is scored by combining the SHAP value interpretation data, the comprehensive quality evaluation model and the quality index data set, which not only obtains the final quality score, but also provides the degree of influence of each quality index on the score, thereby achieving a more comprehensive and detailed quality evaluation.
[0021] Preferably, step S5 comprises the following steps: Step S51: Acquire tea industry standard data; define the grade classification standard according to the tea industry standard data to obtain the grade classification standard data; Step S52: classifying tea quality grades according to the grade classification standard data and the comprehensive quality score to obtain tea quality grade data; Step S53: Generate a tea quality grade report based on the tea quality grade data, the comprehensive quality score and the quality index data set to obtain a tea quality grade report.
[0022] The present invention obtains tea industry standard data and defines grade classification standard data, establishes a corresponding relationship between comprehensive quality scores and tea grades, and provides a basis for tea quality grade classification. Tea quality grades are classified according to grade classification standard data and comprehensive quality scores, and quantitative quality scores are converted into intuitive grade classification results, which are convenient for users to understand and use. By integrating tea quality grade data, comprehensive quality scores, and quality index data sets to generate tea quality grade reports, a comprehensive and detailed quality evaluation result is provided, including quality grades, scores, various index data, and SHAP value interpretations.
[0023] Preferably, the present invention further provides a tea quality detection and analysis system for executing the tea quality detection and analysis method as described above, the tea quality detection and analysis system comprising: The spectral-spatial data acquisition module is used to collect hyperspectral images of tea samples and RGB images to obtain original hyperspectral images and RGB images; perform spatial information registration on the original hyperspectral images according to the RGB images to obtain registered hyperspectral images; perform spectral-spatial data fusion on the registered hyperspectral images and RGB images to obtain spectral-spatial fusion data; The multimodal feature decoupling module is used to analyze the intrinsic and external features of the spectral-spatial fusion data to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain intrinsic decoupling features and external decoupling features; The quality index quantification module is used to analyze the component concentration according to the endoplasmic decoupling characteristics to obtain the component concentration data; to quantify the endoplasmic quality index according to the component concentration data to obtain the endoplasmic quality index data; to quantify the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain the appearance quality index data; to construct the quality index data set for the endoplasmic quality index data and the appearance quality index data to obtain the quality index data set; The comprehensive quality modeling module is used to construct a comprehensive quality evaluation model based on the quality indicator data set, and to evaluate and optimize the model performance to obtain a comprehensive quality evaluation model; and to perform a comprehensive quality score based on the comprehensive quality evaluation model to obtain a comprehensive quality score; The tea grade classification module is used to classify tea quality grades according to the comprehensive quality score and obtain a tea quality grade report to realize tea quality detection and analysis.
[0024] The beneficial effects of the present invention are as follows: by collecting hyperspectral and RGB images, and performing image registration and fusion, the present invention obtains fused data containing rich spectral information and spatial information, laying a data foundation for the subsequent comprehensive analysis of tea quality, and improving the accuracy and reliability of the analysis. Through multimodal feature analysis and feature vector decoupling, the internal quality characteristics and appearance characteristics of tea are effectively separated, and mutual interference between the characteristics is avoided, so that the subsequent quality index quantification is more accurate, and the objectivity of quality evaluation is improved. Through component concentration analysis and quality index quantification, the spectral data is converted into specific quality index data, such as internal quality component content, leaf integrity, curling and glossiness, etc., to achieve an objective and quantitative evaluation of the internal quality and appearance quality of tea. By constructing and optimizing a comprehensive quality evaluation model, a mapping relationship between quality indicators and comprehensive quality scores is established, a comprehensive evaluation of tea quality is achieved, and the interpretability of the model is improved through SHAP value analysis, making the evaluation results more convincing. By dividing the quality grades of tea according to the comprehensive quality score and generating a report, complex quality data is converted into intuitive grade division results and detailed reports, which is convenient for users to understand and use, and improves the efficiency and practicality of tea quality evaluation. Therefore, the present invention provides a method for detecting and analyzing the quality of tea leaves, which constructs a unified evaluation system by organically combining the internal quality and appearance evaluation of tea leaves, thereby achieving a comprehensive, objective and refined evaluation of the quality of tea leaves, and effectively solving the shortcomings of the existing methods that separate the internal quality and appearance evaluation of tea leaves and lack a unified evaluation system. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of a process flow for tea quality detection and analysis; Figure 2 for Figure 1 Detailed implementation steps of step S2 in the flowchart; Figure 3 for Figure 1 Detailed implementation steps of step S3 in FIG.
[0026] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0027] The technical method of the present invention is described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by technicians in this field without creative work are within the scope of protection of the present invention.
[0028] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor methods and / or microcontroller methods.
[0029] It should be understood that, although the terms "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are used only to distinguish one unit from another unit. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.
[0030] To achieve this, please refer to Figures 1 to 3 , a tea quality detection and analysis method, comprising the following steps: Step S1: performing hyperspectral image acquisition on tea samples and performing RGB image acquisition to obtain an original hyperspectral image and an RGB image; performing spatial information registration on the original hyperspectral image according to the RGB image to obtain a registered hyperspectral image; performing spectral-spatial data fusion on the registered hyperspectral image and the RGB image to obtain spectral-spatial fusion data; Step S2: Analyze the intrinsic and external features of the spectral-spatial fusion data to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain an intrinsic decoupling feature and an external decoupling feature; Step S3: Analyze the component concentration according to the endoplasmic decoupling characteristics to obtain component concentration data; quantify the endoplasmic quality index according to the component concentration data to obtain the endoplasmic quality index data; quantify the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain the appearance quality index data; construct a quality index data set for the endoplasmic quality index data and the appearance quality index data to obtain the quality index data set; Step S4: construct a comprehensive quality evaluation model based on the quality indicator data set, and perform model performance evaluation and optimization to obtain a comprehensive quality evaluation model; perform a comprehensive quality score based on the comprehensive quality evaluation model to obtain a comprehensive quality score; Step S5: Classify the tea quality grades according to the comprehensive quality scores and obtain a tea quality grade report to implement tea quality detection and analysis.
[0031] In the embodiment of the present invention, reference Figure 1 FIG. 1 is a schematic diagram of a step flow chart of a tea quality detection and analysis method of the present invention. In this example, the tea quality detection and analysis method includes the following steps: Step S1: performing hyperspectral image acquisition on tea samples and performing RGB image acquisition to obtain an original hyperspectral image and an RGB image; performing spatial information registration on the original hyperspectral image according to the RGB image to obtain a registered hyperspectral image; performing spectral-spatial data fusion on the registered hyperspectral image and the RGB image to obtain spectral-spatial fusion data; In the embodiment of the present invention, the original hyperspectral image and RGB image of the tea sample are first collected respectively. Then, the original hyperspectral image is spatially registered using SIFT feature point matching and thin plate spline interpolation model, so that it is aligned with the RGB image in spatial position to obtain a registered hyperspectral image. Finally, a fusion method based on Gaussian pyramid decomposition is used to perform spectral-spatial data fusion on the registered hyperspectral image and the RGB image to obtain spectral-spatial fusion data, which contains both spectral information and spatial information.
[0032] Step S2: Analyze the intrinsic and external features of the spectral-spatial fusion data to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain an intrinsic decoupling feature and an external decoupling feature; In an embodiment of the present invention, spectral feature extraction (PCA) and spatial feature extraction (GLCM) are performed on the spectral-spatial fusion data to obtain spectral feature data and spatial feature data. Then, the spectral feature data and the standard spectral data are subjected to endogenous correlation analysis (Pearson correlation coefficient), and the spatial feature data and the manually evaluated tea appearance index are subjected to appearance correlation analysis (Spearman rank correlation coefficient) to obtain endogenous spectral features and appearance-related spatial features. Finally, the two features are fused into a multimodal feature vector, and the feature vector is decoupled using ICA to obtain endogenous decoupled features and appearance decoupled features.
[0033] Step S3: Analyze the component concentration according to the endoplasmic decoupling characteristics to obtain component concentration data; quantify the endoplasmic quality index according to the component concentration data to obtain the endoplasmic quality index data; quantify the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain the appearance quality index data; construct a quality index data set for the endoplasmic quality index data and the appearance quality index data to obtain the quality index data set; In the embodiment of the present invention, the chemical component content of the tea sample is determined by HPLC to obtain chemical component reference data and obtain pure substance spectral data. Then, the MCR-ALS algorithm is used to analyze the component concentration of the endoplasmic decoupling feature to obtain component concentration data, and the multivariate linear regression model is used to predict the absolute concentration, and the endoplasmic quality index data is calculated based on the prediction results and the tea quality standard. At the same time, the spectral-spatial fusion data is subjected to grayscale image conversion, edge detection, defect area detection, contour extraction, curvature calculation, gloss area detection and gloss uniformity analysis according to the appearance decoupling feature to obtain appearance quality index data such as leaf integrity, curl and gloss. Finally, the endoplasmic quality index data and the appearance quality index data are integrated to construct a quality index data set.
[0034] Step S4: construct a comprehensive quality evaluation model based on the quality indicator data set, and perform model performance evaluation and optimization to obtain a comprehensive quality evaluation model; perform a comprehensive quality score based on the comprehensive quality evaluation model to obtain a comprehensive quality score; In an embodiment of the present invention, an initial comprehensive quality evaluation model based on SVR is constructed according to a quality index data set and preset quality index weights. Then, sample data of the same type as the target tea is selected to form a target tea data subset, and the initial model is fine-tuned by transfer learning using the subset. Afterwards, the fine-tuned model is evaluated and optimized using a test data set, such as adjusting model parameters or replacing the model until the model performance meets the requirements, thereby obtaining a final comprehensive quality evaluation model. Next, the final model is interpreted using a SHAP value analysis method to obtain SHAP value interpretation data. Finally, the tea samples are given a comprehensive quality score based on the SHAP value interpretation data, the comprehensive quality evaluation model, and the quality index data set.
[0035] Step S5: classify the tea quality grades according to the comprehensive quality scores, and obtain a tea quality grade report to realize tea quality detection and analysis; In the embodiment of the present invention, the standard data of the tea industry is obtained, and the grade classification standard data is defined according to the standard data, and the comprehensive quality score range corresponding to each grade is set. Then, the tea quality grade is divided according to the grade classification standard data and the comprehensive quality score to obtain the tea quality grade data. Finally, a tea quality grade report is generated according to the tea quality grade data, the comprehensive quality score and the quality index data set, and the report content includes the sample number, tea type, comprehensive quality score, quality grade, specific values of each quality index and SHAP value.
[0036] Step S1 includes the following steps: Step S11: collecting hyperspectral images of tea samples by a hyperspectral imaging system to obtain an original hyperspectral image; collecting RGB images of tea samples by a high-resolution RGB camera to obtain an RGB image; Step S12: performing spatial information registration on the original hyperspectral image according to the RGB image to obtain a registered hyperspectral image; Step S13: calibrating the spectral data of the registered hyperspectral image to obtain a calibrated hyperspectral image; Step S14: performing spectral preprocessing on the calibrated hyperspectral image to obtain a preprocessed hyperspectral image; Step S15: performing spectral-spatial data fusion on the preprocessed hyperspectral image and the RGB image to obtain spectral-spatial fused data.
[0037] In an embodiment of the present invention, a Resonon Pika XC2 hyperspectral imaging system is used to collect hyperspectral images of tea samples. The tea sample is laid flat on a black background plate, the light source is set to a halogen light source, the light source angle is adjusted to 45 degrees, and the light source is 30 cm away from the sample. The camera exposure time is set to 10ms, the scanning speed is 10mm / s, the spectral range is 400-1000nm, and the spectral resolution is 2nm to obtain the original hyperspectral image. At the same time, a Canon EOS 5D Mark IV high-resolution RGB camera is used with a fixed focal length of 50mm, an aperture of f / 8, a shutter speed of 1 / 125s, and an ISO of 100 to collect RGB images of the same tea sample to obtain an RGB image. The SIFT algorithm is used to extract feature points of the RGB image and the original hyperspectral image. The FLANN matcher is used to match feature points to obtain feature point matching pairs. Using the feature point matching pairs as control points, a thin plate spline interpolation model is constructed to estimate the geometric transformation model parameters, including rotation, translation, scaling, and affine transformation parameters. The original hyperspectral image is resampled and interpolated using the estimated geometric transformation model parameters, and the initial registered hyperspectral image is obtained by using the bicubic interpolation algorithm. The mutual information value between the initial registered hyperspectral image and the RGB image is calculated. The geometric transformation model parameters are iteratively optimized using the Powell optimization algorithm, and the optimized geometric transformation model is obtained by maximizing the mutual information value as the optimization target. The registration accuracy of the initial registered hyperspectral image is optimized using the optimized geometric transformation model, and the bicubic interpolation algorithm is used again for resampling to finally obtain the registered hyperspectral image. The spectral data of the registered hyperspectral image is calibrated using a standard white plate and a dark plate. First, the hyperspectral images of the standard white plate and the dark plate are collected. Then, the reflectance of the registered hyperspectral image is calibrated using the following formula: R=(ID) / (WD), where R represents the calibrated reflectance, I represents the pixel value of the original hyperspectral image, D represents the pixel value of the dark plate image, and W represents the pixel value of the standard white plate image. Each band is calibrated to obtain a calibrated hyperspectral image. The calibrated hyperspectral image is spectrally preprocessed to remove noise and irrelevant information. The Savitzky-Golay smoothing filter algorithm was used, with the window size set to 11 and the polynomial order set to 3, to smooth the spectral data and remove high-frequency noise. Then, the standard normal variable transformation (SNV) method was used to normalize the spectral data to eliminate the influence of baseline drift and scattering effects. Finally, the preprocessed hyperspectral image was obtained. The preprocessed hyperspectral image and RGB image were fused for spectral-spatial data. A fusion method based on Gaussian pyramid decomposition was adopted. First, Gaussian pyramids were constructed for the preprocessed hyperspectral image and RGB image respectively. Then, each layer of the Gaussian pyramid was fused. For the low-frequency part, a weighted average strategy was used for fusion, and the weight was determined according to the clarity of the image.For the high-frequency part, the strategy of taking the maximum absolute value is adopted for fusion. Finally, the fused Gaussian pyramid is reconstructed to obtain spectral-spatial fusion data.
[0038] Step S12 includes the following steps: Step S121: extracting feature points from the RGB image and the original hyperspectral image, and performing feature point matching to obtain feature point matching pairs; Step S122: using the feature point matching pairs as control points, estimating a geometric transformation model based on a thin plate spline interpolation model to obtain an initial geometric transformation model; Step S123: resampling and interpolating the original hyperspectral image according to the initial geometric transformation model to obtain an initial registered hyperspectral image; Step S124: performing mutual information calculation on the initial registration hyperspectral image and the RGB image to obtain mutual information; Step S125: optimizing the parameters of the initial geometric transformation model according to the mutual information to obtain an optimized geometric transformation model; Step S126: optimizing the registration accuracy of the initial registered hyperspectral image using the optimized geometric transformation model to obtain a registered hyperspectral image.
[0039] In an embodiment of the present invention, the SURF algorithm is used to extract feature points from the RGB image and the original hyperspectral image respectively. The Hessian threshold is set to 500 to extract feature points with high repeatability. Then, the fast approximate nearest neighbor search algorithm (FLANN) is used to match the feature points. The search radius is set to 10 pixels, the matching distance ratio threshold is set to 0.7, and the mismatched points are filtered out to obtain feature point matching pairs. The obtained feature point matching pairs are used as control points to construct a thin plate spline interpolation model (TPS). The TPS model fits the deformation between control points by minimizing the bending energy, thereby establishing a geometric transformation model. By solving the coefficients of the TPS model, an initial geometric transformation model is obtained, which includes parameters such as rotation, translation, scaling and affine transformation. The original hyperspectral image is resampled and interpolated according to the initial geometric transformation model. The pixel values of the original hyperspectral image are mapped to a new coordinate system using the bicubic interpolation algorithm. Specifically, for each pixel in the new image, its corresponding coordinates in the original hyperspectral image are calculated according to the initial geometric transformation model, and then the new pixel value is calculated using the weighted average of the surrounding 16 pixels. The interpolation process ensures the smoothness and accuracy of the image, and the initial registered hyperspectral image is obtained. The mutual information of the initial registered hyperspectral image and the RGB image is calculated. The grayscale values of the two images are quantized into 256 levels, and a joint histogram is constructed. The joint probability distribution and edge probability distribution of the two images are calculated according to the joint histogram. The mutual information is calculated using the following formula: MI(A, B)=Σp(a, b)log(p(a, b) / (p(a)p(b))), where A and B represent the initial registered hyperspectral image and RGB image, respectively, p(a, b) represents the joint probability distribution, and p(a) and p(b) represent the edge probability distribution, respectively. The higher the mutual information value, the higher the registration accuracy between the two images. The parameters of the initial geometric transformation model are optimized using the Powell optimization algorithm, with maximizing the mutual information value as the optimization goal. The Powell algorithm is a derivative-free optimization algorithm that searches for the optimal parameter combination through iteration. The number of iterations is set to 100 and the convergence accuracy is 0.001. Through optimization, an optimized geometric transformation model is obtained, which can more accurately describe the spatial correspondence between the two images. The optimized geometric transformation model is used to optimize the registration accuracy of the initial registered hyperspectral image. The bicubic interpolation algorithm is used again for resampling, and the pixel values of the initial registered hyperspectral image are mapped to the new coordinate system to obtain the final registered hyperspectral image. The optimized geometric transformation model can effectively correct the geometric distortion of the image and improve the registration accuracy.
[0040] Step S2 includes the following steps: Step S21: extracting spectral features from the spectral-spatial fusion data to obtain spectral feature data; Step S22: extracting spatial features from the spectral-spatial fusion data to obtain spatial feature data; Step S23: obtaining standard spectral data of tea endoplasmic components; performing endoplasmic correlation analysis on the spectral feature data and the standard spectral data to obtain endoplasmic correlation spectral features; Step S24: obtaining manually evaluated tea appearance indicators; performing appearance correlation analysis on the spatial feature data and the tea appearance indicators to obtain appearance-related spatial features; Step S25: perform feature fusion on the endoplasm-related spectral features and the shape-related spatial features to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain endoplasm decoupling features and shape decoupling features.
[0041] As an example of the present invention, refer to Figure 2 As shown, in this example, step S2 includes: Step S21: extracting spectral features from the spectral-spatial fusion data to obtain spectral feature data; In an embodiment of the present invention, spectral features are extracted from spectral-spatial fusion data. Spectral features are extracted using principal component analysis (PCA). First, the spectral dimension of the spectral-spatial fusion data is flattened into a two-dimensional matrix, with each row representing the spectral information of a pixel. Then, the matrix is centered and standardized. The covariance matrix is calculated and eigenvalue decomposition is performed on it. The first 10 principal components are selected, which can explain 99% of the spectral variance information, and are used as spectral feature data.
[0042] Step S22: extracting spatial features from the spectral-spatial fusion data to obtain spatial feature data; In an embodiment of the present invention, spatial features are extracted from spectral-spatial fusion data. A gray-level co-occurrence matrix (GLCM) is used to extract spatial features. First, the spectral-spatial fusion data is converted into a grayscale image. Then, the gray-level co-occurrence matrix is calculated, and the distance is set to 1, and the angles are set to 0°, 45°, 90°, and 135°, respectively. Four spatial features are extracted from the gray-level co-occurrence matrix: contrast, correlation, energy, and uniformity. These features are combined into spatial feature data.
[0043] Step S23: obtaining standard spectral data of tea endoplasmic components; performing endoplasmic correlation analysis on the spectral feature data and the standard spectral data to obtain endoplasmic correlation spectral features; In the embodiment of the present invention, standard spectral data of tea endoplasmic components (e.g., tea polyphenols, amino acids, caffeine) are obtained from a public tea spectral database. The Pearson correlation coefficient between the spectral feature data and the standard spectral data is calculated. The 10 spectral features with the highest correlation coefficient with each endoplasmic component are selected and combined into endoplasmic-related spectral features.
[0044] Step S24: obtaining manually evaluated tea appearance indicators; performing appearance correlation analysis on the spatial feature data and the tea appearance indicators to obtain appearance-related spatial features; In the embodiment of the present invention, five tea experts were invited to manually evaluate the appearance indicators of tea samples, including indicators such as integrity, curl, and glossiness. The expert scores were averaged to obtain the quantitative values of the tea appearance indicators. The Spearman rank correlation coefficient between the spatial feature data and the tea appearance indicators was calculated. The five spatial features with the highest correlation coefficient with each appearance indicator were selected and combined into appearance-related spatial features.
[0045] Step S25: performing feature fusion on the endoplasm-related spectral features and the shape-related spatial features to obtain a multimodal feature vector; performing feature vector decoupling on the multimodal feature vector to obtain an endoplasm decoupling feature and a shape decoupling feature; In an embodiment of the present invention, the endoplasm-related spectral features and the appearance-related spatial features are feature fused. The two feature vectors are connected into a multimodal feature vector. Then, independent component analysis (ICA) is used to perform feature vector decoupling on the multimodal feature vector. The ICA algorithm can decompose the multimodal feature vector into independent components, thereby separating the endoplasm decoupling features and the appearance decoupling features. The number of components of the ICA algorithm is set to the dimension of the original feature vector, and the FastICA algorithm is used for iterative optimization to obtain the final endoplasm decoupling features and appearance decoupling features.
[0046] Step S3 includes the following steps: Step S31: Determine the chemical composition of the tea sample to obtain chemical composition reference data; obtain pure substance spectrum data of the tea sample; Step S32: performing component concentration analysis based on pure substance spectrum data, chemical component reference data, and endoplasmic decoupling characteristics to obtain component concentration data; performing endoplasmic quality index quantification based on the component concentration data to obtain endoplasmic quality index data; Step S33: quantifying the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain appearance quality index data; Step S34: construct a quality indicator data set for the internal quality indicator data and the external quality indicator data to obtain a quality indicator data set.
[0047] As an example of the present invention, refer to Figure 3 As shown, in this example, step S3 includes: Step S31: Determine the chemical composition of the tea sample to obtain chemical composition reference data; obtain pure substance spectrum data of the tea sample; In the embodiment of the present invention, tea samples are sent to a professional laboratory, and high performance liquid chromatography (HPLC) is used to determine the content of key chemical components in the tea samples, such as tea polyphenols, amino acids, caffeine, etc. The concentration value of each component is recorded as chemical component reference data. At the same time, standard spectral data of pure substances (such as tea polyphenols, amino acids, caffeine) in tea samples are obtained from a public tea spectral database or through experimental measurement. Ensure that the wavelength range of the pure substance spectral data is consistent with the wavelength range of the hyperspectral image.
[0048] Step S32: performing component concentration analysis based on pure substance spectrum data, chemical component reference data, and endoplasmic decoupling characteristics to obtain component concentration data; performing endoplasmic quality index quantification based on the component concentration data to obtain endoplasmic quality index data; In an embodiment of the present invention, multivariate curve resolution-alternating least squares (MCR-ALS) is used to perform component concentration analysis on the endoplasmic decoupling feature. The endoplasmic decoupling feature is constructed into a spectral data matrix, and the pure substance spectral data is constructed into a pure substance spectral matrix. The concentration matrix is initialized using non-negative constraints. Then, MCR-ALS iterative optimization is performed, and the concentration matrix and the pure substance spectral matrix are updated alternately until convergence. The iteratively optimized concentration matrix is extracted to obtain component concentration data. A multivariate linear regression model is constructed using chemical component reference data and component concentration data. The model is used to predict the absolute concentration of each component in the tea sample to obtain predicted absolute concentration data. According to the predicted absolute concentration data and the tea quality standard, the endoplasmic quality indicators, such as tea polyphenol content, amino acid content, caffeine content, etc., are calculated to obtain endoplasmic quality indicator data.
[0049] Step S33: quantifying the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain appearance quality index data; In an embodiment of the present invention, the spectral-spatial fusion data is quantified for the appearance quality index according to the appearance decoupling feature. First, the spectral-spatial fusion data is converted into a grayscale image. The Canny edge detection algorithm is used to extract the edge of the blade. The high and low thresholds are set to 100 and 50 respectively to detect the edge information in the image. The broken parts of the detected edges are filled, and the hollow areas in the blade contour are filled using morphological closing operations to generate a binary mask image of the blade. Based on the binary mask image of the blade and the edge detection data, the regional defect rate is calculated, and the integrity of the blade is evaluated according to the preset standard to obtain the leaf integrity data. The complete contour of the blade edge is extracted, and the curvature of the contour point set is calculated. The curl of the blade is quantified according to the curvature data to obtain the curl data of the blade. The gray value matrix of the blade area is extracted from the grayscale image. According to the gray value matrix and the grayscale image, the gloss area is detected using the threshold segmentation method. The gray value distribution of the gloss area is analyzed to calculate the gloss uniformity data. The gloss area data and the gloss uniformity data are combined to calculate the gloss score. Finally, the gloss score is calibrated according to the preset calibration curve to obtain the gloss data of the blade. The leaf integrity data, leaf curl data and leaf gloss data are used as appearance quality index data.
[0050] Step S34: constructing a quality index data set for the internal quality index data and the external quality index data to obtain a quality index data set; In the embodiment of the present invention, the internal quality index data and the external quality index data are integrated into one data set to construct a quality index data set. The data set includes the internal quality index and external quality index of each tea sample, which is used for the subsequent construction of a comprehensive quality evaluation model.
[0051] Step S32 includes the following steps: Step S321: constructing a data matrix for the endoplasmic decoupling feature to obtain a spectral data matrix; constructing a pure substance spectral matrix for the pure substance spectral data to obtain a pure substance spectral matrix; Step S322: Estimating an initial concentration matrix according to the spectrum data matrix and the pure substance spectrum matrix to obtain an initial concentration matrix; Step S323: performing MCR-ALS iterative optimization according to the spectral data matrix, the initial concentration matrix and the pure substance spectral matrix to obtain an iteratively optimized concentration matrix; Step S324: extracting component concentration data from the iteratively optimized concentration matrix to obtain component concentration data; Step S325: constructing a multiple linear regression model according to the component concentration data and the chemical composition reference data to obtain a multiple linear regression model; Step S326: Use the multivariate linear regression model to predict the absolute concentration of the component concentration data to obtain the predicted absolute concentration data; generate the endogenous quality index data based on the predicted absolute concentration data to obtain the endogenous quality index data.
[0052] In an embodiment of the present invention, the endoplasmic decoupling features are organized into a matrix, each row represents a pixel, and each column represents a feature, forming a spectral data matrix. At the same time, the pure substance spectral data is also organized into a matrix, each row represents a pure substance, and each column represents a wavelength point, forming a pure substance spectral matrix. Ensure that the wavelength ranges of the two matrices correspond. The non-negative least squares method (NNLS) is used to estimate the initial concentration matrix based on the spectral data matrix and the pure substance spectral matrix. The NNLS algorithm restricts the elements of the concentration matrix to non-negative values to meet the actual situation. The initial concentration matrix is obtained by solving the least squares problem min||X-CS||F^2, where X is the spectral data matrix, C is the pure substance spectral matrix, S is the concentration matrix, and ||.||F is the Frobenius norm. The spectral data matrix, the initial concentration matrix, and the pure substance spectral matrix are iteratively optimized using the MCR-ALS algorithm. The number of iterations is set to 100 times, and the convergence condition is that the relative change of the concentration matrix between two iterations is less than 0.001. In each iteration, the concentration matrix is first fixed, the pure substance spectrum matrix is updated, and then the pure substance spectrum matrix is fixed and the concentration matrix is updated. Alternate until the convergence condition is met to obtain the iterative optimization concentration matrix. The concentration value of each component is extracted from the iterative optimization concentration matrix. Each column of the concentration matrix represents a component, and each row represents a pixel. The component concentration values of each pixel are averaged to obtain the average concentration of the component as the component concentration data. A multivariate linear regression model is constructed using the chemical component reference data and the component concentration data. The chemical component reference data is used as the dependent variable, and the component concentration data is used as the independent variable. The least squares method is used to fit the parameters of the regression model to obtain the multivariate linear regression model. The constructed multivariate linear regression model is used to predict the absolute concentration of the component concentration data. The component concentration data is input into the multivariate linear regression model to calculate the predicted absolute concentration data. According to the predicted absolute concentration data and the tea quality evaluation standards (such as national standards or industry standards), the internal quality indicators, such as tea polyphenol content, amino acid content, caffeine content, etc., are calculated to generate the internal quality indicator data.
[0053] Step S33 includes the following steps: Step S331: converting the spectral-spatial fusion data into a grayscale image according to the shape decoupling feature to obtain a grayscale image; Step S332: performing edge detection according to the grayscale image to obtain edge detection data; filling the broken parts of the leaf edge according to the edge detection data, and filling the hollow areas within the leaf contour to obtain a leaf binary mask image; Step S333: performing defect area detection on the leaf binary mask image and edge detection data to obtain the regional defect rate; performing integrity assessment according to the regional defect rate to obtain leaf integrity data; Step S334: extracting the complete contour of the blade edge data to obtain a contour point set; calculating the curvature of the contour point set to obtain blade contour curvature data; and quantifying the curl according to the blade contour curvature data to obtain blade curl data; Step S335: extracting the gray value matrix of the leaf area from the gray image to obtain the gray value matrix; performing gloss area detection according to the gray value matrix and the gray image to obtain gloss area data; performing gloss uniformity analysis on the gloss area data to obtain gloss uniformity data; Step S336: Calculate the glossiness score according to the glossiness area data and the glossiness uniformity data to obtain the glossiness score; perform glossiness result calibration on the glossiness score to obtain the leaf glossiness data; Step S337: Generate appearance quality index according to the blade integrity data, the blade curl data and the blade gloss data to obtain appearance quality index data.
[0054] In an embodiment of the present invention, the spectral-spatial fusion data is converted into a grayscale image. The weighted average method is used to convert multiple band data in the spectral-spatial fusion data into grayscale values. The weight coefficient is determined according to the contribution of each band to the image brightness, for example, the weight coefficient (0.299, 0.587, 0.114) of the RGB color space is used. The weighted average of each pixel is calculated to obtain a grayscale image. The Canny edge detection algorithm is used to perform edge detection on the grayscale image. The high threshold is set to 100 and the low threshold is set to 50, and the edge information in the image is detected to obtain edge detection data. The edge detection data is processed using a morphological closing operation to fill the broken part of the edge of the leaf. The closing operation uses a rectangle with a structural element of 5x5, and connects the broken edges by first expanding and then corroding. Then, the hole filling algorithm is used to fill the empty area in the leaf outline, and finally a leaf binary mask image is obtained. The regional defect rate is calculated based on the leaf binary mask image and the edge detection data. First, the number of white pixels in the leaf binary mask image is calculated to represent the actual area of the leaf. Then, the area enclosed by the complete outline of the leaf is calculated based on the edge detection data to represent the theoretical area of the leaf. The regional defect rate calculation formula is: (theoretical area-actual area) / theoretical area. The integrity of the leaf is judged according to a preset threshold (for example, 0.1). If the regional defect rate is less than the threshold, the leaf integrity is considered to be good; otherwise, the leaf integrity is considered to be poor. The evaluation results are quantified, for example, good integrity is recorded as 1 and poor integrity is recorded as 0, and the leaf integrity data is obtained. The complete outline of the leaf edge is extracted from the edge detection data to obtain a contour point set. The edge pixels are traced using the Moore-Neighbor Tracing algorithm to form a closed contour line. The curvature of each point in the contour point set is calculated. The curvature calculation adopts a circle fitting method, and a circle is fitted using the point and the 5 points before and after it. The reciprocal of the radius of the circle is the curvature of the point. The leaf curl is calculated based on the leaf contour curvature data. The curl is defined as the average value of the contour curvature, and the leaf curl data is obtained. The gray value matrix of the leaf area is extracted from the grayscale image. According to the binary mask image of the leaf, the grayscale values of the pixels in the mask area are extracted to form a grayscale value matrix. Gloss area detection is performed based on the grayscale value matrix and the grayscale image. The grayscale value threshold is set to 180, and the area with a grayscale value greater than the threshold is considered to be the gloss area, and the gloss area data is obtained. The standard deviation of the grayscale value in the glossy area is calculated as the gloss uniformity data. The smaller the standard deviation, the better the gloss uniformity. The gloss score is calculated based on the gloss area data and the gloss uniformity data. The gloss score calculation formula is: gloss area area / total leaf area*(1-gloss uniformity data / 255). The gloss score is calibrated for the gloss result. Using the pre-established calibration curve, the gloss score is mapped to the range of 0-1 to obtain the leaf gloss data.The leaf integrity data, leaf curl data and leaf gloss data are used as appearance quality index data.
[0055] Step S4 includes the following steps: Step S41: constructing a comprehensive quality evaluation model according to the quality indicator data set and the preset quality indicator weights to obtain an initial comprehensive quality evaluation model; Step S42: selecting target tea data from the quality index data set to obtain a target tea data subset; fine-tuning the initial comprehensive quality evaluation model through transfer learning using the target tea data subset to obtain a fine-tuned comprehensive quality evaluation model; Step S43: performing model performance evaluation and optimization on the fine-tuned comprehensive quality evaluation model to obtain a comprehensive quality evaluation model; Step S44: performing SHAP value analysis according to the comprehensive quality evaluation model and the quality index data set to obtain SHAP value interpretation data; Step S45: Perform a comprehensive quality score on the tea sample according to the SHAP value interpretation data, the comprehensive quality evaluation model and the quality index data set to obtain a comprehensive quality score.
[0056] In an embodiment of the present invention, an initial comprehensive quality evaluation model is constructed using a quality indicator data set and a preset quality indicator weight. A support vector regression (SVR) model is used as a basic model. The preset quality indicator weight is determined according to expert experience or industry standards, for example, the weight of the internal quality indicator is set to 0.7, and the weight of the appearance indicator is set to 0.3. After each indicator data in the quality indicator data set is multiplied by the corresponding weight, it is used as the input feature of the SVR model. The kernel function of the SVR model is set to a radial basis kernel function (RBF), the penalty coefficient C is 1, and the gamma parameter γ is 0.1. The SVR model is trained using the training data set to obtain an initial comprehensive quality evaluation model. Sample data of the same type as the target tea is selected from the quality indicator data set to form a target tea data subset. For example, if the target tea is Longjing tea, all Longjing tea sample data are selected. The initial comprehensive quality evaluation model is fine-tuned by using the target tea data subset for transfer learning model. The parameters of the initial comprehensive quality evaluation model are used as pre-training parameters, and the model parameters are fine-tuned using the target tea data subset. The learning rate is set to 0.001 and the number of iterations is 100. The model parameters are updated by the back propagation algorithm to minimize the mean square error between the model prediction value and the true value, and the fine-tuned comprehensive quality evaluation model is obtained. The model performance of the fine-tuned comprehensive quality evaluation model is evaluated and optimized. The model performance is evaluated using the test data set, and the mean square error (MSE), determination coefficient (R²) and other indicators are used for evaluation. If the model performance does not meet the requirements, the model parameters are adjusted or the model is replaced, such as adjusting the penalty coefficient C and gamma parameter γ of the SVR model, or using other regression models, such as random forest regression model or gradient boosting regression model, to retrain the model until the model performance meets the requirements and obtain the final comprehensive quality evaluation model. The SHAP (SHapley Additive exPlanations) value analysis method is used to interpret the comprehensive quality evaluation model. The SHAP value can quantify the contribution of each feature to the model prediction results. The quality index data set is input into the comprehensive quality evaluation model, and the SHAP value of each feature of each sample is calculated to obtain the SHAP value interpretation data. The tea samples are scored for comprehensive quality based on the SHAP value interpretation data, the comprehensive quality evaluation model and the quality index data set. The quality index data of tea samples are input into the comprehensive quality evaluation model to obtain the comprehensive quality score predicted by the model. The data is interpreted in combination with the SHAP value to analyze the influence of each quality index on the comprehensive quality score, thus providing a more detailed quality evaluation result.
[0057] Step S5 includes the following steps: Step S51: Acquire tea industry standard data; define the grade classification standard according to the tea industry standard data to obtain the grade classification standard data; Step S52: classifying tea quality grades according to the grade classification standard data and the comprehensive quality score to obtain tea quality grade data; Step S53: Generate a tea quality grade report based on the tea quality grade data, the comprehensive quality score and the quality index data set to obtain a tea quality grade report.
[0058] In an embodiment of the present invention, tea industry standard data, such as GB / T14456-2018 (green tea) or GB / T30357.2-2013 (oolong tea), is obtained from the National Standardization Administration or relevant industry associations. According to the classification standards for quality grades in the tea industry standard data, the grade classification standard data is defined. For example, the quality grades of green tea are divided into special grade, first grade, second grade, and third grade, and the comprehensive quality score range corresponding to each grade is set. For example, special grade: 90-100 points; first grade: 80-89 points; second grade: 70-79 points; third grade: 60-69 points. Tea quality grades are divided according to the grade classification standard data and the comprehensive quality score. The comprehensive quality score predicted by the comprehensive quality evaluation model is compared with the score range in the grade classification standard data. For example, if the comprehensive quality score is 92 points, according to the above-mentioned green tea grade classification standard, the tea is classified as special grade, and the tea quality grade data is obtained. A tea quality grade report is generated according to the tea quality grade data, the comprehensive quality score, and the quality indicator data set. The tea quality grade report contains the following contents: sample number, tea type, comprehensive quality score, quality grade, specific values of each quality index and SHAP value. For example, a quality grade report of a Longjing tea sample may contain: sample number: LJ001; tea type: Longjing tea; comprehensive quality score: 92; quality grade: special grade; tea polyphenol content: 25% (SHAP value: 0.2); amino acid content: 4% (SHAP value: 0.15); the report is presented in a clear table format so that users can intuitively understand the tea quality information.
[0059] The present invention also provides a tea quality detection and analysis system for executing the tea quality detection and analysis method as described above, the tea quality detection and analysis system comprising: The spectral-spatial data acquisition module is used to collect hyperspectral images of tea samples and RGB images to obtain original hyperspectral images and RGB images; perform spatial information registration on the original hyperspectral images according to the RGB images to obtain registered hyperspectral images; perform spectral-spatial data fusion on the registered hyperspectral images and RGB images to obtain spectral-spatial fusion data; The multimodal feature decoupling module is used to analyze the intrinsic and external features of the spectral-spatial fusion data to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain intrinsic decoupling features and external decoupling features; The quality index quantification module is used to analyze the component concentration according to the endoplasmic decoupling characteristics to obtain the component concentration data; to quantify the endoplasmic quality index according to the component concentration data to obtain the endoplasmic quality index data; to quantify the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain the appearance quality index data; to construct the quality index data set for the endoplasmic quality index data and the appearance quality index data to obtain the quality index data set; The comprehensive quality modeling module is used to construct a comprehensive quality evaluation model based on the quality indicator data set, and to evaluate and optimize the model performance to obtain a comprehensive quality evaluation model; and to perform a comprehensive quality score based on the comprehensive quality evaluation model to obtain a comprehensive quality score; The tea grade classification module is used to classify tea quality grades according to the comprehensive quality score and obtain a tea quality grade report to realize tea quality detection and analysis.
[0060] Therefore, the embodiments should be regarded as illustrative and non-restrictive from all points, and the scope of the present invention is limited by the appended claims rather than the above description, and it is therefore intended that all changes falling within the meaning and range of equivalent elements of the application documents are included in the present invention.
[0061] The above description is only a specific embodiment of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but should conform to the widest scope consistent with the principles and novel features invented herein.
Claims
1. A tea quality detection and analysis method, characterized in that: The following steps are involved: Step S1: collecting a hyperspectral image of the tea sample and collecting an RGB image to obtain an original hyperspectral image and an RGB image; The original hyperspectral image is spatially registered according to the RGB image to obtain a registered hyperspectral image; the spectral-spatial data is fused according to the registered hyperspectral image and the RGB image to obtain spectral-spatial fused data; Step S2: Analyze the intrinsic and external features of the spectral-spatial fusion data to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain an intrinsic decoupling feature and an external decoupling feature; Step S3: Analyze the component concentration according to the endoplasmic decoupling characteristics to obtain component concentration data; quantify the endoplasmic quality index according to the component concentration data to obtain the endoplasmic quality index data; quantify the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain the appearance quality index data; construct a quality index data set for the endoplasmic quality index data and the appearance quality index data to obtain the quality index data set; Step S4: construct a comprehensive quality evaluation model based on the quality indicator data set, and perform model performance evaluation and optimization to obtain a comprehensive quality evaluation model; perform a comprehensive quality score based on the comprehensive quality evaluation model to obtain a comprehensive quality score; Step S5: Classify the tea quality grades according to the comprehensive quality scores and obtain a tea quality grade report to implement tea quality detection and analysis.
2. The tea quality detection and analysis method according to claim 1, characterized in that: Step S1 includes the following steps: Step S11: collecting hyperspectral images of tea samples by a hyperspectral imaging system to obtain an original hyperspectral image; collecting RGB images of tea samples by a high-resolution RGB camera to obtain an RGB image; Step S12: performing spatial information registration on the original hyperspectral image according to the RGB image to obtain a registered hyperspectral image; Step S13: calibrating the spectral data of the registered hyperspectral image to obtain a calibrated hyperspectral image; Step S14: performing spectral preprocessing on the calibrated hyperspectral image to obtain a preprocessed hyperspectral image; Step S15: performing spectral-spatial data fusion on the preprocessed hyperspectral image and the RGB image to obtain spectral-spatial fused data.
3. The tea quality detection and analysis method according to claim 2, characterized in that: Step S12 includes the following steps: Step S121: extracting feature points from the RGB image and the original hyperspectral image, and performing feature point matching to obtain feature point matching pairs; Step S122: using the feature point matching pairs as control points, estimating a geometric transformation model based on a thin plate spline interpolation model to obtain an initial geometric transformation model; Step S123: resampling and interpolating the original hyperspectral image according to the initial geometric transformation model to obtain an initial registered hyperspectral image; Step S124: performing mutual information calculation on the initial registration hyperspectral image and the RGB image to obtain mutual information; Step S125: optimizing the parameters of the initial geometric transformation model according to the mutual information to obtain an optimized geometric transformation model; Step S126: optimizing the registration accuracy of the initial registered hyperspectral image using the optimized geometric transformation model to obtain a registered hyperspectral image.
4. The tea quality detection and analysis method according to claim 1, characterized in that: Step S2 includes the following steps: Step S21: extracting spectral features from the spectral-spatial fusion data to obtain spectral feature data; Step S22: extracting spatial features from the spectral-spatial fusion data to obtain spatial feature data; Step S23: obtaining standard spectral data of tea endoplasmic components; performing endoplasmic correlation analysis on the spectral feature data and the standard spectral data to obtain endoplasmic correlation spectral features; Step S24: obtaining manually evaluated tea appearance indicators; performing appearance correlation analysis on the spatial feature data and the tea appearance indicators to obtain appearance-related spatial features; Step S25: perform feature fusion on the endoplasm-related spectral features and the shape-related spatial features to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain endoplasm decoupling features and shape decoupling features.
5. The tea quality detection and analysis method according to claim 1, characterized in that: Step S3 includes the following steps: Step S31: Determine the chemical composition of the tea sample to obtain chemical composition reference data; obtain pure substance spectrum data of the tea sample; Step S32: performing component concentration analysis based on pure substance spectrum data, chemical component reference data, and endoplasmic decoupling characteristics to obtain component concentration data; performing endoplasmic quality index quantification based on the component concentration data to obtain endoplasmic quality index data; Step S33: quantifying the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain appearance quality index data; Step S34: construct a quality indicator data set for the internal quality indicator data and the external quality indicator data to obtain a quality indicator data set.
6. The tea quality detection and analysis method according to claim 5, characterized in that: Step S32 includes the following steps: Step S321: constructing a data matrix for the endoplasmic decoupling features to obtain a spectral data matrix; constructing a pure substance spectral matrix for the pure substance spectral data to obtain a pure substance spectral matrix; Step S322: Estimating an initial concentration matrix according to the spectrum data matrix and the pure substance spectrum matrix to obtain an initial concentration matrix; Step S323: performing MCR-ALS iterative optimization according to the spectral data matrix, the initial concentration matrix and the pure substance spectral matrix to obtain an iteratively optimized concentration matrix; Step S324: extracting component concentration data from the iteratively optimized concentration matrix to obtain component concentration data; Step S325: constructing a multiple linear regression model according to the component concentration data and the chemical composition reference data to obtain a multiple linear regression model; Step S326: Use the multivariate linear regression model to predict the absolute concentration of the component concentration data to obtain the predicted absolute concentration data; generate the endogenous quality index data based on the predicted absolute concentration data to obtain the endogenous quality index data.
7. The tea quality detection and analysis method according to claim 5, characterized in that: Step S33 includes the following steps: Step S331: converting the spectral-spatial fusion data into a grayscale image according to the shape decoupling feature to obtain a grayscale image; Step S332: performing edge detection according to the grayscale image to obtain edge detection data; filling the broken parts of the leaf edge according to the edge detection data, and filling the empty areas within the leaf contour to obtain a leaf binary mask image; Step S333: performing defect area detection on the leaf binary mask image and edge detection data to obtain the regional defect rate; performing integrity assessment according to the regional defect rate to obtain leaf integrity data; Step S334: extracting the complete contour of the blade edge data to obtain a contour point set; calculating the curvature of the contour point set to obtain blade contour curvature data; quantifying the curl according to the blade contour curvature data to obtain blade curl data; Step S335: extracting the gray value matrix of the leaf area from the gray image to obtain the gray value matrix; performing gloss area detection according to the gray value matrix and the gray image to obtain gloss area data; performing gloss uniformity analysis on the gloss area data to obtain gloss uniformity data; Step S336: Calculate the glossiness score according to the glossiness area data and the glossiness uniformity data to obtain the glossiness score; calibrate the glossiness result of the glossiness score to obtain the leaf glossiness data; Step S337: Generate appearance quality index according to the blade integrity data, the blade curl data and the blade gloss data to obtain appearance quality index data.
8. The tea quality detection and analysis method according to claim 1, characterized in that: Step S4 includes the following steps: Step S41: constructing a comprehensive quality evaluation model according to the quality indicator data set and the preset quality indicator weights to obtain an initial comprehensive quality evaluation model; Step S42: selecting target tea data from the quality index data set to obtain a target tea data subset; fine-tuning the initial comprehensive quality evaluation model through transfer learning using the target tea data subset to obtain a fine-tuned comprehensive quality evaluation model; Step S43: performing model performance evaluation and optimization on the fine-tuned comprehensive quality evaluation model to obtain a comprehensive quality evaluation model; Step S44: performing SHAP value analysis according to the comprehensive quality evaluation model and the quality index data set to obtain SHAP value interpretation data; Step S45: Perform a comprehensive quality score on the tea sample according to the SHAP value interpretation data, the comprehensive quality evaluation model and the quality index data set to obtain a comprehensive quality score.
9. The tea quality detection and analysis method according to claim 1, characterized in that: Step S5 includes the following steps: Step S51: Acquire tea industry standard data; define the grade classification standard according to the tea industry standard data to obtain the grade classification standard data; Step S52: classifying tea quality grades according to the grade classification standard data and the comprehensive quality score to obtain tea quality grade data; Step S53: Generate a tea quality grade report based on the tea quality grade data, the comprehensive quality score and the quality index data set to obtain a tea quality grade report.
10. A tea quality detection and analysis system, characterized in that: Used to perform the tea quality detection and analysis method as claimed in claim 1, the tea quality detection and analysis system comprises: The spectral-spatial data acquisition module is used to collect hyperspectral images of tea samples and RGB images to obtain original hyperspectral images and RGB images; perform spatial information registration on the original hyperspectral images according to the RGB images to obtain registered hyperspectral images; perform spectral-spatial data fusion on the registered hyperspectral images and RGB images to obtain spectral-spatial fusion data; The multimodal feature decoupling module is used to analyze the intrinsic and external features of the spectral-spatial fusion data to obtain a multimodal feature vector; perform feature vector decoupling on the multimodal feature vector to obtain intrinsic decoupling features and external decoupling features; The quality index quantification module is used to analyze the component concentration according to the endoplasmic decoupling characteristics to obtain the component concentration data; to quantify the endoplasmic quality index according to the component concentration data to obtain the endoplasmic quality index data; to quantify the appearance quality index of the spectrum-space fusion data according to the appearance decoupling characteristics to obtain the appearance quality index data; to construct the quality index data set for the endoplasmic quality index data and the appearance quality index data to obtain the quality index data set; The comprehensive quality modeling module is used to construct a comprehensive quality evaluation model based on the quality indicator data set, and to evaluate and optimize the model performance to obtain a comprehensive quality evaluation model; and to perform a comprehensive quality score based on the comprehensive quality evaluation model to obtain a comprehensive quality score; The tea grade classification module is used to classify tea quality grades according to the comprehensive quality score and obtain a tea quality grade report to realize tea quality detection and analysis.
Citation Information
Patent Citations
High-pressure container detection method based on infrared image splicing fusion algorithm
CN110706191A
Tea classification method based on hyperspectral image and deep learning
CN113158980A
Multi-modal information processing method and device, electronic equipment and storage medium
CN113762319A
Ampoule bottle printed word defect detection method based on image registration
CN114187247A
Multi-modal image acquisition device and registration method
CN114663481A
Cited By
Mulberry leaf mass spectral image recognition device and AI grading decision-making method and system
CN119992225A
Quality rating method and system for boxthorn leaves
CN120254186A
Traditional Chinese medicine quality detection method and system
CN120404616A
Tea quality grading system and method based on image detection
CN120510460A
Cross-modal fusion fresh tea leaf grading method, device, equipment and medium
CN120997682A