Terahertz spectrum-based Liupao tea year grade multi-task control gating identification method
Through terahertz spectroscopy technology and multi-task control gated identification method, the cumbersome and time-consuming problem of Liubao Tea detection process is solved, and the rapid and accurate identification of years and grades is achieved, the detection efficiency and accuracy are improved, and the needs of rapid detection scenarios are adapted.
Patent Information
- Application Number
- CN202510570173.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2025-07-22
AI Technical Summary
The existing Liubao tea quality detection methods are cumbersome and time-consuming, which are difficult to meet the needs of rapid detection. They lack the ability to analyze multi-dimensional quality parameters, and cannot achieve synchronous and accurate identification of year and grade.
Using a multi-task control gating discrimination method based on terahertz spectroscopy, a multi-task loss function and a shared expert network are constructed, combined with spectral normalization convolution and task-specific attention, separated subtle spectral differences in years and levels, dynamic module fusion features are designed to achieve feature decoupling, and optimize weights using an improved hippo algorithm.
It has achieved rapid, accurate and efficient testing of Liubao tea vintage and grade, breaking through the technical limitations of traditional single-index testing, improving the simplicity and practicality of the testing process, and having green analysis characteristics.
Smart Images

Figure CN120352370A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of terahertz spectroscopy detection, and particularly relates to a multi-task control gating discrimination method for the year and grade of Liubao tea based on terahertz spectroscopy. Background Technique
[0002] As a traditional famous tea in Guangxi, Liubao tea has a long history and profound cultural heritage. It is named after its origin in Liubao Town, Cangwu County, Wuzhou City, Guangxi, and is renowned for its unique qualities of "red, strong, aged, and mellow". As early as during the Jiaqing period of the Qing Dynasty, it was among the top 24 famous teas in China and was well-known at home and abroad for its iconic betel nut fragrance. As a cultural treasure of Guangxi and an important branch of Chinese tea culture, Liubao tea carries regional characteristics and historical inheritance.
[0003] In recent years, with the continuous expansion of the industrial scale, Liubao tea has become a pillar crop in the agricultural economy of Guangxi, and its industrial development has received high attention from the government. Through policy guidance and resource integration, Guangxi has gradually established its position as the core production area of Liubao tea in the country, achieving the goal of "doubling both production and output value". The tea garden planting area has expanded steadily, and the brand added value has increased significantly. The improvement of market influence has not only driven farmers' income increase but also become an important driving force for regional economic development. However, with the growth of market demand, the problem of counterfeiting and shoddy products has become increasingly prominent - some merchants seek improper benefits by falsely reporting the tea year and grade, seriously damaging the rights and interests of consumers and the credibility of the industrial brand. In this context, building a precise and efficient year and grade detection technology system has become a key link to ensure the healthy and sustainable development of the Liubao tea industry.
[0004] Currently, the quality detection methods for Liubao tea mainly include sensory evaluation, near-infrared spectroscopy, Raman spectroscopy, DNA fingerprinting, spectrophotometry, and gas / liquid chromatography techniques. Although these methods have high specificity and accuracy, their common limitations are: they require cumbersome sample pretreatment, have a long detection cycle, the operation process depends on professional technical personnel, and have strict requirements for instrument equipment and experimental environment, making it difficult to meet the actual needs of on-site rapid detection scenarios. In addition, most of the existing technologies independently model for a single index such as year or grade, lacking the ability to conduct collaborative analysis of multi-dimensional quality parameters and unable to achieve synchronous and precise discrimination of multiple indicators such as "year + grade". Therefore, there is an urgent need to develop a new detection technology with the characteristics of rapidity, efficiency, and greenness to break through the bottleneck of traditional methods and meet the actual needs of industrial development. Summary of the Invention
[0005] The purpose of the present invention is to provide a rapid and efficient method for discriminating the year and grade of Liubao tea, making up for the deficiencies of the existing technology to achieve rapid and accurate discrimination of the year and grade of Liubao tea.
[0006] To achieve the above object, a multi-task controlled gated discrimination method for the year and grade of Liubao tea based on terahertz spectroscopy adopted by the present invention comprises the following steps:
[0007] (1): Select five samples of Sanhe Liubao tea of the same series with different years and grades as experimental samples. Crush, sieve, and press the Liubao tea of different grades and years to obtain smooth and flat pressed samples of Liubao tea;
[0008] (2): Use a transmission terahertz time-domain spectroscopy system to perform spectral detection on Liubao tea of different years and grades to obtain a time-domain spectral dataset of Liubao tea of different years and grades.
[0009] (3): Divide the dataset into a training set and a test set, and construct a multi-task customized gated discrimination model for the year and grade of Liubao tea;
[0010] (4): Construct a multi-task loss function and optimize the weight update in combination with the HO algorithm.
[0011] (5): Input the time-domain spectral data of the training set samples of Liubao tea of different years and grades into the multi-task customized gated discrimination model for training;
[0012] (6): Input the time-domain spectral dataset of the Liubao tea to be discriminated into the trained model for discrimination, and output the discrimination results, and compare these results with the test results of classifying the year and grade respectively using a single-task neural network model.
[0013] Furthermore, the experimental samples were selected from the Wuzhou production area protected by the national geographical indication product, and were directly supplied by the regular manufacturer Sanhe Liubao Tea Co., Ltd. with SC food production license, ensuring reliable and traceable sources. Each sample was attached with a detailed production record file, with the year marked accurately to the production month, and the grade division strictly followed the national standard. It was scientifically evaluated through dual aspects of sensory quality (appearance, soup color, aroma, taste, leaf bottom) and physical and chemical indexes (tea polyphenols, free amino acids, water extract content, etc.). This purchase covered 5 categories including the special grade in 2015, the special grade / first grade / second grade in 2018, and the special grade in 2021, achieving multi-dimensional coverage of the year span (2015 - 2021) and grade (from special grade to second grade), fully reflecting the quality characteristics under different aging stages and grade standards, and guaranteeing the authenticity, standardization and typicality of the experimental samples in terms of year and grade from the source, completely meeting the research requirements of this experiment for year and grade identification. The sample pretreatment strictly followed the standardized process: First, the tea samples were dried in a constant temperature drying oven at 40°C until the moisture content was <5%, then crushed by a high-speed crusher (rotation speed 20000r / min, crushing time 30s), and passed through a 100-mesh sieve (aperture 0.15mm) to remove coarse particles. The sifted material was ground in an agate mortar until the particles were uniform. Weighed 200mg of the ground tea powder and placed it in a customized mold (inner diameter 13mm), and a 10MPa pressure was applied using an electric tablet press (model YP-20T, Shanghai Xinnuo Instrument) for 10s to obtain a cylindrical thin slice with a thickness of (1.0 ± 0.05)mm. The tablet pressing process was carried out in a constant temperature and humidity environment (25 ± 1°C, relative humidity 45% ± 5%) to ensure uniform internal density of the sample and meet the requirements of terahertz wave transmission detection for the optical consistency of the sample.
[0014] Furthermore, the terahertz time-domain spectroscopy system used the CCT-1800 terahertz time-domain spectroscopy system of China Huaxun Fangzhou Technology Co., Ltd. to detect the Liubao tea samples. Through the transmission terahertz time-domain spectroscopy system, the spectral data of Liubao tea samples of different years and grades were collected. The system obtained the spectral data through the following process: First, the femtosecond laser pulse was divided into two paths of pump pulse and probe pulse by a beam splitter; after being regulated by the time delay module, the pump pulse was incident on the terahertz radiation generation device to excite terahertz pulses; at the same time, the probe pulse and the terahertz pulse carrying the sample information were collinearly transmitted to the terahertz detection device, driving the device to complete signal acquisition and transmit the data to the computer in real time, and finally constructing the time-domain spectral data set of Liubao tea of different years and grades.
[0015] Furthermore, the model is a single-model multi-task system, which realizes information sharing and difference capture between two tasks, and solves the problem that it is difficult for traditional single-task models to simultaneously consider two detection indicators during feature extraction. By sharing the expert module, the common features of the year and grade are captured. At the same time, combined with the dedicated network of spectral normalization convolution and task-specific attention, the subtle spectral differences unique to the year and grade are separated to achieve feature decoupling and improve the cross-task judgment ability of the model. A dynamic module containing learnable weights and a gating network is designed to fuse features, balancing global information and task uniqueness. A feature separation loss function based on inter-class distance and intra-class variance is constructed to strengthen task feature differentiation.
[0016] Furthermore, when constructing the multi-task loss function, the basic losses of the grade task and the year task are simultaneously considered, as well as the additional loss that promotes the decoupling of task-specific features, effectively achieving the balance between information sharing and task differentiation. Combined with the improved hippopotamus optimization algorithm (IHOA), the weights are optimized to improve the cross-task discrimination ability.
[0017] Furthermore, during the model training process, 80% of the data is randomly selected from the time-domain spectral dataset of Liubao tea as the training set and input into the constructed multi-task customized gating discrimination model for training to obtain the best classification and discrimination model.
[0018] Furthermore, during the testing process, the remaining 20% of the data in the time-domain spectral dataset of Liubao tea with different years and grades is used as the test set and input into the trained model for classification and discrimination, and the discrimination results are output. These results are compared with the test results of using a single-task neural network model for year and grade classification respectively.
[0019] The advantages of the present invention are as follows:
[0020] (1) The terahertz time-domain spectroscopy technology has advantages such as fingerprint characteristics and low energy. The detection system constructed based on this technology can realize the rapid, accurate, and efficient detection of the year and grade of Liubao tea, significantly improving the simplicity and practicality of the detection process;
[0021] (2) The proposed multi-task joint control gating discrimination model realizes the joint detection of the year and grade synchronously through the cross-task feature coordination mechanism, showing high efficiency and robustness in the extraction of subtle spectral difference features and cross-task feature decoupling, breaking through the technical limitations of traditional single-index detection;
[0022] (3) The terahertz time-domain spectroscopy system used in the present invention has the remarkable characteristics of simple operation, safety, and reliability. Its low-energy characteristic avoids radiation hazards, and no pollutants are generated during the entire detection process, meeting the development requirements of green analysis technology. Description of the Drawings
[0023] Figure 1 It is a schematic flow diagram of a multi-task controlled gating discrimination method for the year and grade of Liubao tea based on terahertz spectroscopy in the present invention.
[0024] Figure 2 It is a system schematic diagram of the terahertz time-domain spectroscopy system CCT-1800 of the present invention.
[0025] Figure 3 It is the terahertz average time-domain spectrogram of 5 kinds of Liubao tea in the 0-30 ps band.
[0026] Figure 4 It is the t-SNE dimensionality reduction diagram of the original data.
[0027] Figure 5 It is the t-SNE dimensionality reduction diagram of the data after attention processing.
[0028] Figure 6 It is the visualization diagram of the prediction results of the single-task and multi-task confusion matrices. Specific implementation manners
[0029] The following further describes in detail the specific implementation manners of the present invention in conjunction with the attached drawings, so that those skilled in the art can better understand the present invention.
[0030] Please refer to Figure 1 , for the multi-task controlled gating discrimination method for the year and grade of Liubao tea based on terahertz spectroscopy in the present invention, the specific implementation steps are as follows:
[0031] (1): Select five Sanhe Liubao teas of the same series with different years and grades as experimental samples, crush, sieve, and tablet the Liubao teas of different grades and years to obtain smooth and flat Liubao tea sample tablets;
[0032] (2): Use a transmission terahertz time-domain spectroscopy system to perform spectral detection on Liubao teas of different years and grades to obtain a time-domain spectral dataset of Liubao teas of different years and grades.
[0033] (3): Divide the dataset into a training set and a test set, and construct a multi-task customized gating discrimination model for the year and grade of Liubao tea;
[0034] (4): Construct a multi-task loss function and optimize the weight update in combination with the HO algorithm.
[0035] (5): Input the time-domain spectral data of the training set samples of the Liubao teas of different years and grades into the multi-task customized gating discrimination model for training;
[0036] (6): Input the time-domain spectral dataset of the Liubao tea to be identified into the trained model for identification, and output the identification results. Then compare these results with the test results of using a single-task neural network model to classify the year and grade respectively.
[0037] In the above step (1), the experimental samples were selected from the Wuzhou production area that has obtained the protection of national geographical indication products and were directly supplied by the regular manufacturer Sanhe Liubao Tea Co., Ltd. with SC food production license to ensure reliable and traceable sources. Each sample was attached with a detailed production record file, the year identification was accurate to the production month, the grade classification strictly followed the national standard, and the double scientific evaluation of sensory quality (appearance, soup color, aroma, taste, leaf bottom) and physical and chemical indexes (tea polyphenols, free amino acids, water extract content, etc.) was carried out. This purchase covered 5 categories including special grade in 2015, special grade / first grade / second grade in 2018 and special grade in 2021, achieving multi-dimensional coverage of the year span (2015 - 2021) and grade (from special grade to second grade), fully reflecting the quality characteristics under different aging stages and grade standards, ensuring the authenticity, standardization and typicality of the experimental samples in the year and grade dimensions from the source, and fully meeting the research requirements of the year and grade identification in this experiment. The sample information is shown in Table 1. The sample pretreatment strictly followed the standardized process: First, the tea samples were dried in a constant temperature drying oven at 40°C until the moisture content < 5%, then crushed by a high-speed crusher (rotation speed 20,000 r / min, crushing time 30 s), passed through a 100-mesh sieve (aperture 0.15 mm) to remove coarse particles, and the sifted material was ground in an agate mortar until the particles were uniform. Weighed 200 mg of the ground tea powder and placed it in a customized mold (inner diameter 13 mm), and a pressure of 10 MPa was applied using an electric tablet press (model YP-20T, Shanghai Xinnuo Instruments) for 10 s to obtain a cylindrical thin slice with a thickness of (1.0 ± 0.05) mm. The tablet pressing process was carried out in a constant temperature and humidity environment (25 ± 1°C, relative humidity 45% ± 5%) to ensure uniform internal density of the sample and meet the requirements of terahertz wave transmission detection for the optical consistency of the sample.
[0038] Table 1 Experimental sample information
[0039]
[0040] In the above step (2), the prepared Liubao tea samples were detected using the terahertz time-domain spectroscopy system CCT-1800 produced by China Huaxun Fangzhou Technology Co., Ltd. The system schematic diagram of CCT-1800 is as Figure 2As shown in the figure. The system consists of four parts: a femtosecond laser, a time delay control module, a terahertz generation device, and a detection device. The working principle is as follows: The 780nm laser pulse emitted by the femtosecond laser is divided into two paths, the pump light and the probe light, by a beam splitter. Among them, the pump light is incident on the transmitting antenna, and a terahertz pulse is generated under the excitation of a bias voltage. This pulse is focused by an off-axis parabolic mirror and then irradiates the experimental sample. The terahertz signal carrying the sample information is reflected by a parabolic mirror of the same type and converges with the probe light to the receiving antenna together. The receiving antenna transmits the processed signal to the computer, and finally the terahertz time-domain spectroscopic data of the sample is obtained. To eliminate the absorption interference of water vapor on terahertz waves, dry nitrogen needs to be introduced into the sample experimental chamber before the experiment, and the relative humidity in the chamber is controlled below 2% to ensure the accuracy of data acquisition.
[0041] The terahertz time-domain spectrum measured by the terahertz time-domain spectroscopy system is as Figure 3 shown. The figure shows the average time-domain spectra of five different-year and -grade Liubao teas in the 0-30 ps frequency band. Analysis shows that the waveform and amplitude levels of the time-domain spectra of all samples are extremely similar and there are no obvious differences. This indicates that the terahertz spectral characteristics of Liubao teas of different years and grades are slightly different, and it is difficult to effectively distinguish them only by visual observation. Therefore, machine learning methods need to be combined to achieve efficient and accurate identification of their years and grades.
[0042] In step (3) above, the obtained data set is divided into a training set and a test set, and a multi-task customized gating discrimination model is constructed. The model adopts a collaborative design of a shared expert module and a task-specific expert module: The shared expert module uses a multi-layer convolutional structure to extract the global common features of the input data; the task-specific expert module adopts a two-stage convolutional structure based on SpectralConv2D, swish activation, ReLU, BatchNormalization, MaxPooling, and Dropout for the year and grade tasks respectively, and a TaskSpecificAttention layer is connected to the end of each to extract task-specific features, so as to achieve feature decoupling and improve the cross-task judgment ability of the model. Its expression is:
[0043] u it =tanh(Wx + b)
[0044]
[0045] Output = x × a it
[0046] where x is the input feature, W is the task-specific weight matrix, b is the bias vector, and u is the task-specific attention vector. The t-SNE dimensionality reduction visualization of the original feature and the feature after attention processing is as Figure 4 、Figure 5 As shown. Observe Figure 4 the t-SNE dimensionality reduction map of the original data. It can be seen that due to the relatively similar physical and chemical properties contained in the spectral signals, the tea samples show strong mixing in the two-dimensional feature space, which makes the scatter points marked by year and grade interweave and overlap, indicating that the original signal itself fails to effectively capture the features for distinguishing the subtle differences between tasks. Observe Figure 5 the t-SNE dimensionality reduction map after attention processing. The results show that the feature clustering is more obvious. The features after attention processing show an obvious clustering structure in the two-dimensional space. The data points corresponding to different grades are clustered into relatively compact clusters, and the data points of different years also show a hierarchical distribution in the figure. Overall, the task decoupling effect is significant. The attention mechanism makes the data with the same task attributes closer in the feature space, while separating the features of different tasks, reducing the overlap between data, and contributing to the realization of subsequent joint classification tasks.
[0047] The outputs of each expert module are dynamically weighted and fused through a customized gating fusion mechanism. The fusion strategy adopts a learnable fusion weight w f and the weighted adjustment of the gating signal g and 1×1 convolution to dynamically fuse the shared and task-specific features in an appropriate proportion, enabling the model to utilize global information while retaining the uniqueness of each task, thereby improving the overall recognition rate. The fusion expression is:
[0048] F gated = Conv 1×1 (w f ·(g⊙F shared )+(1 - w f )·((1 - g)⊙F task ))
[0049] Each task branch consists of a fully connected layer. After global average pooling, a fully connected layer activated by ReLU is used for feature transformation, and the final output layer uses the activation function softmax to generate the results of specific tasks.
[0050] The output of the fully connected layer can be expressed as
[0051] y = f(Wx + b)
[0052] where x is the input vector, W is the weight matrix, b is the bias vector, and f is the softmax activation function.
[0053] In step (4) above, a multi-task loss function is constructed and combined with the improved hippopotamus optimization algorithm (IHOA) to optimize the weights. This algorithm realizes cross-task weight adjustment through the following steps: ① Randomly generate a population of candidate weights; ② Calculate the fitness for each candidate weight w, and the fitness evaluation formula is
[0054] L(w) = w grade ·L grade + w year ·L year
[0055] where L grade and L year are the cross - entropy losses of the level and year tasks respectively, and w grade and w year are the loss weights of the level and year tasks respectively, and their sum is 1; ③ Iteratively update the candidate weights using stochastic update, local development, and predator strategy until the optimal weights are selected; and introduce the above - mentioned optimal weights into the multi - task loss. To further promote the decoupling of task - specific features, a feature separation loss is added in the model construction stage. By calculating the L2 distance and their respective variances between the outputs of the task - specific attention layers, a loss function reflecting the similarity between tasks and the internal distribution differences is formed, thereby actively promoting the decoupling of task - specific features from each other during the training process to ensure a balance between information sharing and discrimination in the multi - task model. Finally, the total loss function simultaneously considers the basic losses of the level task and year task and the additional loss that promotes the decoupling of task - specific features, effectively achieving a balance between information sharing and task discrimination. Its calculation formula is
[0056] D inter = mean(||A grade - A year ||)
[0057]
[0058] L total = w grade ·L grade + w year ·L year + L sep
[0059] where A grade and A year represent the feature outputs extracted from the level and year task - specific attention layers respectively. Var(A grade ) and Var(A year ) represent the variances of the vectors, reflecting the degree of dispersion of the internal feature distributions of each task. ~ is a small constant to prevent division by zero.
[0060] In step (5) above, 80% of the data is randomly selected from the Liubao tea time - domain spectral dataset as the training set and input into the constructed multi - task customized gating discrimination model for training to obtain the best classification discrimination model.
[0061] In step (6) above, 20% of the remaining data in the time-domain spectral dataset of Liubao tea of different years and grades is used as the test set and input into the trained model for classification and identification, and the identification results are output. At the same time, separate models are built for the year and grade tasks. A basic network isomorphic to the shared expert module of the multi-task model is adopted, but the task-specific expert and gating fusion structure are removed. The same input data preprocessing process, number of iterations, batch size, learning rate, and optimizer configuration are used. All the output results are shown in Table 2. Figure 6 It is the confusion matrix of the classification results of the single-task and multi-task classification models. The experimental results show that the identification accuracies of the single-task models are only 88.89% and 84.72%, and the corresponding F1-scores are lower than 88.35% and 84.57% respectively. At the same time, when the single-task model processes categories with a small number of samples, due to the data imbalance problem, overfitting or bias is likely to occur, resulting in obvious deficiencies in the recognition accuracy of some categories, thus affecting the overall performance.
[0062] In contrast, the multi-task control gating identification model (Year-GradeAttention-IHOACGC) realizes global information sharing and specific feature decoupling by constructing a shared expert module and a task-specific expert module, extracts the global common information of the entire dataset in the initial layer, and forms a more robust feature representation. Even if there is data imbalance in a certain task, the shared features can supplement information for categories with less data, alleviating the problem of insufficient samples. At the same time, a customized gating fusion mechanism is adopted to balance the global commonality and task uniqueness, and the improved hippopotamus optimization algorithm (IHOA) is combined to automatically adjust the loss weights to ensure stable learning when the data is imbalanced. The experimental data shows that the accuracy and F1-score of this model both reach 100% in the year and grade tasks, and all categories in the confusion matrix are perfectly distinguished without misjudgment.
[0063] Table 2 Classification results of the model before and after improvement
[0064]
[0065] To sum up, the multi-task control gating identification model not only comprehensively surpasses the single-task model in terms of overall accuracy and F1-score, but also shows significant advantages in dealing with data imbalance, especially in the identification of categories with fewer samples. This fully demonstrates the superiority of the multi-task joint control gating identification method in cross-task information sharing, feature decoupling, and dynamic optimization, providing an efficient, robust, and highly practical technical solution for the quality detection of Liubao tea.
[0066] The above embodiments are only used to exemplarily illustrate the technical solutions of the present invention and do not constitute a limitation on the specific implementation manners. Although the preferred embodiments have been described in detail, those skilled in the art should understand that: without departing from the inventive concept and the protection scope of the present invention, reasonable improvements or equivalent replacements can be made to the technical solutions. Such non-substantive changes made based on the present invention should all be included in the protection scope of the claims of the present invention.
Claims
1. A multi-task control gating discrimination method for the year and grade of Liubao tea based on terahertz spectroscopy, comprising the following steps: (1): Select five Sanhe Liubao teas of the same series with different years and grades as experimental samples. Crush, sieve, and press the Liubao teas of different grades and years to obtain smooth and flat pressed Liubao tea samples. (2): Use a transmission terahertz time-domain spectroscopy system to perform spectral detection on Liubao teas of different years and grades to obtain a time-domain spectral dataset of Liubao teas of different years and grades. (3): Divide the dataset into a training set and a test set, and construct a multi-task customized gating discrimination model for the year and grade of Liubao tea. (4): Construct a multi-task loss function and optimize the weight update in combination with the HO algorithm. (5): Input the time-domain spectral data of the training set samples of Liubao teas of different years and grades into the multi-task customized gating discrimination model for training. (6): Input the time-domain spectral dataset of the Liubao tea to be discriminated into the trained model for discrimination, and output the discrimination results, and compare these results with the test results of classifying the year and grade respectively using a single-task neural network model.
2. The multi-task control gating discrimination method for the year grade of Liubao tea based on terahertz spectroscopy according to claim 1, wherein, In step (1) above, the experimental samples are selected from the Wuzhou production area protected by the national geographical indication product. They are directly supplied by the regular Sanhe Liubao tea production enterprise with SC food production license to ensure reliable and traceable sources. Each sample is attached with a detailed production record file. The year identification is accurate to the production month, and the grade division strictly follows the national standard. It is scientifically evaluated by double sensory qualities (appearance, soup color, aroma, taste, leaf bottom) and physical and chemical indicators (tea polyphenols, free amino acids, water extract content, etc.). This purchase covers 5 categories including super grade in 2015, super grade / first grade / second grade in 2018, and super grade in 2021, realizing multi-dimensional coverage of the year span (2015 - 2021) and grade (from super grade to second grade), fully reflecting the quality characteristics under different aging stages and grade standards, and ensuring the authenticity, standardization, and typicality of the experimental samples in the year and grade dimensions from the source, fully meeting the research needs of this experiment for year and grade discrimination. The sample pretreatment strictly follows the standardized process: First, dry the tea leaf samples in a constant temperature drying oven at 40°C until the moisture content <5%. After crushing with a high-speed crusher (rotation speed 20000r / min, crushing time 30s), sieve through a 100-mesh sieve (aperture 0.15mm) to remove coarse particles. The material under the sieve is ground in an agate mortar until the particles are uniform. Weigh 200mg of the ground tea powder and place it in a customized mold (inner diameter 13mm), and apply a pressure of 10MPa with an electric tablet press (model YP-20T, Shanghai Xinnuo Instruments) and keep the pressure for 10s to obtain a cylindrical thin slice with a thickness of (1.0 ± 0.05)mm. The tablet pressing process is carried out in a constant temperature and humidity environment (25 ± 1°C, relative humidity 45% ± 5%) to ensure uniform internal density of the sample and meet the requirements of the terahertz wave transmission detection for the optical consistency of the sample.
3. A multi-task controlled gating discrimination method for the year level of Liubao tea based on terahertz spectroscopy according to claim 1, characterized in that In step (2) above, the CCT-1800 terahertz time-domain spectroscopy system of China Huaxun Ark Technology Co., Ltd. is used to detect the Liubao tea samples. Through the transmission terahertz time-domain spectroscopy system, the spectral data of Liubao tea of different years and grades are collected. The system obtains spectral data through the following process: First, the femtosecond laser pulse is split into two paths, the pump pulse and the probe pulse, by a beam splitter; after being regulated by the time delay module, the pump pulse is incident on the terahertz radiation generating device to excite terahertz pulses; At the same time, the probe pulse and the terahertz pulse carrying sample information are collinearly transmitted to the terahertz detection device, which drives the device to complete signal acquisition and transmits the data to the computer in real time, and finally constructs a time-domain spectral dataset of Liubao tea of different years and grades.
4. A multi-task control gating discrimination method for the year grade of Liubao tea based on terahertz spectroscopy according to claim 1, characterized in that, In step (3) above, the obtained dataset is divided into a training set and a test set, and a multi-task customized gated discriminant model is constructed. The model is collaboratively designed with a shared expert module and a task-specific expert module: the shared expert module uses a multi-layer convolutional structure to extract the global common features of the input data; The task-specific expert module respectively adopts a two-stage convolutional structure based on SpectralConv2D, swish activation, ReLU, BatchNormalization, MaxPooling and Dropout for the year and grade tasks, and a TaskSpecificAttention layer is connected to the end of each to extract task-specific features, so as to achieve feature decoupling and improve the cross-task judgment ability of the model. Its expression is: u it = tanh(Wx + b) Output = x × a it where x is the input feature, W is the task-specific weight matrix, b is the bias vector, and u is the task-specific attention vector. The outputs of each expert module are dynamically weighted and fused through a customized gating fusion mechanism. The fusion strategy uses a learnable fusion weight w f and the weighted adjustment of the gating signal g and the 1×1 convolution to dynamically fuse the shared and task-specific features in an appropriate proportion, enabling the model to utilize global information while retaining the uniqueness of each task, thereby improving the overall recognition rate. The fusion expression is: F gated = Conv 1×1 (w f ·(g⊙F shared )+(1 - w f )·((1 - g)⊙F task )) Each task branch is composed of fully - connected layers. After global average pooling, a fully - connected layer with ReLU activation is used for feature transformation, and the final output layer uses the softmax activation function to generate the results of a specific task. The output of the fully - connected layer can be expressed as y = f(Wx + b) where x is the input vector, W is the weight matrix, b is the bias vector, and f is the softmax activation function.
5. A multi-task control gating discrimination method for the year grade of Liubao tea based on terahertz spectroscopy according to claim 1, characterized in that In the above step (4), a multi-task loss function is constructed and the weights are optimized by combining the Improved Hippopotamus Optimization Algorithm (IHOA). This algorithm realizes cross-task weight adjustment through the following steps: ① Randomly generate a candidate weight population; ② Calculate the fitness for each candidate weight w, and the fitness evaluation formula is L(w) = w grade ·L grade +w year ·L year where L grade and L year are the cross-entropy losses of the level and year tasks respectively, and w grade and w year are the loss weights of the level and year tasks respectively, and their sum is 1; ③ Iteratively update the candidate weights using stochastic update, local development, and predator strategies until the optimal weights are selected; and introduce the above optimal weights into the multi-task loss. To further promote the decoupling of task-specific features, a feature separation loss is added during the model construction phase. By calculating the L2 distance and their respective variances between the outputs of the task-specific attention layers, a loss function reflecting the similarity between tasks and the difference in internal distributions is formed, thereby actively promoting the decoupling of task-specific features from each other during the training process and ensuring a balance between information sharing and discrimination in the multi-task model. Finally, the total loss function simultaneously considers the basic losses of the level task and the year task, as well as the additional loss that promotes the decoupling of task-specific features, effectively achieving a balance between information sharing and task discrimination. Its calculation formula is D inter = mean(||A grade - A year ||) L total = w grade ·L grade + w year ·L year + L sep Among them, A grade and A year respectively represent the feature outputs extracted from the level and year task-specific attention layers. Var(A grade ) and Var(A year ) represent the variance of the vectors, reflecting the degree of dispersion of the internal feature distributions of each task. ∈ is a small constant to prevent division by zero.
6. A method for multi-task controlled gating discrimination of the year level of Liubao tea based on terahertz spectroscopy according to claim 1, characterized in that, In step (5) above, 80% of the data is randomly selected from the Liubao tea time-domain spectral dataset as the training set and input into the constructed multi-task customized gated discriminant model for training to obtain the best classification and discrimination model.
7. A method for multi-task control gated discrimination of the year grade of Liubao tea based on terahertz spectroscopy according to claim 1, characterized in that In step (6) above, the remaining 20% of the data in the Liubao tea time-domain spectral dataset of different years and grades is used as the test set and input into the trained model for classification and discrimination, and the discrimination results are output, and these results are compared with the test results of using a single-task neural network model for year and grade classification respectively.