Lightweight black tea fermentation degree discrimination method and system, and storage medium
Through convolutional neural network and knowledge distillation technology, a lightweight black tea fermentation degree judgment system is built, which solves the problem that black tea fermentation degree judgment depends on manual experience, and realizes intelligent and standardized production of black tea processing.
Patent Information
- Application Number
- CN202410794608.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-06-19
AI Technical Summary
The determination of the degree of fermentation of black tea depends on artificial experience, which leads to high arbitraryness and strong subjectivity, affecting production quality and market value, and being unable to achieve standardized production.
The convolutional neural network discrimination model is adopted, combined with the knowledge distillation technology of the student model and the teacher model, and Focal Loss is used to replace CrossEntropy Loss, and knowledge distillation is carried out through the Masked Generative Distillation method to build a lightweight black tea fermentation degree discrimination system to realize automated judgment.
It realizes intelligent and accurate judgment of the degree of black tea fermentation, get rid of the arbitrary and subjective nature of manual judgment, improves production standardization, and promotes the intelligent processing of black tea.
Smart Images

Figure CN118885778A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of tea production and processing, and in particular to a method, system and storage medium for distinguishing the fermentation degree of lightweight black tea. Background Art
[0002] Black tea is one of the most popular beverages in the world, accounting for 78% of global tea consumption. Its processing includes four steps: withering, rolling, fermentation and drying. Fermentation is the most critical step in the black tea processing process, which is closely related to the color and taste of black tea. Insufficient or excessive fermentation will affect the quality of black tea, and then affect the market value of black tea. Therefore, it is particularly important to control the fermentation time of black tea and accurately judge its fermentation degree during the black tea processing.
[0003] At present, in actual production and processing, the determination of the fermentation degree of black tea is completely dependent on manual experience. Processors usually use "looking at the color, smelling the odor, and touching the hand" to determine the fermentation degree of black tea. This judgment method lacks quantitative evaluation standards. The operator's experience, psychological state, environment and other factors will affect the evaluation results. It is more arbitrary and subjective, resulting in inconsistent production quality of black tea and the inability to achieve standardized production. Therefore, accurately determining the fermentation degree of black tea is a major problem in realizing intelligent black tea processing. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a lightweight black tea fermentation degree judgment method, system and storage medium, which can intelligently and accurately judge the fermentation degree of black tea, avoiding the problems of arbitrariness and subjectivity caused by manual judgment.
[0005] In order to achieve the above technical objectives, the technical solutions adopted in this application are as follows:
[0006] In a first aspect, the present application provides a method for determining the fermentation degree of lightweight black tea, comprising the following steps:
[0007] Create and partition a dataset containing black tea fermentation at multiple moments;
[0008] Select N1 convolutional neural network discriminant models;
[0009] The experimental results of training the selected N1 convolutional neural network discriminant model are obtained. Based on the experimental results, the student model and the teacher model are comprehensively selected while meeting the requirements of high accuracy and light weight.
[0010] Replace the loss function for both the selected student model and the teacher model;
[0011] Use the knowledge distillation of the teacher model after changing the loss function to change the student model after the loss function;
[0012] Compare the detection and discrimination effects.
[0013] Furthermore, the method for producing and dividing a data set containing black tea fermentation at multiple moments includes obtaining N2 original images of black tea fermentation; rotating, mirroring, adding noise and cropping operations to the obtained original images, and expanding the data of the original images, wherein the data volume is expanded from the original N2 images to an integer multiple of N2 images; and dividing the data set into a training set, a validation set and a test set at a ratio of 6:2:2 to generate the data set.
[0014] Furthermore, in the production and division of the data set containing black tea fermentation at multiple moments, the data set uses a data set containing black tea fermentation at six moments: 0h, 1h, 2h, 3h, 4h, and 5h.
[0015] Furthermore, the N1 convolutional neural network discriminant models selected for the training, based on experimental results, comprehensively select student models and teacher models while meeting the requirements of high precision and lightweight, including using CUDA software acceleration and AdamW optimizer to optimize the model, training 200 epochs, and obtaining experimental results of N1 convolutional neural network discriminant models; based on the experimental results, while meeting the lightweight requirement, comprehensively select Shufflenet_v2_x1.0 as the student model and Efficientnet_v2 as the teacher model.
[0016] Furthermore, the method of simultaneously replacing the loss function of the selected student model and the teacher model includes replacing the loss function of the student model, replacing the CrossEntropy Loss with the Focal Loss, and training the student model after the loss function is replaced;
[0017] The loss function of the teacher model is changed, CrossEntropy Loss is replaced by Focal Loss, and the teacher model with the changed loss function is trained.
[0018] Further, the method of using the knowledge distillation of the teacher model after the loss function is changed to replace the student model after the loss function includes performing a distillation experiment on Shufflenet_v2_x1.0 after the loss function is changed by using a plurality of knowledge distillation methods including Masked Generative Distillation;
[0019] By comparing the experimental results of various knowledge distillation methods, the model with a Distillation Loss ratio of 0.8 and distilled using the Masked Generative Distillation method has the best discrimination performance. The discrimination performance of the model is effectively improved without increasing the number of parameters and the amount of calculation.
[0020] Furthermore, distillation experiments were performed when the Distillation Loss ratio was 0.6, 0.7, 0.8, and 0.9, respectively.
[0021] Furthermore, the knowledge distillation method includes four knowledge distillation methods: Soft Target Knowledge Distillation method, Masked Generative Distillation method, Similarity-Preserving Knowledge Distillation method and Attention Transfer method. In this technical solution, Soft Target Knowledge Distillation is referred to as ST; Masked Generative Distillation is referred to as MGD; Similarity-Preserving Knowledge Distillation is referred to as SPKD; Attention Transfer is referred to as AT.
[0022] In a second aspect, the present invention also discloses a lightweight black tea fermentation degree identification system, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the identification system executes the method described above to calculate the fermentation degree of the black tea.
[0023] In a third aspect, the present invention further discloses a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed on a computer, the computer executes the above method.
[0024] The invention adopting the above technical solution has the following advantages:
[0025] 1. The present invention compares the experimental results of various convolutional neural networks, and selects Shufflenet_v2_x1.0 as the student model and Efficientnet_v2 as the teacher model under the requirements of accuracy and lightweight; and uses the loss function Focal Loss to replace CrossEntropy Loss, so that the discrimination performance of the teacher model and the student model is improved, so that the method of the present invention can intelligently and accurately judge the fermentation degree of black tea, get rid of the artificial judgment methods such as "looking at the color, smelling the odor, and touching the feel", which are more arbitrary and subjective, solves the problem of low performance of the actual deployed hardware, realizes the standardized production of black tea, and promotes the intelligent processing of black tea.
[0026] 2. In the present invention, when the Distillation Loss ratio is 0.6, 0.7, 0.8 and 0.9 respectively, four knowledge distillation methods, namely, Soft Target Knowledge Distillation method, Masked Generative Distillation method, Similarity-Preserving Knowledge Distillation method and Attention Transfer method, are used to perform knowledge distillation on the student model. When the Distillation Loss ratio is 0.8, the model after distillation using the Masked Generative Distillation method has the best discrimination performance, which improves the ability to discriminate the fermentation degree of black tea. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The present application may be further described by the non-limiting embodiments given in the accompanying drawings. It should be understood that the following drawings only illustrate certain embodiments of the present application and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings may be obtained based on these drawings without creative effort.
[0028] Figure 1 The present invention is a flowchart of the steps of Example 1 of a method for determining the fermentation degree of lightweight black tea.
[0029] Figure 2 This is the basic unit diagram of Shu enet v2.
[0030] Figure 3 This is a comparison chart of the confusion matrix of the model before and after improvement.
[0031] Figure 4 Visualize the heatmap of the model before and after improvement.
[0032] Figure 5 This is a comparison chart of the model discrimination effect before and after improvement. DETAILED DESCRIPTION
[0033] The present application will be described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that in the drawings or descriptions of the specification, similar or identical parts use the same figure numbers, and the implementation methods not shown or described in the drawings are forms known to ordinary technicians in the technical field. In the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0034] Embodiment 1,
[0035] This embodiment is a method for determining the fermentation degree of lightweight black tea. The method flow is as follows: Figure 1 As shown, the specific steps are as follows:
[0036] S1, create and divide the data set containing six moments of black tea fermentation: 0h, 1h, 2h, 3h, 4h, and 5h.
[0037] Specifically, step 1 includes the following sub-steps:
[0038] Step 1.1, obtaining black tea fermentation images, using a Canon camera to obtain 187 black tea fermentation images;
[0039] Step 1.2, rotate, mirror, add noise and crop the 187 original images, and expand the original image data from 187 to 3740;
[0040] Step 1.3, divide the data set into training set, validation set, and test set in a ratio of 6:2:2 to generate the required data set.
[0041] S2, selects 12 mainstream convolutional neural network discriminant models, as shown in Table 1.
[0042] S3, trains the selected 12 convolutional neural network discriminant models, and comprehensively selects the student model and the teacher model based on the experimental results while meeting the requirements of high precision and lightweight.
[0043] Specifically, step 3 includes the following sub-steps:
[0044] Step 3.1, use CUDA software acceleration, AdamW optimizer to optimize the model, train 200 epochs, and obtain 12 convolutional neural network discrimination models. The following Table 1 shows the discrimination effects of the 12 convolutional neural networks;
[0045] Table 112 Convolutional Neural Network Discrimination Effects
[0046]
[0047] Step 3.2: Based on the experimental results of step 3.1, under the condition of lightweight, Figure 2 As shown, Shufflenet_v2_x1.0 is selected as the student model and Efficientnet_v2 is selected as the teacher model;
[0048] Table 2 Overall architecture of Shufflenet_v2_x1.0
[0049]
[0050] S4, replace the loss function of the selected student model and the teacher model at the same time.
[0051] Specifically, step 4 includes the following sub-steps:
[0052] Step 4.1, replace the loss function of the student model, replace CrossEntropy Loss with Focal Loss, and train the student model after the loss function is changed;
[0053] Step 4.2, replace the loss function of the teacher model, replace CrossEntropy Loss with Focal Loss, and train the teacher model after the loss function is changed;
[0054] Table 3 Results of replacing loss function
[0055]
[0056] S5, uses the knowledge distillation of the teacher model after changing the loss function to change the student model after the loss function.
[0057] The step 5 comprises the following sub-steps:
[0058] Step 5.1, when the Distillation Loss ratio is 0.6, 0.7, 0.8, and 0.9 respectively, the distillation experiment is carried out on Shufflenet_v2_x1.0 after changing the loss function by using four distillation methods: ST, MGD, SPKD, and AT;
[0059] Step 5.2, comparing the experimental results, the model with a Distillation Loss ratio of 0.8 and distilled using the MGD method has the best discrimination performance. The discrimination performance of the model has been effectively improved without increasing the number of parameters and the amount of calculation.
[0060] Table 4. Knowledge distillation experimental results
[0061]
[0062] S6, comparison detection and discrimination effect, from Figure 3-Figure 5It can be seen that this embodiment compares the experimental results of 12 convolutional neural networks. Under the requirements of accuracy and lightweight, Shufflenet_v2_x1.0 is selected as the student model and Efficientnet_v2 is selected as the teacher model; the loss function Focal Loss is used to replace CrossEntropy Loss, and the discrimination performance of the teacher model and the student model is improved; when the Distillation Loss ratio is 0.6, 0.7, 0.8 and 0.9 respectively, four knowledge distillation methods, namely Soft Target Knowledge Distillation method, Masked GenerativeDistillation method, Similarity-Preserving Knowledge Distillation method and AttentionTransfer method, are used to perform knowledge distillation on the student model. With a Distillation Loss ratio of 0.8, the model after distillation using the MGD method has the best discrimination performance.
[0063] Embodiment 2,
[0064] The present embodiment is a lightweight black tea fermentation degree identification system, including a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, the identification system executes the method of the above-mentioned embodiment 1 to calculate the fermentation degree of the black tea. The identification system of the present embodiment can intelligently and accurately identify the fermentation degree of black tea, avoiding the problems of high arbitrariness and strong subjectivity caused by manual judgment.
[0065] Embodiment 3,
[0066] This embodiment is a computer-readable storage medium, in which a computer program is stored. When the computer program is run on a computer, the computer executes the method of the above-mentioned embodiment 1. Through the description of the above implementation mode, those skilled in the art can clearly understand that the present application can be implemented by hardware, or by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.), including a number of instructions for a computer device (which can be a personal computer, a brake device, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0067] In the embodiments provided in the present application, it should be understood that the disclosed device, system and method can also be implemented in other ways. The above-described device, system and method embodiments are merely schematic, for example, the flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a part of a module, a program segment or a code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0068] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for determining the fermentation degree of lightweight black tea, characterized in that: The following steps are included: Create and partition a dataset containing black tea fermentation at multiple moments; Select N1 convolutional neural network discriminant models; The experimental results of training the selected N1 convolutional neural network discriminant model are obtained. Based on the experimental results, the student model and the teacher model are comprehensively selected while meeting the requirements of high precision and light weight. Replace the loss function for both the selected student model and the teacher model; Use the knowledge distillation of the teacher model after changing the loss function to change the student model after the loss function; Compare the detection and discrimination effects.
2. A method for determining the fermentation degree of lightweight black tea according to claim 1, characterized in that: The method for preparing and dividing a data set containing black tea fermentation at multiple moments includes obtaining N2 original images of black tea fermentation; The acquired original image is rotated, mirrored, noised and cropped, and the data of the original image is expanded, and the data volume is expanded from the original N2 to an integer multiple of N2; the data set is divided into a training set, a validation set and a test set at a ratio of 6:2:2 to generate the data set.
3. A method for determining the fermentation degree of lightweight black tea according to claim 2, characterized in that: In the production and division of the data set containing black tea fermentation at multiple moments, the data set uses a data set containing black tea fermentation at six moments: 0h, 1h, 2h, 3h, 4h, and 5h.
4. The method for determining the fermentation degree of lightweight black tea according to claim 1, characterized in that: The N1 convolutional neural network discriminant models selected for the training, according to the experimental results, under the condition of meeting the requirements of high precision and lightweight, comprehensively select the student model and the teacher model, including using CUDA software acceleration, AdamW optimizer to optimize the model, training 200 epochs, and obtaining the experimental results of N1 convolutional neural network discriminant models; according to the experimental results, under the condition of meeting the lightweight, comprehensively select Shufflenet_v2_x1.0 as the student model and Efficientnet_v2 as the teacher model.
5. A method for determining the fermentation degree of lightweight black tea according to claim 4, characterized in that: The method of simultaneously replacing the loss function of the selected student model and the teacher model includes replacing the loss function of the student model, replacing CrossEntropy Loss with FocalLoss, and training to obtain the student model after the loss function is replaced; The loss function of the teacher model is changed, CrossEntropy Loss is replaced by Focal Loss, and the teacher model with the changed loss function is trained.
6. A method for determining the fermentation degree of lightweight black tea according to claim 1, characterized in that: The method of using the knowledge distillation of the teacher model after the loss function is changed to replace the student model after the loss function includes performing a distillation experiment on Shufflenet_v2_x1.0 after the loss function is changed by using a plurality of knowledge distillation methods including Masked Generative Distillation; By comparing the experimental results of various knowledge distillation methods, the model with a Distillation Loss ratio of 0.8 and distilled using the Masked Generative Distillation method has the best discrimination performance. The discrimination performance of the model is effectively improved without increasing the number of parameters and the amount of calculation.
7. A method for determining the fermentation degree of lightweight black tea according to claim 6, characterized in that: Distillation experiments were performed when the Distillation Loss ratio was 0.6, 0.7, 0.8, and 0.9, respectively.
8. A method for determining the fermentation degree of lightweight black tea according to claim 6, characterized in that: The knowledge distillation method includes four knowledge distillation methods: Soft Target Knowledge Distillation method, Masked Generative Distillation method, Similarity-Preserving Knowledge Distillation method and Attention Transfer method.
9. A lightweight black tea fermentation degree determination system, characterized by: It comprises a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, the identification system executes the method according to any one of claims 1 to 8 to calculate the fermentation degree of the black tea.
10. A computer-readable storage medium, characterized in that: The computer readable storage medium stores a computer program, and when the computer program is executed on a computer, the computer is enabled to execute the method for determining the fermentation degree of black tea according to any one of claims 1 to 8.
Citation Information
Patent Citations
Tea fermentation degree identification method based on infrared spectrum
CN102012365A
Light-weight traffic sign detection method and system based on response knowledge distillation
CN116110022A
Convolutional neural network model compression method and device based on structure search and knowledge distillation
CN117114053A
Manufacturing method of black tea having pine scent
KR101866809B1
