A tea processing state intelligent detection method and system based on knowledge distillation
By using a knowledge distillation method that dynamically adjusts the temperature coefficient and employs a periodic review strategy, the learning ability of the student model is optimized. This solves the problem of limited learning ability caused by a fixed temperature coefficient in traditional methods, and enables efficient and automated detection of tea processing status.
Patent Information
- Application Number
- CN202411960414.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Traditional knowledge distillation methods for detecting the processing status of tea use a fixed temperature coefficient, which cannot adapt to the dynamic changes in task complexity during training, thus limiting the learning ability of student models.
A knowledge distillation method with dynamic temperature coefficient adjustment and periodic review strategy was adopted. Teacher and student models were constructed using ResNet-110 and Vision Transformer image classification models. Historical image data of tea leaves during the withering and rolling processes were used for training to optimize the learning ability of the student model.
While maintaining high precision, it can efficiently identify the rolling and fixing state of tea leaves, significantly improving the automation level of the processing.
Smart Images

Figure CN119888717B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of tea processing status detection, and particularly relates to an intelligent detection method and system for tea processing status based on knowledge distillation. Background Technology
[0002] Rolling and fixing are two crucial steps in tea processing, directly impacting the tea's internal and external quality. Traditional methods rely on manual judgment, which is inefficient and highly susceptible to subjective factors. In recent years, deep learning methods based on image recognition have been gradually applied to tea processing inspection; however, high-performance neural networks typically come with high computational costs and complex deployment.
[0003] Knowledge distillation is a model compression technique that achieves a balance between performance and resource consumption by transferring knowledge from a pre-trained teacher model to a lightweight student model. However, traditional knowledge distillation methods often use a fixed temperature coefficient, which cannot adapt to the dynamic changes in task complexity during training, thus limiting the learning ability of the student model. Summary of the Invention
[0004] To address the aforementioned shortcomings in existing technologies, this invention provides an intelligent detection method and system for tea processing status based on knowledge distillation. This solves the problem that traditional knowledge distillation methods often use a fixed temperature coefficient, which cannot adapt to the dynamic changes in task complexity during training, thus limiting the learning ability of student models.
[0005] To achieve the aforementioned objectives, the technical solution adopted by this invention is: an intelligent detection method for tea processing status based on knowledge distillation, comprising:
[0006] Acquire historical image data of tea leaves during the withering and rolling processes;
[0007] The historical image data of tea leaves in the fixation state and the historical image data of tea leaves in the rolling state were cropped and normalized respectively to obtain the training set of tea leaves in the fixation state and the training set of tea leaves in the rolling state.
[0008] A teacher model, a student model for detecting the withering state of tea leaves, and a student model for detecting the rolling state of tea leaves were constructed using an image classification model, respectively. Then, using the tea withering state training set and the tea rolling state training set, knowledge distillation training was performed on the student models for detecting the withering state of tea leaves and the student models for detecting the rolling state of tea leaves, respectively, to obtain the tea withering state detection model and the tea rolling state detection model.
[0009] The process involves acquiring images of tea leaves in the withering stage and using a tea withering detection model to determine their withering state; and acquiring images of tea leaves in the rolling stage and using a tea rolling detection model to determine their rolling state.
[0010] Furthermore, the teacher model uses the ResNet-110 image classification model; the student model used for detecting the tea leaf withering state uses the ResNet-50 image classification model; and the student model used for detecting the tea leaf rolling state uses the Vision Transformer image classification model.
[0011] Furthermore, the temperature parameter for the knowledge distillation training is a dynamically adjusted parameter:
[0012]
[0013] Among them, t n E represents the temperature value in the nth iteration. n E represents the current training round count. loops Hyperparameters for controlling the learning cycle and increasing difficulty.
[0014] Furthermore, the loss function for the knowledge distillation training is:
[0015] L=αL task +βL kd
[0016] Where L is the loss function for knowledge distillation training; α is the image classification loss weight; L task β is the image classification loss; L is the knowledge distillation loss weight; kd This is due to knowledge distillation loss.
[0017] Furthermore, the parameter update formula for the knowledge distillation training is as follows:
[0018]
[0019] Among them, new.θ stu The updated parameters for the student model; θ stu The parameters are those of the student model before the update; η is the learning rate; new.Φ temp The updated parameters for the teacher model; Φ temp represents the parameters of the teacher model before updating; L is the loss function for knowledge distillation training.
[0020] The beneficial effects of this invention are as follows: By dynamically adjusting the temperature coefficient and employing a periodic review strategy to optimize student model training, the student model maintains high accuracy while remaining lightweight, and can efficiently identify the rolling and withering states of tea leaves. During distillation training, the temperature parameters are dynamically adjusted according to the training rounds, gradually improving the student model's adaptability to complex tasks while avoiding the training limitations caused by fixed temperatures. The dynamic knowledge distillation method is applied to mainstream deep learning models such as ViT (VisionTransformer) and ResNet, compressing them into lightweight student models suitable for deployment on edge devices.
[0021] This invention provides an intelligent detection system for tea processing status, including a data acquisition module, a data preprocessing module, a knowledge distillation module, a temperature control module, and a status detection module;
[0022] The data acquisition module is used to collect historical image data of tea leaves in the fixation state, historical image data of tea leaves in the rolling state, images of tea leaves to be tested in the fixation state, and images of tea leaves to be tested in the rolling state.
[0023] The data preprocessing module is used to perform image cropping and normalization on historical image data of tea leaves in the fixation state, historical image data of tea leaves in the rolling state, images of tea leaves to be detected in the fixation state and images of tea leaves to be detected in the rolling state, respectively, to obtain training sets of tea leaves in the fixation state, training sets of tea leaves in the rolling state, preprocessed images of tea leaves to be detected in the fixation state and preprocessed images of tea leaves to be detected in the rolling state.
[0024] The knowledge distillation module is used to construct a teacher model, a student model for detecting the tea's withering state, and a student model for detecting the tea's rolling state based on an image classification model. It then uses the tea withering state training set and the tea rolling state training set to perform knowledge distillation training on the student model for detecting the tea withering state and the student model for detecting the tea rolling state, respectively, to obtain the tea withering state detection model and the tea rolling state detection model.
[0025] The temperature control module is used to dynamically adjust the temperature parameters during the knowledge distillation training process;
[0026] The state detection module is used to detect the pre-processed image of the tea leaves to be detected in the state of tea leaf fixation using a tea leaf fixation state detection model to obtain the tea leaf fixation state; and to detect the pre-processed image of the tea leaves to be detected in the state of tea leaf rolling using a tea leaf rolling state detection model to obtain the tea leaf rolling state.
[0027] The beneficial effects of this invention are as follows: By dynamically adjusting the temperature coefficient and employing a periodic review strategy to optimize student model training, the student model maintains high accuracy while remaining lightweight, and can efficiently identify the rolling and fixing states of tea leaves. During distillation training, temperature parameters are dynamically adjusted according to the training rounds, gradually improving the student model's adaptability to complex tasks while avoiding the training limitations caused by fixed temperatures. This system can efficiently identify the rolling and fixing states of tea leaves, significantly improving the automation level of the processing. Attached Figure Description
[0028] Figure 1 This is a flowchart of the method of the present invention.
[0029] Figure 2 This is a system structure diagram of the present invention. Detailed Implementation
[0030] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0031] Example 1
[0032] like Figure 1 As shown, in one embodiment of the present invention, a method for intelligent detection of tea processing status based on knowledge distillation includes:
[0033] Acquire historical image data of tea leaves during the withering and rolling processes;
[0034] The historical image data of tea leaves in the fixation state and the historical image data of tea leaves in the rolling state were cropped and normalized respectively to obtain the training set of tea leaves in the fixation state and the training set of tea leaves in the rolling state.
[0035] A teacher model, a student model for detecting the withering state of tea leaves, and a student model for detecting the rolling state of tea leaves were constructed using an image classification model, respectively. Then, using the tea withering state training set and the tea rolling state training set, knowledge distillation training was performed on the student models for detecting the withering state of tea leaves and the student models for detecting the rolling state of tea leaves, respectively, to obtain the tea withering state detection model and the tea rolling state detection model.
[0036] The process involves acquiring images of tea leaves in the withering stage and using a tea withering detection model to determine their withering state; and acquiring images of tea leaves in the rolling stage and using a tea rolling detection model to determine their rolling state.
[0037] The teacher model uses the ResNet-110 image classification model; the student model used for detecting the tea's withering state uses the ResNet-50 image classification model; and the student model used for detecting the tea's rolling state uses the Vision Transformer image classification model.
[0038] The temperature parameter for the knowledge distillation training is a dynamically adjusted parameter.
[0039]
[0040] Among them, t n E represents the temperature value in the nth iteration. n E represents the current training round count. loops Hyperparameters for controlling the learning cycle and increasing difficulty.
[0041] In this embodiment, during the knowledge distillation process, traditional methods use a fixed temperature to control the learning difficulty of the student model. This invention dynamically adjusts the temperature parameters, allowing the learning difficulty to gradually increase during training and reviewing previous knowledge during the review phase.
[0042] The loss function for the knowledge distillation training is:
[0043] L=αL task +βL kd
[0044] Where L is the loss function for knowledge distillation training; α is the image classification loss weight; L task β is the image classification loss; L is the knowledge distillation loss weight; kd This is due to knowledge distillation loss.
[0045] The parameter update formula for the knowledge distillation training is as follows:
[0046]
[0047] Among them, new.θ stu The updated parameters for the student model; θ stu The parameters are those of the student model before the update; η is the learning rate; new.Φ temp The updated parameters for the teacher model; Φ temp represents the parameters of the teacher model before updating; L is the loss function for knowledge distillation training.
[0048] Example 2
[0049] like Figure 2 As shown, an intelligent detection system for tea processing status includes a data acquisition module, a data preprocessing module, a knowledge distillation module, a temperature control module, and a status detection module.
[0050] The data acquisition module is used to collect historical image data of tea leaves in the fixation state, historical image data of tea leaves in the rolling state, images of tea leaves to be tested in the fixation state, and images of tea leaves to be tested in the rolling state.
[0051] The data preprocessing module is used to perform image cropping and normalization on historical image data of tea leaves in the fixation state, historical image data of tea leaves in the rolling state, images of tea leaves to be detected in the fixation state and images of tea leaves to be detected in the rolling state, respectively, to obtain training sets of tea leaves in the fixation state, training sets of tea leaves in the rolling state, preprocessed images of tea leaves to be detected in the fixation state and preprocessed images of tea leaves to be detected in the rolling state.
[0052] The knowledge distillation module is used to construct a teacher model, a student model for detecting the tea's withering state, and a student model for detecting the tea's rolling state based on an image classification model. It then uses the tea withering state training set and the tea rolling state training set to perform knowledge distillation training on the student model for detecting the tea withering state and the student model for detecting the tea rolling state, respectively, to obtain the tea withering state detection model and the tea rolling state detection model.
[0053] The temperature control module is used to dynamically adjust the temperature parameters during the knowledge distillation training process;
[0054] The state detection module is used to detect the pre-processed image of the tea leaves to be detected in the state of tea leaf fixation using a tea leaf fixation state detection model to obtain the tea leaf fixation state; and to detect the pre-processed image of the tea leaves to be detected in the state of tea leaf rolling using a tea leaf rolling state detection model to obtain the tea leaf rolling state.
[0055] In this embodiment, historical data is acquired by using high-speed cameras, industrial cameras, or other methods to obtain images of the current tea leaves in their withering or rolling state.
[0056] The collected datasets were manually classified and processed to create datasets (hereinafter referred to as tea fixation detection datasets and tea rolling state datasets). For example, the images of tea fixation state were classified as "insufficient fixation", "moderate fixation", and "over-fixation"; and the tea rolling state was classified as "empty rolling", "reduced pressure", "maintained", and "pressurized".
[0057] Data preprocessing module route: The above dataset is used as input to the data preprocessing module. The module calls the relevant functions of the transforms library to perform image cropping (resize) and normalization on the data. The module returns the result, which is the preprocessed data A.
[0058] Knowledge Distillation Module Route: In the knowledge distillation module, the pre-trained model ResNet-110 is used as the teacher model. To achieve accurate predictions for different functions, this module uses two student models: a ResNet-50 model for detecting the tea's withering state and a ViT model for detecting the tea's rolling state. Knowledge distillation is performed on both models, but the distillation method used is consistent. The following only describes the data flow for the withering state (both teacher and student models are single-input, single-output models). Data A is imported as input into both the teacher model ResNet-110 and the student model ResNet-50, and the same training parameters are set for simultaneous training. During training, a temperature control module is used to control the training process, i.e., the temperature adjustment formula described below (adjustment implementation: the fixed temperature coefficient in the traditional knowledge distillation algorithm is set as a dynamic coefficient that changes with the training rounds, using the trigonometric function sin to dynamically adjust the temperature coefficient, as follows). Figure 1 As shown, for example, in the first group of peaks (where each pair is identical), after the training epochs within the first peak range, the output logits of the two models are compared to detect the learning status of the student model. The comparison result is the distillation loss value, which is used to adjust the parameters in both models through forward feedback. In the corresponding training epochs of the second peak, the data learned in the first peak is reviewed again, and the teacher and student models output logits again, and the distillation loss value is calculated again. After comparing the two results in the same group of peaks, the set with the smaller loss is selected as the result of this epoch, and the internal parameters of the model are automatically updated through forward feedback; this is review-based learning. As the number of training epochs increases, the temperature coefficient will increase by a gradient to increase the difficulty (this is progressive growth learning). After the set number of training epochs is completed, a smaller model that is easier to deploy is obtained (saved by saving the relevant parameters of the trained model), namely the student model ResNet-50 and Vit after knowledge distillation.
[0059] State Detection Module Route: This module uses a student model trained by the knowledge distillation module to detect and classify new data. It uses images related to the tea's withering and rolling states as input (images not used in the knowledge distillation training process, hereinafter referred to as Data B). The general process is as follows: Load Data B, crop Data B to obtain Data C; load the ResNet-50 model, import the parameters of the ReKD knowledge distillation-trained ResNet-50 model, input Data B into the ResNet-50 model, and the model outputs the detection result as "insufficient withering," "moderate withering," or "over-withering." The output result is then returned and transmitted to the front-end interface in JSON format.
Claims
1. A method for intelligent detection of tea processing status based on knowledge distillation, characterized in that, include: Acquire historical image data of tea leaves during the withering and rolling processes; The historical image data of tea leaves in the fixation state and the historical image data of tea leaves in the rolling state were cropped and normalized respectively to obtain the training set of tea leaves in the fixation state and the training set of tea leaves in the rolling state. A teacher model, a student model for detecting the withering state of tea leaves, and a student model for detecting the rolling state of tea leaves are constructed using an image classification model. Then, using training sets for the withering and rolling states of tea leaves, knowledge distillation training is performed on the student models for detecting the withering and rolling states of tea leaves, respectively, to obtain the tea withering state detection model and the tea rolling state detection model. The temperature parameter for the knowledge distillation training is a dynamically adjusted parameter. in, For the first Temperature value of the next iteration; This represents the current training round number. Hyperparameters for controlling the learning cycle and increasing difficulty; The process involves acquiring images of tea leaves in the withering stage and using a tea withering detection model to determine their withering state; and acquiring images of tea leaves in the rolling stage and using a tea rolling detection model to determine their rolling state.
2. The intelligent detection method for tea processing status based on knowledge distillation according to claim 1, characterized in that, The teacher model uses the ResNet-110 image classification model; the student model used for detecting the tea's withering state uses the ResNet-50 image classification model; and the student model used for detecting the tea's rolling state uses the VisionTransformer image classification model.
3. The intelligent detection method for tea processing status based on knowledge distillation according to claim 1, characterized in that, The loss function for the knowledge distillation training is: in, The loss function for knowledge distillation training; Image classification loss weights; Image classification loss; Weighting the loss for knowledge distillation; This is due to knowledge distillation loss.
4. The intelligent detection method for tea processing status based on knowledge distillation according to claim 1, characterized in that, The parameter update formula for the knowledge distillation training is as follows: in, The updated parameters for the student model; The parameters before updating the student model; The learning rate; These are the updated parameters for the teacher model; These are the parameters before the teacher model was updated; Let be the loss function for knowledge distillation training.
5. A tea processing status intelligent detection system that implements the knowledge-based distillation intelligent detection method for tea processing status as described in any one of claims 1-4, characterized in that, It includes a data acquisition module, a data preprocessing module, a knowledge distillation module, a temperature control module, and a status detection module; The data acquisition module is used to collect historical image data of tea leaves in the fixation state, historical image data of tea leaves in the rolling state, images of tea leaves to be tested in the fixation state, and images of tea leaves to be tested in the rolling state. The data preprocessing module is used to perform image cropping and normalization on historical image data of tea leaves in the fixation state, historical image data of tea leaves in the rolling state, images of tea leaves to be detected in the fixation state and images of tea leaves to be detected in the rolling state, respectively, to obtain training sets of tea leaves in the fixation state, training sets of tea leaves in the rolling state, preprocessed images of tea leaves to be detected in the fixation state and preprocessed images of tea leaves to be detected in the rolling state. The knowledge distillation module is used to construct a teacher model, a student model for detecting the tea's withering state, and a student model for detecting the tea's rolling state based on an image classification model. It then uses the tea withering state training set and the tea rolling state training set to perform knowledge distillation training on the student model for detecting the tea withering state and the student model for detecting the tea rolling state, respectively, to obtain the tea withering state detection model and the tea rolling state detection model. The temperature control module is used to dynamically adjust the temperature parameters during the knowledge distillation training process; The state detection module is used to detect the pre-processed image of the tea leaves to be detected in the state of tea leaf fixation using a tea leaf fixation state detection model to obtain the tea leaf fixation state; and to detect the pre-processed image of the tea leaves to be detected in the state of tea leaf rolling using a tea leaf rolling state detection model to obtain the tea leaf rolling state.
Citation Information
Patent Citations
Tea leaf classification method
CN114283303A
Metalearning knowledge distillation method and system based on adaptive dynamic temperature
CN118070888A