Edible fungus black termitomyces albuminosus quality grading method based on three-teacher cascade knowledge distillation
Through the three-teacher cascade knowledge distillation method and residual connection technology, the problem of time-consuming and inaccurate traditional manual grading is solved, and the efficient and accurate quality grading of edible fungi black-skinned chicken mushrooms is achieved, which is suitable for automatic grading of resource-constrained equipment.
Patent Information
- Application Number
- CN202411979865.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-06-03
AI Technical Summary
The traditional edible fungus black-skinned chicken mushroom quality classification method relies on manual operation, which is time-consuming and labor-intensive and inaccurate, making it difficult to meet the needs of industrial development and economic benefits improvement.
The three-teacher cascaded knowledge distillation method is adopted, and the combination of the lightweight student model and three large parameter teacher models is used, and the knowledge distillation algorithm and residual connection technology are used to construct a three-teacher cascaded knowledge distillation model with residual connections to achieve efficient quality grading of edible fungi black-skinned chicken mushrooms.
While maintaining a low resource occupation and fast response speed, it achieves a high accuracy of quality grading of edible fungi black-skinned chicken mushrooms, which is suitable for automatic grading of resource-constrained equipment, improving the accuracy and efficiency of quality grading.
Smart Images

Figure CN120088526A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of quality grading of the edible mushroom Oudemansiella raphanipes, and relates to a method for quality grading of the edible mushroom Oudemansiella raphanipes by three-teacher cascaded knowledge distillation. Background Art
[0002] The edible mushroom Oudemansiella raphanipes has been widely welcomed in the market due to its unique flavor and extremely high nutritional value. It also contains various components beneficial to the human body, such as polysaccharides, proteins, and various vitamins, and is also an important medicinal resource. With the growth of market demand, how to efficiently grade the quality of this rare mushroom has become a major challenge faced by producers.
[0003] Traditional quality grading methods mainly rely on manual operations. This method is not only time-consuming and laborious, but also easily affected by human factors, resulting in inaccurate grading results, seriously restricting the development of the Oudemansiella raphanipes industry and the improvement of economic benefits. To overcome these problems, researchers have begun to explore using advanced information technology means to improve grading efficiency and accuracy. Especially in recent years, with the rapid development of artificial intelligence technology, deep learning, as an important branch of it, has demonstrated powerful capabilities in fields such as image recognition and classification.
[0004] Convolutional neural networks (CNNs) are a commonly used architecture in deep learning. By simulating the working mechanism of the human brain's visual cortex, they can effectively extract features from the input data and perform classification. Among the numerous models built based on CNNs, large-parameter models are favored for their excellent classification effects. These models improve the learning ability of the model by increasing the network's parameters, thus achieving very high classification accuracy. However, behind the high accuracy is accompanied by high computational costs and long processing times, which is a significant burden for practical application scenarios that require real-time processing of a large amount of data. In contrast, some lightweight models pay more attention to the balance between efficiency and performance. These models optimize the network structure design, reduce the number of parameters, and improve the running speed, and are very suitable for applications in mobile devices or edge computing environments. However, reducing the number of parameters often means sacrificing a certain degree of classification accuracy, which may not meet the classification requirements in some occasions with limited computing resources.
[0005] Regarding the advantages and disadvantages of the above two types of models, researchers have proposed the "knowledge distillation" technique. Knowledge distillation uses a large-parameter model as the teacher model to provide soft label information, and a small-parameter model as the student model to learn simultaneously from the soft labels provided by the teacher model and the hard labels provided by the true labels. Most existing knowledge distillation uses a single teacher model. To achieve a wider knowledge transfer, knowledge distillation with multiple teachers combined has been proposed. In the three-teacher knowledge distillation, the three teacher models can be combined with certain weights to form an ensemble model. However, the weights assigned to each teacher model directly affect the performance of the distilled student model. A simple solution is to use equal weights for each teacher model. However, equal weights cannot distinguish between high-quality and low-quality teacher models, resulting in poor performance of the ensemble model. A more complex solution is to improve the effect of the ensemble model by adjusting the weights, such as manually adjusting the weights or adaptively adjusting the weights through loss or entropy.
[0006] Currently, there is relatively little research on the image grading and recognition of the edible mushroom Oudemansiella raphanipes based on deep learning at home and abroad, and there is no mention of the research on the quality grading of Oudemansiella raphanipes using three-teacher knowledge distillation.
[0007] Due to the relatively complex characteristics of the edible mushroom Oudemansiella raphanipes such as color and texture, and the insignificant quality grading features, how to apply three-teacher knowledge distillation to the quality grading of Oudemansiella raphanipes, how to avoid the complex selection of teacher model weights, but at the same time make full use of the knowledge of the three teacher models to train the student model, and improve the accuracy of the quality grading of Oudemansiella raphanipes is an important issue. Summary of the Invention
[0008] Aiming at the deficiencies of the existing technology, the present invention provides a method for grading the quality of Oudemansiella raphanipes using three-teacher cascaded knowledge distillation. While maintaining low resource occupancy and fast response speed, it has a high accuracy in grading the quality of Oudemansiella raphanipes, which is of great significance and practical value for automatically grading the quality of Oudemansiella raphanipes in resource-constrained devices.
[0009] The present invention is implemented by the following technical solutions:
[0010] A method for grading the quality of Oudemansiella raphanipes using three-teacher cascaded knowledge distillation includes the following steps:
[0011] Step 1: Prepare an image dataset of Oudemansiella raphanipes, which is divided into a training set and a test set;
[0012] Step 2: Select a lightweight convolutional neural network as the student model, select three large-parameter convolutional neural networks as the teacher models, and combine the student model with each teacher model according to the knowledge distillation algorithm to construct three knowledge distillation modules;
[0013] Step 3: For each knowledge distillation module, based on the training set in Step 1, train the student model using the soft label information provided by the teacher model and the hard label information provided by the true label; based on the test set in Step 1, calculate the confusion matrix for each trained student model.
[0014] Step 4: Construct a three-teacher cascaded knowledge distillation model based on the confusion matrix.
[0015] Step 5: Construct a three-teacher cascaded knowledge distillation model with residual connections.
[0016] Step 6: Based on the training set in Step 1, in each training round, update the student model using the three-teacher cascaded knowledge distillation model with residual structure in Step 5 until all training rounds are completed, and then evaluate the three-teacher cascaded knowledge distillation model with residual structure based on the test set in Step 1.
[0017] Step 7: Perform quality grading on the edible mushroom Oudemansiella raphanipes based on the trained three-teacher cascaded knowledge distillation model with residual structure.
[0018] Preferably, Step 4 includes: Divide the three knowledge distillation modules into three levels of low quality, medium quality, and high quality according to the confusion matrix in Step 3, and cascade them in a specific order to construct a three-teacher cascaded knowledge distillation model.
[0019] Further, the cascading in a specific order in Step 4 is: Cascade in the order of the low-quality knowledge distillation module, the high-quality knowledge distillation module, and the medium-quality knowledge distillation module.
[0020] Further, the first criterion for determining the three levels of low quality, medium quality, and high quality of the knowledge distillation module is: Determine according to the mispredicted class of the confusion matrix in Step 3. When the mispredicted class of the confusion matrix of a certain knowledge distillation module is significantly more than the mispredicted classes of the confusion matrices of the other two knowledge distillation modules, then this knowledge distillation module with significantly more mispredicted classes is the low-quality knowledge distillation module; the second criterion is: When the error classes are the same, determine according to the average precision calculated from the confusion matrix in Step 3, and the one with higher average precision has higher quality.
[0021] Preferably, Step 5 includes: In the three-teacher cascaded knowledge distillation model in Step 4, for each knowledge distillation module, establish a residual connection before and after entering the module. By comparing the losses of the student model before and after entering the knowledge distillation module, select the student model with the smaller loss to enter the next knowledge distillation module, and construct a three-teacher cascaded knowledge distillation model with residual connections.
[0022] Preferably, the knowledge distillation module calculates the distillation loss through the Kullback-Leibler divergence, calculates the loss of the student model through cross-entropy, and the total loss is the weighted sum of the soft loss and the hard loss, and the weight of the soft loss is 0.7 to 0.9.
[0023] Preferably, for a smaller sample set, the knowledge distillation module sets a smaller temperature coefficient, and the temperature coefficient ranges from 4 to 6.
[0024] Preferably, the knowledge distillation module uses the Adam optimizer and the step learning rate decay strategy for model training, the initial learning rate is 0.001 to 0.005, and it is adjusted to 50% to 70% of the current value every five epochs.
[0025] Preferably, ShuffleNet V2 0.5x is selected as the student model; VGG16, ResNet50, and Xception are selected as the teacher models.
[0026] Preferably, step 1 further includes: performing image augmentation on the training set.
[0027] The beneficial effects of the present invention are as follows:
[0028] 1. The present invention innovatively introduces three-teacher cascaded knowledge distillation into the quality grading of the edible mushroom Oudemansiella raphanipes, and in view of the characteristics of the relatively complex features and the non-significant quality grading features of the edible mushroom Oudemansiella raphanipes, deeply explores how to make full use of the differences in the knowledge of the three teacher models, and realizes the effective grading of the quality of Oudemansiella raphanipes.
[0029] 2. The three-teacher cascaded knowledge distillation model with a residual structure can well grade the quality of the edible mushroom Oudemansiella raphanipes. While maintaining low resource occupancy and fast response speed, it achieves high classification accuracy, which has important significance and practical value for the automatic quality grading of Oudemansiella raphanipes in resource-constrained devices.
[0030] 3. The three knowledge distillation modules are cascaded in the order of low quality, high quality, and medium quality, making full use of the differences in the knowledge of the three teacher models, and the student model achieves good generalization ability and high accuracy.
[0031] 4. By comparing the loss of the student model before and after entering the knowledge distillation module through residual connection, and selecting the student model with a smaller loss to enter the next knowledge distillation module, the student model can retain the best model after learning in each teacher model, ensuring that each subsequent module is at least as good as the previous one. Description of the Drawings
[0032] Figure 1 It is a flowchart of a method for grading the quality of Oudemansiella raphanipes by three-teacher cascaded knowledge distillation in an embodiment of the present invention.
[0033] Figure 2 This is the basic structure of a single knowledge distillation module in an embodiment of the present invention.
[0034] Figure 3 This is the confusion matrix of an embodiment of the present invention. Among them, Figure (a) is the student model without knowledge distillation, Figure (b) is the single-teacher knowledge distillation with VGG16 as the teacher model, Figure (c) is the single-teacher knowledge distillation with ResNet50 as the teacher model, and Figure (d) is the single-teacher knowledge distillation with Xception as the teacher model.
[0035] Figure 4 This is the structural diagram of a three-teacher cascaded knowledge distillation model with a residual structure in an embodiment of the present invention. Detailed implementation manners
[0036] The present invention provides a method for grading the quality of edible mushroom Oudemansiella raphanipes by three-teacher cascaded knowledge distillation, and proposes a three-teacher cascaded knowledge distillation model with residual connections. The method of the present invention aims to solve the problems of time-consuming and labor-intensive traditional manual quality grading, and automatically evaluate and grade the quality of Oudemansiella raphanipes by using deep learning technology and convolutional neural network.
[0037] The present invention adopts a lightweight student model, and respectively forms knowledge distillation modules with three teacher models; in multiple knowledge distillation modules cascaded in a specific order, the student model extracts soft label information from the teacher model, and combines the hard label information provided by the real label to train the convolutional neural network; by comparing the losses of the student model before and after entering the knowledge distillation module through residual connections, the student model with a smaller loss is selected to enter the next knowledge distillation module. The three-teacher cascaded knowledge distillation model with residual connections proposed by the present invention realizes high classification accuracy while maintaining low resource occupancy and fast response speed, and has important significance and practical value for automatically grading the quality of Oudemansiella raphanipes in resource-constrained devices.
[0038] A method for grading the quality of edible mushroom Oudemansiella raphanipes by three-teacher cascaded knowledge distillation, as Figure 1 shown, includes the following steps:
[0039] Step 1: Prepare an image dataset of edible mushroom Oudemansiella raphanipes, divide it into a training set and a test set, and perform image augmentation on the training set.
[0040] The acquisition of the image dataset of the edible fungus Oudemansiella raphanipes is to place the Oudemansiella raphanipes of each quality grade flat on a tray, take RGB three-color photos at the top of the Oudemansiella raphanipes using a color camera, and then crop the color photos into squares. The pictures of the Oudemansiella raphanipes of each quality grade are randomly assigned to the training set and the test set according to a certain proportion; for the pictures in the training set, image augmentation methods such as geometric transformation, color transformation, and noise addition are applied to increase data diversity.
[0041] In a preferred embodiment, the image dataset of the edible fungus Oudemansiella raphanipes is obtained in the following manner:
[0042] Purchase Oudemansiella raphanipes in the farmers' market, and the experts classify the Oudemansiella raphanipes into four grades: Class 1, Class 2, Class 3, and Class 4 according to the external characteristics such as size, shape, and color.
[0043] Place the Oudemansiella raphanipes flat on a tray, take RGB three-color photos at the top of the Oudemansiella raphanipes using a color camera, and the image resolution is uniformly 3984×2656 pixels.
[0044] Crop the image into small squares of 600×600 pixels. Select 750 photos from the photos of Oudemansiella raphanipes of each grade as the dataset, with a total of 3000 photos for the four grades. Randomly select 600 photos from the 750 photos of each grade as the training set, and the remaining 150 photos as the test set. For the pictures in the training set, image augmentation methods such as geometric transformation, color transformation, and noise addition are applied. After geometric transformation, color transformation, and noise addition, each of the 600 pictures of each grade in the training set reaches 9600 pictures, with a total of 38400 pictures.
[0045] Step 2: Select a lightweight convolutional neural network as the student model, select three large-parameter convolutional neural networks as the teacher models, and combine the student model with each teacher model according to the knowledge distillation algorithm to construct three knowledge distillation modules.
[0046] A single knowledge distillation module calculates the distillation loss through the Kullback-Leibler divergence, calculates the loss of the student model through cross-entropy, and the total loss is the weighted sum of the soft loss and the hard loss, and the weight of the soft loss is 0.7 - 0.9.
[0047] A single knowledge distillation module sets a smaller temperature coefficient for a smaller sample set, and the temperature coefficient value is 4 - 6.
[0048] A single knowledge distillation module uses the Adam optimizer and the step learning rate decay strategy for model training, with an initial learning rate of 0.001 - 0.005, and adjusts to 50% - 70% of the current value every five epochs.
[0049] In a preferred embodiment, ShuffleNet V2 0.5x is selected as the student model, which has few parameters and fast computing speed. VGG16, ResNet50, and Xception are selected as the teacher models, and these models have high classification accuracy.
[0050] The ShuffleNet V2 0.5x student model is combined with the VGG16, ResNet50, and Xception teacher models respectively according to the knowledge distillation algorithm to construct three knowledge distillation modules. A single knowledge distillation module is as Figure 2 shown. Using the soft label information provided by a single teacher model, with the temperature coefficient set to 5, the distillation loss is calculated through the Kullback-Leibler divergence. Using the hard label information provided by the true labels, the loss of the student model is calculated through cross-entropy. The total loss is the weighted sum of the soft loss and the hard loss, and the weights of the soft loss and the hard loss are 0.8 and 0.2 respectively. The weights of the convolutional neural network are updated by the feedback of the total loss to train the student model. During training, the Adam optimizer and the step learning rate decay strategy are used, with the initial learning rate of 0.004, which is adjusted to 60% of the current value every five epochs.
[0051] Step 3: For each knowledge distillation module, based on the training set in Step 1, use the soft label information provided by the teacher model and the hard label information provided by the true labels to train the student model; based on the test set in Step 1, calculate the confusion matrix for each trained student model.
[0052] In a preferred embodiment, after the student model is trained, the test set is used for inference, and the confusion matrix and the average precision are calculated. As Figure 3 shown, where Figure (a) is the confusion matrix obtained by the student model without knowledge distillation for inferring the test set, and the calculated average precision is 94.3%; Figure (b) is the confusion matrix obtained by the student model with single-teacher knowledge distillation using VGG16 as the teacher model for inferring the test set, and the calculated average precision is 97.1%; Figure (c) is the confusion matrix obtained by the student model with single-teacher knowledge distillation using ResNet50 as the teacher model for inferring the test set, and the calculated average precision is 96.8%; Figure (d) is the confusion matrix obtained by the student model with single-teacher knowledge distillation using Xception as the teacher model for inferring the test set, and the calculated average precision is 96.5%.
[0053] Step 4: Divide the three knowledge distillation modules into three levels: low quality, medium quality, and high quality according to the confusion matrix in Step 3, and cascade them in the order of low-quality knowledge distillation module, high-quality knowledge distillation module, and medium-quality knowledge distillation module to construct a three-teacher cascaded knowledge distillation model.
[0054] The first criterion for determining the knowledge distillation modules at the three levels of low quality, medium quality, and high quality is: determine according to the mispredicted classes in the confusion matrix in Step 3. When the mispredicted classes in the confusion matrix of a certain knowledge distillation module are significantly more than those in the confusion matrices of the other two knowledge distillation modules, then this knowledge distillation module with significantly more mispredicted classes is of low quality. The second criterion is: when the error classes are the same, determine according to the average precision calculated from the confusion matrix in Step 3. The one with a higher average precision is of higher quality.
[0055] In a preferred embodiment, when using VGG16 and ResNet50 as the teacher models, mispredict Class2 as Class1, or mispredict Class4 as Class3, or mispredict Class3 as Class4; while when using Xception as the teacher model, in addition to the above three error classes, add one more error class: mispredict Class4 as Class2; so the knowledge distillation module with Xception as the teacher model is of low quality. In addition, determine the quality of the three knowledge distillation modules according to Figure 2 the average precision calculated from the confusion matrix: the knowledge distillation module with Xception as the teacher model is of low quality, the knowledge distillation module with ResNet50 as the teacher model is of medium quality, and the knowledge distillation module with VGG16 as the teacher model is of high quality. Cascade them in the order of the low-quality knowledge distillation module Xception, the high-quality knowledge distillation module VGG16, and the medium-quality knowledge distillation module ResNet50 to construct a three-teacher cascaded knowledge distillation model.
[0056] Step 5: Construct a three-teacher cascaded knowledge distillation model with residual connections.
[0057] In the three-teacher cascaded knowledge distillation model in Step 4, for each knowledge distillation module, establish a residual connection before and after entering the module. By comparing the losses of the student model before and after entering the knowledge distillation module, select the student model with a smaller loss to enter the next knowledge distillation module, and construct a three-teacher cascaded knowledge distillation model with residual connections.
[0058] In a preferred embodiment, such as Figure 4As shown, in a certain training round, for the knowledge distillation module 1, a residual connection is established before and after entering the module. Calculate the loss of the student model before entering the knowledge distillation module and the loss of the student model 1 with updated weights after entering the knowledge distillation module 1, and select the student model with the smaller loss to enter the knowledge distillation module 2; for the knowledge distillation module 2, a residual connection is established before and after entering the module. Calculate the loss of the student model before entering the knowledge distillation module and the loss of the student model 2 with updated weights after entering the knowledge distillation module 2, and select the student model with the smaller loss to enter the knowledge distillation module 3. For the knowledge distillation module 3, a residual connection is established before and after entering the module. Calculate the loss of the student model before entering the knowledge distillation module and the loss of the student model 1 with updated weights after entering the knowledge distillation module 3, and select the student model with the smaller loss to enter the knowledge distillation module 1 in the next round.
[0059] It should be noted that the object of the residual connection here is a complete deep learning model (student model), which is essentially different from the object of the residual connection in the prior art, which is several convolutional layers inside a convolutional neural network (such as Resnet) model.
[0060] In the present invention, the losses of the student model before and after knowledge distillation are compared through the residual connection, and the student model with the smaller loss is selected to enter the next knowledge distillation module, so that the best model can be retained after the student model learns in each teacher model, ensuring that each subsequent module is at least as good as the previous one. This is extremely important for the quality grading of the edible mushroom Oudemansiella raphanipes with relatively complex features and insignificant quality grading features.
[0061] Step 6: Based on the training set in Step 1, use the three-teacher cascaded knowledge distillation model with a residual structure in each training round to update the student model until all training rounds are completed, and then evaluate the model based on the test set in Step 1 to obtain the trained three-teacher cascaded knowledge distillation model with a residual structure.
[0062] Model evaluation is to evaluate the classification accuracy, average inference time, mean accuracy, mean precision, mean recall, mean F1-score, and Kappa coefficient of the model.
[0063] In a preferred embodiment, based on the training set, use the three-teacher cascaded knowledge distillation model with a residual structure to update the student model in each training round until all training rounds are completed, and then evaluate the model based on the test set. The calculated results are: average inference time 5.51ms, mean accuracy 99.7%, mean precision 99.7%, mean recall 99.9%, mean F1-score 99.9%, and Kappa coefficient 0.9955.
[0064] As a comparison, the student model was distilled using a three-teacher cascaded knowledge distillation model without a residual structure, and the results of the student model's inference on the test set are as follows: average inference time 5.71 ms, mean accuracy 99.1%, mean precision 99.2%, mean recall 99.1%, mean F1 score 99.1%, and Kappa coefficient 0.9888. The results show that the accuracy of the three-teacher cascaded knowledge distillation model with a residual structure for grading the quality of Termitomyces albuminosus is higher than that of the three-teacher cascaded knowledge distillation model without a residual structure.
[0065] In the three-teacher cascaded model, there are 6 different orders in which the three models can be arranged. In addition to the cascaded order of the low-quality knowledge distillation module → high-quality knowledge distillation module → medium-quality knowledge distillation module described above, there are 5 other ones, as shown in Table 1.
[0066] Table 1 Accuracy of the student model on the training set after knowledge distillation using the three-teacher cascaded knowledge distillation model
[0067] Cascade order Cascade model without residual structure Cascade model with residual structure VGG16→ResNet50→Xception 93.2% 93.2% VGG16→Xception→ResNet50 92.8% 94.0% ResNet50→VGG16→Xception 92.5% 94.1% ResNet50→Xception→VGG16 93.1% 93.2% Xception→VGG16→ResNet50 94.1% 94.5% Xception→ResNet50→VGG16 91.6% 94.3%
[0068] On the one hand, regardless of the cascaded order, the grading accuracy of the cascaded knowledge distillation model with a residual structure is higher than that of the corresponding cascaded knowledge distillation model without a residual structure. This is because, by comparing the losses of the student model before and after entering the knowledge distillation module through residual connections, the student model with a smaller loss is selected to enter the next knowledge distillation module, so that the best model can be retained after the student model learns in each teacher model, ensuring that each subsequent module is at least as good as the previous one.
[0069] On the other hand, the order of model cascading is not randomly arranged. The accuracy of the cascaded model is affected by the cascading order of the models, and the best grading accuracy is achieved in the cascading order of Xception→VGG16→ResNet50. This is because among the three teacher models, Xeption is a low-quality knowledge distillation module and has the most incorrect predictions in the Termitomyces albuminosus dataset: mispredicting Class2 as Class1, or mispredicting Class4 as Class3, or mispredicting Class3 as Class4, or mispredicting Class4 as Class2. When Xeption is used as the teacher module to transfer knowledge to the student model, some incorrect knowledge will also have a negative impact on the performance of the student model. VGG16 is a high-quality knowledge distillation module. Following the low-quality knowledge distillation module, it can effectively correct the negative impact of the low-quality knowledge distillation module when transferring knowledge to the student model. Finally, there is the medium-quality knowledge distillation module ResNet50, which can further improve the performance of the student model when transferring knowledge to the student model.
[0070] Step 7: Perform quality grading on Termitomyces albuminosus based on the trained three-teacher cascaded knowledge distillation model with a residual structure.
[0071] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications made without departing from the spirit and principle of the present invention shall be equivalent replacement methods and are all included in the protection scope of the present invention.
Claims
1. A quality grading method for edible fungus Acanthopanax fasciatus based on three-teacher cascade knowledge distillation, characterized in that: The following steps are involved: Step 1: Prepare an image dataset of the edible mushroom Acanthopanax fasciata, which is divided into a training set and a test set; Step 2: Select a lightweight convolutional neural network as the student model, select three large parameter convolutional neural networks as teacher models, and combine the student model with each teacher model according to the knowledge distillation algorithm to construct three knowledge distillation modules; Step 3: For each knowledge distillation module, based on the training set in step 1, use the soft label information provided by the teacher model and the hard label information provided by the true label to train the student model; based on the test set in step 1, calculate the confusion matrix for each trained student model; Step 4: Construct a three-teacher cascade knowledge distillation model based on the confusion matrix; Step 5: Build a three-teacher cascade knowledge distillation model with residual connections; Step 6: Based on the training set in step 1, use the three-teacher cascade knowledge distillation model with residual structure in step 5 to update the student model in each training round until all training rounds are completed, and then evaluate the three-teacher cascade knowledge distillation model with residual structure based on the test set in step 1; Step 7: Quality classification of the edible fungus Acanthopanax edulis is performed based on the trained three-teacher cascade knowledge distillation model with residual structure.
2. The method for grading the quality of edible mushrooms of claim 1, characterized in that: Step 4 includes: dividing the three knowledge distillation modules into three levels of low quality, medium quality and high quality according to the confusion matrix of step 3, and cascading them in a specific order to construct a three-teacher cascade knowledge distillation model.
3. The method for grading the quality of edible mushrooms of claim 2, characterized in that: In step 4, the cascading is performed in a specific order: cascading in the order of low-quality knowledge distillation modules, high-quality knowledge distillation modules, and medium-quality knowledge distillation modules.
4. The method for grading the quality of edible mushrooms of claim 2, characterized in that: The first criterion for determining the knowledge distillation modules at the three levels of low quality, medium quality and high quality is: judging according to the error prediction categories of the confusion matrix in step 3. When the error prediction categories of the confusion matrix of a knowledge distillation module are significantly more than the error prediction categories of the confusion matrices of the other two knowledge distillation modules, the knowledge distillation module with significantly more error prediction categories is a low-quality knowledge distillation module. The second criterion is: when the error categories are the same, judging according to the average accuracy calculated by the confusion matrix in step 3, the one with higher average accuracy has higher quality.
5. The method for grading the quality of edible mushrooms of claim 1, characterized in that: Step 5 includes: in the three-teacher cascade knowledge distillation model of step 4, for each knowledge distillation module, a residual connection is established before and after entering the module, and by comparing the loss of the student model before and after entering the knowledge distillation module, the student model with smaller loss is selected to enter the next knowledge distillation module, and a three-teacher cascade knowledge distillation model with residual connection is constructed.
6. The method for grading the quality of edible mushrooms of claim 1, characterized in that: The knowledge distillation module calculates the distillation loss through Kullback-Leibler divergence and the loss of the student model through cross entropy. The total loss is the weighted sum of soft loss and hard loss, and the weight of soft loss is 0.7 to 0.
9.
7. The method for grading the quality of the edible mushroom Codonopsis pilosula according to claim 1, characterized in that: The knowledge distillation module sets a smaller temperature coefficient for smaller sample sets, with the temperature coefficient ranging from 4 to 6.
8. The method for grading the quality of edible mushrooms of Acanthopanax fasciata according to claim 1, characterized in that: The knowledge distillation module uses the Adam optimizer and the step learning rate decay strategy for model training. The initial learning rate is 0.001-0.005, and is adjusted to 50%-70% of the current value every five epochs.
9. The method for grading the quality of the edible mushroom Codonopsis pilosula according to claim 1, characterized in that: Select ShuffleNetV2 0.5x as the student model; select VGG16, ResNet50 and Xception as the teacher models.
10. The method for grading the quality of the edible mushroom Codonopsis pilosula according to claim 1, characterized in that: Step 1 also includes: performing image augmentation on the training set.
