A method and system for detecting tea quality grade
Through the data fusion method of Z-Score standardization and information entropy weight optimization, as well as the segmented ensemble learning model and dynamic correction mechanism, the problems of incomplete data fusion, low classification accuracy and insufficient abnormal data correction in tea quality detection are solved, and higher detection accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202411990035.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The existing tea quality detection technology has problems such as incomplete data fusion, low classification accuracy and insufficient correction of abnormal data, resulting in insufficient accuracy and reliability of tea quality level evaluation.
Through Z-Score standardization and information entropy weight optimization, a multi-dimensional weighted fusion of chemical components and physical property data is realized; a segmented integrated learning model is adopted, and a support vector machine, gradient enhancement decision tree and logistic regression algorithm are combined, and a dynamic threshold function and a segmented incentive mechanism are introduced; for abnormal data, a dynamic correction and dual boundary optimization mechanism is adopted.
It improves the classification accuracy and boundary processing capability of tea quality level detection, enhances the reliability and accuracy of the detection results, and can more effectively reflect the comprehensive quality of tea.
Smart Images

Figure CN119395239B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of tea detection, and in particular to a method and system for detecting the quality grade of tea. Background Art
[0002] With the advancement of modern agricultural technology and food processing technology, tea, as an important beverage worldwide, has gradually become the focus of attention in the industry for quality inspection and grading. The evaluation of tea quality mainly includes the comprehensive analysis of chemical composition indicators (such as tea polyphenols, caffeine, etc.) and physical property indicators (such as color, moisture content, etc.). Existing tea quality inspection technologies mainly rely on sensory evaluation and traditional laboratory testing methods, but these methods have significant limitations. For example, sensory evaluation relies on manual experience and is easily affected by subjective factors, resulting in a lack of uniformity and repeatability in the results; and traditional chemical analysis methods, such as solvent extraction and titration, although they have a certain degree of accuracy, are complex and time-consuming to operate, and are difficult to meet the needs of large-scale rapid testing.
[0003] Some existing technologies attempt to introduce machine learning algorithms or spectral analysis technology to quantitatively evaluate tea quality, but there are still many shortcomings. First, the existing methods are not comprehensive enough in the fusion analysis of tea chemical composition and physical property data, and cannot effectively reflect the multi-dimensional characteristics of tea quality. Secondly, mainstream detection methods often use a single algorithm in the model classification process, and fail to fully combine the advantages of multiple models, resulting in low classification accuracy, especially in the classification boundary problem between high-grade tea and medium and low-grade tea. In addition, there is a lack of effective mechanism for locating and correcting abnormal data, which can easily lead to deviations in the test results and affect the final tea grade judgment. Summary of the invention
[0004] In view of the above problems, the present invention proposes a method and system for detecting the quality grade of tea leaves.
[0005] Therefore, the technical problem solved by the present invention is: data fusion is not comprehensive: the existing technology lacks systematic fusion analysis of tea chemical composition and physical property data, and cannot accurately reflect the comprehensive quality of tea. The present invention realizes weighted fusion of multi-dimensional indicators through Z-Score standardization and information entropy weight optimization, and solves the problem of data scale difference.
[0006] Low classification accuracy: Traditional tea quality classification methods mostly rely on a single algorithm, resulting in blurred classification boundaries, especially high-grade and low-grade teas are easily confused. The present invention combines support vector machines, gradient boosting decision trees and logistic regression algorithms through a segmented ensemble learning model, and introduces a dynamic threshold function and segmented incentive mechanism, effectively improving classification accuracy and boundary processing capabilities.
[0007] Insufficient correction of abnormal data: The existing technology lacks an effective positioning and repair mechanism when the data is abnormal, resulting in deviations in the detection results. The present invention locates and repairs abnormal indicators through dynamic correction of abnormal data and dual boundary optimization, ensuring the reliability of the final evaluation results.
[0008] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for detecting the quality grade of tea leaves, comprising:
[0009] Collect tea samples and conduct pretreatment;
[0010] Extract the chemical composition indexes and physical properties of the pre-treated tea leaves, and then integrate and analyze them;
[0011] Establish a tea quality grade classification model, input the characteristics of the tea samples to be tested, output the test results, and generate a tea quality grade report.
[0012] The method of establishing the tea quality classification model includes: integrating and analyzing the comprehensive feature vector T p ={t1,t2,...,t p} is used as the model input, and the feature vector dimension is p. According to the tea quality grade standard, the samples are divided into three categories: special grade L1, first grade L2 and second grade L3, and the data set is divided into training set and test set in a ratio of 8:2.
[0013] Three sub-classifiers are used for segmented training, including support vector machine, gradient boosting decision tree and logistic regression, and a classifier incentive mechanism is introduced to optimize the classification effect.
[0014] Support vector machine using radial basis kernel function , nonlinear mapping of tea quality data; represents the i-th sample vector in the feature space, Represents the jth sample vector in the feature space.
[0015] The gradient boosting decision tree uses the segmented decision tree method to train multiple trees to learn the nonlinear relationship between sample features and category labels.
[0016] Logistic regression uses an improved Sigmoid activation function, expressed as:
[0017] ;
[0018] in, represents the improved Sigmoid activation function, Represents the adjustment parameter to optimize the sensitivity of the activation function to high-quality samples.
[0019] In order to improve the classification accuracy, a dynamic threshold function is introduced to adjust the decision boundary between different levels. The dynamic threshold function is designed as:
[0020] ;
[0021] in, represents the modulus of the input feature vector, ; represents the equilibrium parameter, represents the equilibrium parameter, Parameter representing the sensitivity of adjusting the threshold as the feature amplitude changes.
[0022] The classification results of the three sub-models, support vector machine, gradient boosting decision tree and logistic regression, are weighted voted and fused to finally form the classification results of tea quality grade. The voting mechanism is designed as follows:
[0023] ;
[0024] in, represents the final classification result of the i-th sample, represents the number of sub-models, Represents the weight of the mth sub-model, which is determined by the accuracy of the validation set. It represents the probability output of the m-th sub-model predicting the i-th sample as the k-th class.
[0025] To further optimize the model's sensitivity to high-grade tea, a piecewise activation function is introduced:
[0026] ;
[0027] in, , , Represents the activation function of samples of different levels.
[0028] As a preferred embodiment of the tea quality grade detection method of the present invention, the tea sample collection includes randomly sampling at least 500 grams of each batch of samples from different batches using clean tools;
[0029] Put the collected tea samples into moisture-proof, light-proof and pollutant-free sample bags, and clearly mark the sampling point, sample number, sampling time and variety;
[0030] Pretreatment includes removing impurities, constant temperature drying, and crushing.
[0031] Pour the tea sample into a clean stainless steel sieve, manually pick out obvious impurities, and use an anti-static brush to further remove attached tiny foreign matter. Spread the tea sample evenly on a clean drying tray, keeping the thickness within 2 cm. Place the drying tray in a drying oven, set the temperature to 105°C±2°C, and continue drying for 3 hours to make the tea sample reach a constant weight state and remove moisture; use a balance with an accuracy of 0.01g to detect the sample weight, weigh it every 30 minutes, until the difference between the two weighings is less than 0.01g, and confirm that the sample has reached a constant weight.
[0032] The dried tea samples are placed in a special sample grinder for grinding. The grinding time is set to 30 to 60 seconds, so that the tea particles reach a particle size range of 100-200 mesh. The ground samples are sieved and filtered through a particle size screen to remove large particles to ensure that the particle size of the samples is uniform.
[0033] Pour the crushed tea sample into a clean sample bag, mix it thoroughly with a sample mixer, seal it and store it in a low-humidity, light-proof and low-temperature environment, and mark the sample number and processing date.
[0034] As a preferred embodiment of the tea quality grade detection method of the present invention, the chemical composition index and physical properties of the tea leaves after the extraction pretreatment include: firstly extracting the chemical composition index of the tea leaves, weighing 2.0g±0.01g of the pretreated tea powder sample, putting it into an extraction bottle, adding 20mL of mixed extraction solvent into the extraction bottle, closing the bottle cap, and placing it in an ultrasonic assisted extraction device. The ultrasonic frequency is set to 40kHz, the power is 500W, and the extraction time is 20 minutes. The high-frequency ultrasonic wave is used to destroy the tea cell wall to accelerate the release of chemical components. After the extraction is completed, the extract is allowed to stand for 5 minutes to cool.
[0035] The extract after ultrasonic pre-extraction was transferred to a microwave-assisted extraction device together with tea residues. The microwave power was set to 300 W, the temperature was controlled at 60° C., and the extraction time was 10 minutes.
[0036] After the extraction is completed, the extract is filtered through a vacuum filter to remove the residue and obtain a clarified extract.
[0037] The filtered extract was passed through a centrifuge to further remove suspended particles.
[0038] The chemical composition indicators of the tea leaves finally extracted include total tea polyphenols content, caffeine content, free amino acid content, soluble sugar content, and catechin content.
[0039] To extract the physical properties of tea, take 5 g of evenly crushed tea sample, put it into a near-infrared spectrum sample cup, compact it and make it flat, put the sample cup into a near-infrared spectrum analyzer for full-band scanning, set the number of scans to 64 times, and sample evenly.
[0040] The physical properties of tea leaves finally extracted include tea color characteristic parameters, tea moisture content, tea density and structural characteristics.
[0041] As a preferred solution of the tea quality grade detection method of the present invention, the fusion includes firstly normalizing the extracted tea chemical component index and physical property index using the Z-Score normalization function to a unified scale, which is expressed as:
[0042] ;
[0043] in, represents the original value of the jth indicator of the ith sample, represents the mean value of the jth indicator, Represents the standard deviation of the j-th indicator.
[0044] According to the data of chemical composition and physical properties, a weighted fusion model based on information entropy weight optimization method is designed to calculate the contribution weight of each index to the quality of tea. The original entropy value calculation is expressed as:
[0045] ;
[0046] in, represents the information entropy of the jth indicator, represents the probability distribution of the jth indicator of the i-th sample, represents a constant, Indicates the sample size.
[0047] The weight calculated based on the entropy value is expressed as:
[0048] ;
[0049] in, represents the weight of the jth indicator, and m represents the number of indicators.
[0050] The weighted fusion of each index initially forms the comprehensive feature vector of tea:
[0051] ;
[0052] in, represents the comprehensive eigenvalue of the i-th sample, Represents the normalized j-th index value.
[0053] As a preferred embodiment of the tea quality grade detection method of the present invention, the analysis includes: Perform dimensionality reduction and calculate the eigenvector covariance matrix C.
[0054] Solve the eigenvalues and corresponding eigenvectors of the eigenvector covariance matrix, and select the first p principal components with a cumulative contribution rate of 95%:
[0055] ;
[0056] in, represents the kth eigenvalue of the covariance matrix C.
[0057] Get the principal component matrix:
[0058] ;
[0059] in, Represents the matrix composed of the eigenvectors corresponding to the first p principal components, represents the comprehensive feature vector.
[0060] As a preferred embodiment of the tea quality grade detection method of the present invention, the output of the detection result and the generation of the tea quality grade report include: ≥8.5, it is identified as special grade tea, and when 7≤ <8.5, it is identified as first-grade tea. <7, it is identified as second-grade tea.
[0061] Generate tea quality grade report. Special grade tea report lists each index parameter, average deviation and stability verification data in detail, and adds comprehensive score The first-level and second-level tea reports provide the test values, scores and threshold comparison data of each indicator, and generate quality improvement suggestions.
[0062] When the indicators in the data fusion results are abnormal, the abnormal data positioning and correction process is started. Combined with the dynamic threshold function D(x), the fluctuation range of the abnormal indicators is judged, and the abnormal indicators are screened out: Mild fluctuation means that the tea polyphenol content is lower than 5% but close to the standard. Severe fluctuation means that the tea polyphenol and water content are far below and above the safety threshold. After the abnormal data is located, the abnormal point data is locally magnified and analyzed, and the abnormal position and amplitude are recorded.
[0063] For slightly abnormal indicators, the weighted compensation correction method is used to correct the original Dynamic correction is carried out, and seriously abnormal data enters the partition re-inspection process, and the samples are re-preprocessed and re-inspected to eliminate the impact of abnormal data.
[0064] If after correction 'When the abnormal indicators are within the normal range, a correction report is generated, marking the correction process and final evaluation results of the abnormal indicators. If the abnormal indicators still exist, an abnormal record report is generated, indicating the abnormal indicators and specific fault causes.
[0065] when When the output result is close to the classification threshold boundary, the double boundary optimization method is used for further evaluation and judgment, and the boundary fuzzy judgment function is introduced to trigger the high-precision re-inspection process, increase the sample detection batch, and improve the data accuracy. For samples close to the boundary value, a high-precision evaluation report is generated, which lists all indicator detection data and boundary judgment process in detail to ensure the accuracy and credibility of the grade judgment.
[0066] A tea quality grade detection system, comprising:
[0067] Pretreatment module, collects tea samples and performs pretreatment.
[0068] The calculation module extracts the chemical composition indicators and physical properties of the pretreated tea leaves for fusion and analysis.
[0069] The detection module establishes a tea quality grade classification model, inputs the characteristics of the tea samples to be tested, outputs the test results, and generates a tea quality grade report.
[0070] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0071] A computer-readable storage medium stores a computer program, which implements the steps of the method described above when executed by a processor.
[0072] The beneficial effects of the present invention are as follows: by collecting tea samples and performing pretreatment, the tea samples are standardized and homogenized, impurities are removed and the moisture content is controlled, the consistency and reliability of the samples are ensured, and a high-quality sample basis is provided for subsequent detection.
[0073] Through the dual technology of ultrasound-assisted extraction and microwave-assisted extraction, the chemical components in tea leaves, including key indicators such as tea polyphenols, caffeine, and catechins, were extracted quickly and efficiently. This step optimized the inefficiency and time-consuming defects of traditional extraction methods, and improved the integrity and accuracy of the detected components.
[0074] By using near-infrared spectroscopy analysis technology, non-destructive and rapid detection of tea physical properties (such as color parameters, moisture content and density) is achieved. This step effectively replaces the complex and time-consuming methods of traditional physical property detection, simplifies the operation process and enhances detection efficiency.
[0075] Through Z-Score standardization and information entropy weight fusion model, multi-index weight optimization and fusion of tea chemical composition and physical property data are carried out, which realizes the unified quantitative expression of characteristic data, eliminates the influence of data scale differences, and improves the accuracy of data analysis.
[0076] The accuracy of the tea quality classification model was optimized by using a segmented ensemble learning model, combining support vector machines, gradient boosting decision trees, and improved logistic regression algorithms. The introduction of dynamic threshold functions and segmented excitation functions further solved the problem of blurred boundaries between high-grade and low-grade tea, and achieved accurate determination of tea grade classification.
[0077] Aiming at the dynamic correction and boundary optimization of abnormal data, the system can automatically identify mild and severe abnormal indicators, and repair data through weighted compensation correction and re-inspection process to ensure that the output tea grade report is highly accurate and reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0079] Figure 1 This is an overall flow chart of a tea quality grade detection method and system provided in the first embodiment of the present invention. DETAILED DESCRIPTION
[0080] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0081] Example 1, reference Figure 1 , as an embodiment of the present invention, provides a method for detecting the quality grade of tea leaves, comprising:
[0082] S1: Collect tea samples and perform pretreatment.
[0083] It should be noted that the origin and collection time of tea samples are uniformly marked, the integrity of the tea is ensured during sampling, and clean tools are used to randomly sample from different batches, with each batch of samples being at least 500 grams.
[0084] Put the collected tea samples into moisture-proof, light-proof sample bags that do not contain any pollutants, and clearly mark the sampling point, sample number, sampling time, and variety.
[0085] It should be noted that the sample bags use aluminum foil bags or composite film bags (such as PET / PE structure) because they have good moisture-proof and light-proof properties, do not contain pollutants, and meet food-grade safety standards.
[0086] Pretreatment includes removing impurities, constant temperature drying, and crushing.
[0087] Pour the tea sample into a clean stainless steel sieve, manually pick out obvious impurities, and use an anti-static brush to further remove attached tiny foreign matter. Spread the tea sample evenly on a clean drying tray, keeping the thickness within 2 cm. Place the drying tray in a drying oven, set the temperature to 105°C±2°C, and continue drying for 3 hours to make the tea sample reach a constant weight state and remove moisture. Use a balance with an accuracy of 0.01g to check the sample weight, weigh it every 30 minutes, until the difference between the two weighings is less than 0.01g, and confirm that the sample has reached a constant weight.
[0088] The dried tea samples are placed in a special sample grinder for grinding. The grinding time is set to 30 to 60 seconds, so that the tea particles reach a particle size range of 100-200 mesh. The ground samples are sieved and filtered through a particle size screen to remove large particles to ensure that the particle size of the samples is uniform.
[0089] Pour the crushed tea sample into a clean sample bag, mix it thoroughly with a sample mixer, seal it and store it in a low-humidity, light-proof and low-temperature environment, and mark the sample number and processing date.
[0090] S2: Extract the chemical composition indexes and physical properties of the pretreated tea leaves, and then integrate and analyze them.
[0091] It should be noted that the extraction equipment includes:
[0092] Ultrasonic assisted extraction device: The frequency was set at 40kHz±2kHz, and the output power was set at 500W.
[0093] Microwave-assisted extraction device: The power was set to 300 W and the extraction temperature was controlled at 60 °C ± 2 °C.
[0094] Extraction solvent: A mixed solvent of pure water and ethanol (volume ratio 70:30) was used.
[0095] First, extract the chemical composition index of tea leaves. Weigh 2.0g±0.01g of pretreated tea powder sample and put it into an extraction bottle. Add 20mL of mixed extraction solvent into the extraction bottle, seal the bottle cap, and place it in an ultrasonic-assisted extraction device. Set the ultrasonic frequency to 40kHz, the power to 500W, and the extraction time to 20 minutes. Use high-frequency ultrasound to destroy the tea cell wall and accelerate the release of chemical components. After the extraction is completed, let the extract stand for 5 minutes to cool.
[0096] The extract after ultrasonic pre-extraction was transferred to a microwave-assisted extraction device together with tea residues. The microwave power was set to 300 W, the temperature was controlled at 60° C., and the extraction time was 10 minutes.
[0097] After the extraction is completed, the extract is filtered through a vacuum filter to remove the residue and obtain a clarified extract.
[0098] The filtered extract was passed through a centrifuge to further remove suspended particles.
[0099] The chemical composition indicators of the tea leaves finally extracted include total tea polyphenols content, caffeine content, free amino acid content, soluble sugar content, and catechin content.
[0100] It should be noted that by combining the dual technologies of ultrasound-assisted extraction and microwave-assisted extraction, the chemical components in tea can be extracted quickly and efficiently, which optimizes the problems of low extraction efficiency and long extraction time of traditional solvent extraction method, while improving the integrity and concentration of the extracted components.
[0101] To extract the physical properties of tea, take 5 g of evenly crushed tea sample, put it into a near-infrared spectrum sample cup, compact it and make it flat, put the sample cup into a near-infrared spectrum analyzer for full-band scanning, set the number of scans to 64 times, and sample evenly.
[0102] The physical properties of tea leaves finally extracted include tea color characteristic parameters, tea moisture content, tea density and structural characteristics.
[0103] It should be noted that near-infrared diffuse reflectance spectroscopy (NIR) technology is used to achieve non-destructive and rapid extraction and quantification of the physical properties of tea, replacing the traditional cumbersome measurement methods, and at the same time obtaining multi-dimensional data features.
[0104] The fusion process includes normalizing the extracted tea chemical composition indicators (tea polyphenols content, caffeine content, free amino acids, soluble sugars, catechins) and physical property indicators (color parameters, moisture content, density and structural characteristics) to prevent the influence of data scale differences on fusion analysis. First, the extracted tea chemical composition indicators and physical property indicators are normalized to a unified scale using the Z-Score standardization function, which is expressed as:
[0105] ;
[0106] in, represents the original value of the jth indicator of the ith sample, represents the mean value of the jth indicator, Represents the standard deviation of the j-th indicator.
[0107] According to the data of chemical composition and physical properties, a weighted fusion model based on information entropy weight optimization method is designed to calculate the contribution weight of each index to the quality of tea. The original entropy value calculation is expressed as:
[0108] ;
[0109] in, represents the information entropy of the jth indicator, represents the probability distribution of the jth indicator of the i-th sample, represents a constant, Indicates the sample size.
[0110] It should be noted that the constant k is a proportional factor in the information entropy calculation formula, which is used to normalize the entropy value result so that the entropy value range remains in a reasonable range. The value is:
[0111] ;
[0112] This value is to ensure The value of is always between 0 and 1. The normalized entropy value can more intuitively reflect the information uncertainty of each indicator and contribute to the fair distribution of indicator weights.
[0113] The weight calculated based on the entropy value is expressed as:
[0114] ;
[0115] in, represents the weight of the jth indicator, and m represents the number of indicators.
[0116] The weighted fusion of each index initially forms the comprehensive feature vector of tea:
[0117] ;
[0118] in, represents the comprehensive eigenvalue of the i-th sample, Represents the normalized j-th index value.
[0119] The analysis includes: to reduce data redundancy and improve computational efficiency, the comprehensive feature vector is analyzed based on the principal component analysis method. Perform dimensionality reduction and calculate the eigenvector covariance matrix.
[0120] Solve the eigenvalues and corresponding eigenvectors of the eigenvector covariance matrix, and select the first p principal components with a cumulative contribution rate of 95%:
[0121] ;
[0122] in, represents the kth eigenvalue of the covariance matrix C.
[0123] Eigenvalue The larger the value, the stronger the principal component's ability to explain the sample data. p represents the number of principal components, which is used to calculate the cumulative contribution rate. k represents the index number of the eigenvalue, from 1 to p, indicating the kth principal component after sorting.
[0124] Get the principal component matrix:
[0125] ;
[0126] in, Represents the matrix composed of the eigenvectors corresponding to the first p principal components, represents the comprehensive feature vector.
[0127] S3: Establish a tea quality grade classification model, input the characteristics of the tea samples to be tested, output the test results, and generate a tea quality grade report.
[0128] The comprehensive feature vector T obtained after fusion and analysis p ={t1,t2,...,t p} is used as the model input, and the feature vector dimension is p. According to the tea quality grade standard, the samples are divided into three categories: special grade L1, first grade L2 and second grade L3, and the data set is divided into training set and test set in a ratio of 8:2.
[0129] Three sub-classifiers are used for segmented training, including support vector machine, gradient boosting decision tree and logistic regression, and a classifier incentive mechanism is introduced to optimize the classification effect.
[0130] It should be noted that the existing ensemble learning methods (such as random forests, support vector machines, etc.) are segmented and optimized to improve classification accuracy. Dynamic threshold functions and weighted voting mechanisms are introduced to dynamically adjust the classification decision boundary. Segmented activation functions are designed to optimize the model's sensitivity and classification effect on high-quality samples.
[0131] Support vector machine using radial basis kernel function , perform nonlinear mapping on tea quality data.
[0132] The gradient boosting decision tree uses the segmented decision tree method to train multiple trees to learn the nonlinear relationship between sample features and category labels.
[0133] Logistic regression uses an improved Sigmoid activation function, expressed as:
[0134] ;
[0135] in, represents the improved Sigmoid activation function, Represents the adjustment parameter to optimize the sensitivity of the activation function to high-quality samples.
[0136] It should be noted that The value is 0.5~2, which is determined by experimental fitting. (such as 0.5) makes the activation function curve smoother, which is suitable for data with fuzzy classification boundaries. (Like 2) Make the curve steeper, suitable for data with clear sample boundaries. Adjust according to the experiment The value of can balance the sensitivity to premium tea and boundary samples and improve classification accuracy.
[0137] In order to improve the classification accuracy, a dynamic threshold function is introduced to adjust the decision boundary between different levels. The dynamic threshold function is designed as:
[0138] ;
[0139] in, represents the modulus of the input feature vector, . represents the equilibrium parameter, represents the equilibrium parameter, Parameter representing the sensitivity of adjusting the threshold as the feature amplitude changes.
[0140] It should be noted that The value ranges from 0.5 to 1.5. When a smaller value is taken, the threshold changes smoothly, and when a larger value is taken, the threshold is more sensitive to changes in feature amplitude. The value is 0.2~0.5, determined according to the fluctuation range of data characteristics.
[0141] Specifically, The value range is 0.01~0.1, the lower value Makes the threshold insensitive to changes in feature amplitude, suitable for stable data. Higher values Improves sensitivity and is suitable for data with large fluctuations.
[0142] The classification results of the three sub-models, support vector machine, gradient boosting decision tree and logistic regression, are weighted voted and fused to finally form the classification results of tea quality grade. The voting mechanism is designed as follows:
[0143] ;
[0144] in, represents the final classification result of the i-th sample, represents the number of sub-models, Represents the weight of the mth sub-model, which is determined by the accuracy of the validation set.
[0145] It should be noted that It represents the probability output of the m-th sub-model predicting the i-th sample as the k-th class.
[0146] To further optimize the model's sensitivity to high-grade tea, a piecewise activation function is introduced:
[0147] ;
[0148] in, , , Represents the activation function of samples of different levels.
[0149] It should be noted that The value is 1.5~2.0, giving higher incentive values to special samples to ensure that the model is more sensitive to special samples. The value is 1, which is the standard value. The value is 0.5~0.8, which reduces the incentive value of secondary samples and reduces the impact on low-level samples.
[0150] when ≥8.5, it is identified as special grade tea, and when 7≤ <8.5, it is identified as first-grade tea. <7, it is identified as second-grade tea.
[0151] Specifically, a bag of tea is taken as an example. The chemical composition indicators are: tea polyphenol content 22.5%, caffeine content: 3.1%, free amino acid content: 2.2%, soluble sugar content: 5.0%, and the physical property indicators are: tea color error value: 0.15, tea moisture content: 4.5%, tea density: 0.85 g / cm³.
[0152] The Z-score standardization function was used to normalize the physical and chemical composition indicators. The content after processing was:
[0153] The tea polyphenol content is 1.25, the caffeine content is 1.5, the free amino acid content is 0.67, the soluble sugar content is 0.4, the tea color error value is −1.5, the tea moisture content is −2.5, and the tea density is 1.0.
[0154] The information entropy weight calculation was performed, and the weight of each indicator was set as follows: tea polyphenol content weight 0.3, caffeine content weight 0.25, free amino acid content weight 0.2, soluble sugar content weight 0.10, tea color error value weight 0.05, tea moisture content weight 0.05, tea density weight 0.05.
[0155] Combined with the weights, the standardized data is fused into a comprehensive feature vector T=0.774.
[0156] Through the segmented integrated learning model, the support vector machine output is P SVM (Special) = 0.88, P SVM (Level 1) = 0.10, P SVM (Level 2) = 0.02.
[0157] The output of the gradient boosting decision tree is P GBDT (Special) = 0.83, P GBDT (Level 1) = 0.12, P GBDT (Level 2)=0.05.
[0158] The output of logistic regression is P LR (Special) = 0.85, P LR (Level 1) = 0.10, P LR (Level 2)=0.05.
[0159] The dynamic threshold function is used to adjust the classification results, and the comprehensive probability is Ci=(0.4×0.88)+(0.3×0.83)+(0.3×0.85)=0.352+0.249+0.255=0.856.
[0160] This tea is identified as special grade tea.
[0161] Generate tea quality grade report. Special grade tea report lists each index parameter, average deviation and stability verification data in detail, and adds comprehensive score The first-level and second-level tea reports provide the test values, scores and threshold comparison data of each indicator, and generate quality improvement suggestions.
[0162] When the indicators in the data fusion results are abnormal, the abnormal data positioning and correction process is started. Combined with the dynamic threshold function D(x), the fluctuation range of the abnormal indicators is judged, and the abnormal indicators are screened out: Mild fluctuation means that the tea polyphenol content is lower than 5% but close to the standard. Severe fluctuation means that the tea polyphenol and water content are far below and above the safety threshold. After the abnormal data is located, the abnormal point data is locally magnified and analyzed, and the abnormal position and amplitude are recorded.
[0163] For slightly abnormal indicators, the weighted compensation correction method is used to correct the original Dynamic correction is carried out, and seriously abnormal data enters the partition re-inspection process, and the samples are re-preprocessed and re-inspected to eliminate the impact of abnormal data.
[0164] It should be noted that the weighted compensation correction method is expressed as:
[0165] ;
[0166] in, represents the corrected score, represents the indicator weight, Indicates abnormal indicator value.
[0167] If after correction 'When the abnormal indicators are within the normal range, a correction report is generated, marking the correction process and final evaluation results of the abnormal indicators. If the abnormal indicators still exist, an abnormal record report is generated, indicating the abnormal indicators and specific fault causes.
[0168] when When the output is close to the classification threshold boundary (for example =8.48 or =6.98), the double boundary optimization method is used for further evaluation and judgment, and the boundary fuzzy judgment function is introduced to trigger the high-precision re-inspection process, increase the sample detection batches, and improve the data accuracy. For samples close to the boundary value, a high-precision evaluation report is generated, which lists all indicator detection data and boundary judgment process in detail to ensure the accuracy and credibility of the grade judgment.
[0169] Specifically, the boundary fuzzy judgment function is expressed as:
[0170] ;
[0171] in, represents the boundary value, Represents the boundary sensitivity adjustment parameter.
[0172] when When >0.95, the high-precision re-inspection process is triggered, the sample inspection batch is increased, and the data accuracy is improved.
[0173] It should be noted that the focus of S3 is to establish a segmented integrated learning model through the fusion analysis of tea chemical composition indicators and physical properties, output a comprehensive score, and generate a tea quality grade report based on its value. On this basis, we further explore how to dynamically optimize the output of test results, grade generation and evaluation processes under different input conditions (data anomalies, threshold boundary changes, and grading accuracy requirements). We select sequential stratification combined with cycles as the core inductive element, and through the two major categories of normal and abnormal feature data, we execute different grade judgment and report generation strategies step by step and in a cyclic feedback manner to form a closed-loop optimization evaluation system.
[0174] Furthermore, all imaginary parameters such as weight parameters and adjustment parameters in the present invention are experimentally set or empirically set, and can be adjusted according to actual conditions in specific applications.
[0175] The above embodiment also includes a tea quality grade detection system, specifically:
[0176] Pretreatment module, collects tea samples and performs pretreatment.
[0177] The calculation module extracts the chemical composition indicators and physical properties of the pretreated tea leaves for fusion and analysis.
[0178] The detection module establishes a tea quality grade classification model, inputs the characteristics of the tea samples to be tested, outputs the test results, and generates a tea quality grade report.
[0179] The computer device may be a server. The computer device includes a processor, a memory, an input / output interface (I / O for short) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data cluster data of a power monitoring system. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method is implemented.
[0180] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0181] Example 2 is an embodiment of the present invention, which provides a method and system for detecting the quality grade of tea leaves. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through simulation experiments.
[0182] High-quality tea samples from Fujian, Yunnan and Zhejiang were selected to represent the characteristics of tea leaves with different growth environments and quality levels. Ten samples were randomly collected from each origin, and each sample weighed 500 grams. After sampling, the samples were placed in clearly marked moisture-proof and light-proof sample bags and uniformly pre-treated in the laboratory.
[0183] The preprocessing steps include:
[0184] Remove impurities: Pick out impurities manually and use an electrostatic brush to remove tiny foreign objects.
[0185] Constant temperature drying: Dry in a drying oven at 105°C for 3 hours to control the moisture content of the sample.
[0186] Crushing: Use a special crusher to process the tea leaves into a particle size range of 100-200 mesh to ensure uniform particle size of the sample.
[0187] Ultrasonic-assisted extraction and microwave-assisted extraction techniques were used to extract chemical component indicators, including tea polyphenols, caffeine, free amino acids, etc. Near-infrared spectroscopy was used to measure the physical properties of tea, such as color error, moisture content, and density.
[0188] Data fusion uses the information entropy weight optimization method to unify and quantify the chemical composition and physical properties to form a comprehensive feature vector. Finally, a segmented ensemble learning model (including support vector machine, gradient boosting decision tree and logistic regression) is used to classify tea samples and generate a quality grade report.
[0189] The experimental results are shown in Table 1.
[0190] Table 1 Tea quality grade test data table
[0191]
[0192] The comprehensive characteristic value T is calculated by integrating tea polyphenol content, caffeine content and other indicators based on the information entropy weight optimization method. Sample D (Fujian) performed the highest, 0.790, indicating that its multidimensional characteristic index is more superior. Sample E (Yunnan) performed the lowest, 0.720, mainly due to its low tea polyphenol content and density.
[0193] The SVM output reflects the confidence of the SVM in classifying the samples. Sample D has the highest output (0.90), which is consistent with the high performance of the comprehensive eigenvalue T. The output of sample B (0.81) is relatively low, which may be limited by its low free amino acid content.
[0194] The output of the gradient boosted decision tree also shows the superiority of sample D (0.85). The output of sample E is the lowest (0.75), indicating that the multidimensional features of this sample have low discrimination in the tree model.
[0195] Logistic regression output Logistic regression classifies samples by optimizing the Sigmoid function. Sample D has the highest output (0.87), which again proves that it is most likely to be a premium grade tea. Sample F (Zhejiang) has the second highest output (0.83), showing good classification credibility.
[0196] The comprehensive score was obtained by weighted fusion of the output values of support vector machine, gradient boosting decision tree and logistic regression. Sample D scored 0.878, the highest among all samples, and was finally determined to be a special grade tea. Sample E scored 0.760, the lowest, and was determined to be a first grade tea.
[0197] It can be seen from the above data and analysis that the method of the present invention can fully integrate multidimensional data features and effectively improve classification accuracy and decision confidence by combining segmented integrated learning models. This is particularly evident in the multi-index consistency performance of sample D. Compared with traditional methods, the present invention has shown significant technical advantages in high-grade tea classification and boundary optimization processing.
[0198] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for detecting the quality grade of tea, characterized in that: include: Collect tea samples and conduct pretreatment; Extract the chemical composition indexes and physical properties of the pre-treated tea leaves, and then integrate and analyze them; Establish a tea quality grade classification model, input the characteristics of the tea samples to be tested, output the test results, and generate a tea quality grade report; The tea quality grade classification model is established including: The comprehensive feature vector T obtained after fusion and analysis p ={t1,t2,...,t p } is used as the model input, and the feature vector dimension is p; according to the tea quality grade standard, the samples are divided into three categories: special grade L1, first grade L2 and second grade L3, and the data set is divided into training set and test set in a ratio of 8:2; Three sub-classifiers are used for segmented training, including support vector machine, gradient boosting decision tree and logistic regression, and a classifier incentive mechanism is introduced to optimize the classification effect; Support vector machine using radial basis kernel function , nonlinear mapping of tea quality data; represents the i-th sample vector in the feature space, Represents the jth sample vector in the feature space; Gradient boosting decision trees use the segmented decision tree method to train multiple trees to learn the nonlinear relationship between sample features and category labels; Logistic regression uses an improved Sigmoid activation function, expressed as: ; in, represents the improved Sigmoid activation function, represents the adjustment parameter to optimize the sensitivity of the activation function to high-quality samples; In order to improve the classification accuracy, a dynamic threshold function is introduced to adjust the decision boundary between different levels; the dynamic threshold function is designed as follows: ; in, represents the modulus of the input feature vector, ; represents the equilibrium parameter, represents the equilibrium parameter, represents the sensitivity parameter of adjusting the threshold value as the feature amplitude changes; The classification results of the three sub-models, support vector machine, gradient boosting decision tree and logistic regression, are fused by weighted voting to finally form the classification results of tea quality grades; the voting mechanism is designed as follows: ; in, represents the final classification result of the i-th sample, represents the number of sub-models, Represents the weight of the mth sub-model, which is determined by the accuracy of the validation set. It indicates the probability output of the m-th sub-model predicting the i-th sample as the k-th class; To further optimize the model's sensitivity to high-grade tea, a piecewise activation function is introduced: ; in, , , Represents the activation function of samples of different levels; The collection of tea samples comprises: Use clean tools to randomly take samples from different batches, with each sample of at least 500 grams; Put the collected tea samples into moisture-proof, light-proof and pollutant-free sample bags, and clearly mark the sampling point, sample number, sampling time and variety; Pretreatment includes removal of impurities, constant temperature drying, and crushing; Pour the tea sample into a clean stainless steel sieve, manually pick out obvious impurities, and use a static-eliminating brush to further remove attached tiny foreign matter; evenly spread the tea sample on a clean drying tray, with a thickness of less than 2 cm; place the drying tray in a drying oven, set the temperature to 105°C±2°C, and continue drying for 3 hours to make the tea sample reach a constant weight state and remove moisture; use a balance with an accuracy of 0.01g to detect the sample weight, and weigh it every 30 minutes until the difference between the two weighings is less than 0.01g, to determine that the sample has reached a constant weight; The dried tea samples are placed in a special sample grinder for grinding, and the grinding time is set to 30 seconds to 60 seconds, so that the tea particles reach a particle size range of 100-200 meshes; the ground samples are sieved and filtered through a particle size screen to remove large particles to ensure that the particle size of the samples is uniform; Pour the crushed tea sample into a clean sample bag, mix it thoroughly with a sample mixer, seal it and store it in a low-humidity, light-proof and low-temperature environment, and mark the sample number and processing date; The fusion comprises: Firstly, the extracted tea chemical composition indexes and physical property indexes were normalized using the Z-Score normalization function, which is expressed as: ; in, represents the original value of the jth indicator of the ith sample, represents the mean value of the jth indicator, represents the standard deviation of the jth indicator; According to the data of chemical composition and physical properties, a weighted fusion model based on information entropy weight optimization method is designed to calculate the contribution weight of each index to the quality of tea. The original entropy value calculation is expressed as: ; in, represents the information entropy of the jth indicator, represents the probability distribution of the jth indicator of the i-th sample, represents a constant, represents the number of samples; The weight calculated based on the entropy value is expressed as: ; in, represents the weight of the jth indicator, and m represents the number of indicators; The weighted fusion of each index initially forms the comprehensive feature vector of tea: ; in, represents the comprehensive eigenvalue of the i-th sample, Represents the normalized j-th index value.
2. The tea quality grade detection method according to claim 1, characterized in that: The chemical composition indexes and physical properties of the tea leaves after the extraction pretreatment include: First, extract the chemical composition index of tea leaves, weigh 2.0g±0.01g of the pretreated tea powder sample, put it into an extraction bottle, add 20mL of mixed extraction solvent into the extraction bottle, close the bottle cap, and place it in an ultrasonic-assisted extraction device; set the ultrasonic frequency to 40kHz, the power to 500W, and the extraction time to 20 minutes, and use high-frequency ultrasound to destroy the tea cell wall to accelerate the release of chemical components; after the extraction is completed, let the extract stand for 5 minutes to cool; The ultrasonic pre-extracted extract and the tea residue were transferred to a microwave-assisted extraction device; the microwave power was set to 300 W, the temperature was controlled at 60° C., and the extraction time was 10 minutes; After the extraction is completed, the extract is filtered through a vacuum filter to remove the residue and obtain a clarified extract; The filtered extract is passed through a centrifuge to further remove suspended particles; The chemical composition indicators of the tea leaves finally extracted include the total content of tea polyphenols, caffeine content, free amino acid content, soluble sugar content, and catechin content; Extract the physical properties of tea leaves. Take 5g of evenly crushed tea leaves and put them into a near-infrared spectrum sample cup. Press and level them. Put the sample cup into a near-infrared spectrum analyzer for full-band scanning. Set the number of scans to 64 and sample evenly. The physical properties of tea leaves finally extracted include tea color characteristic parameters, tea moisture content, tea density and structural characteristics.
3. The tea quality grade detection method according to claim 1, characterized in that: The analysis included: Based on the principal component analysis method, the comprehensive feature vector Perform dimensionality reduction and calculate the eigenvector covariance matrix C; Solve the eigenvalues and corresponding eigenvectors of the eigenvector covariance matrix, and select the first p principal components with a cumulative contribution rate of 95%: ; in, represents the kth eigenvalue of the covariance matrix C; Get the principal component matrix: ; in, Represents the matrix composed of the eigenvectors corresponding to the first p principal components, represents the comprehensive feature vector.
4. The method for detecting tea quality grade according to claim 3, characterized in that: Outputting the test results and generating a tea quality grade report includes: when ≥8.5, it is identified as special grade tea, and when 7≤ <8.5, it is identified as first-grade tea. <7, it is identified as second-grade tea; Generate tea quality grade report. The premium tea report lists each index parameter, average deviation and stability verification data in detail, and adds a comprehensive score The first- and second-level tea reports provide the test values, scores and threshold comparison data of each indicator, and generate quality improvement suggestions; When an indicator in the data fusion result is abnormal, the abnormal data positioning and correction process is started, and the fluctuation range of the abnormal indicator is judged in combination with the dynamic threshold function D(x), and the abnormal indicator is screened out: mild fluctuation means that the tea polyphenol content is lower than 5% but close to the standard; severe fluctuation means that the tea polyphenol and water content are far below and higher than the safety threshold; after the abnormal data is located, the abnormal point data is locally amplified and analyzed, and the abnormal position and amplitude are recorded; For slightly abnormal indicators, the weighted compensation correction method is used to correct the original Dynamic correction is carried out, and serious abnormal data enters the partition re-inspection process, and the samples are re-preprocessed and re-inspected to eliminate the impact of abnormal data; If after correction 'If the abnormal indicator still exists, an abnormal record report will be generated, indicating the abnormal indicator and the specific cause of the fault; when When the output result is close to the classification threshold boundary, the double boundary optimization method is used for further evaluation and judgment, and the boundary fuzzy judgment function is introduced to trigger the high-precision re-inspection process, increase the sample detection batches, and improve data accuracy. For samples close to the boundary value, a high-precision evaluation report is generated, which lists all indicator detection data and boundary judgment process in detail to ensure the accuracy and credibility of the grade judgment.
5. A tea quality grade detection system, based on the tea quality grade detection method according to any one of claims 1 to 4, characterized in that: include: Pretreatment module, collects tea samples and performs pretreatment; The calculation module extracts the chemical composition indexes and physical properties of the pre-treated tea leaves and performs fusion and analysis; The detection module establishes a tea quality grade classification model, inputs the characteristics of the tea samples to be tested, outputs the test results, and generates a tea quality grade report.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Tea impurity identification method and sorting equipment based on Stacking weighted ensemble learning
CN111563519A