A Longjing tea quality identification method based on deep features and TrAdaBoost

Through deep features and the TrAdaBoost method, the problems of low accuracy of Longjing tea quality identification and high consumption of annotated data in traditional technology are solved, achieving efficient quality identification in a small sample size, saving manpower and material resources, and improving identification accuracy and automation. Identified application scenarios.

CN114743042BActive Publication Date: 2024-09-06ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210247052.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-14
Publication Date
2024-09-06
Estimated Expiration
2042-03-14

AI Technical Summary

Technical Problem

Traditional image-based Longjing tea quality identification has low identification accuracy due to the high similarity in appearance between different origins and qualities. In addition, the deep learning model requires a large amount of annotated data, consumes a lot of manpower and material resources, and is difficult to build an accurate model with a small sample size.

Method used

Methods based on deep features and TrAdaBoost are used to realize the quality of Longjing tea through domain division and data set annotation, image area of ​​interest extraction, standardization and enhancement, training deep learning models and building feature extractors, and building instance transfer TrAdaBoost models. identification.

Benefits of technology

Efficient Longjing tea quality identification is achieved with a small sample size, saving time and labor costs, improving identification accuracy, consuming less time and computing power, and increasing the application scenarios of automated identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114743042B
    Figure CN114743042B
Patent Text Reader

Abstract

The present invention belongs to the technical fields of computer vision, transfer learning and Longjing tea quality detection, and discloses a Longjing tea quality identification method based on deep features and TrAdaBoost, comprising the following steps: Step 1: domain division and data set annotation; Step 2: image region of interest extraction, standardization and enhancement; Step 3: training a deep learning model and building a feature extractor; Step 4: building an instance transfer TrAdaBoost model; Step 5: using a test set to evaluate the model classification effect. The present invention makes full use of the information provided by the associated source domain data set, and uses a deep neural network and strong generalization and similarity between real samples to build a transfer learning model. The model can achieve Longjing tea quality identification under the condition of a small sample of the target task. The method consumes less time and computing power, is highly efficient, saves a lot of annotation costs and manpower and material resources, and adds application scenarios for the automatic identification of Longjing tea quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical fields of computer vision, transfer learning and Longjing tea quality detection, and in particular relates to a Longjing tea quality identification method based on deep features and TrAdaBoost. Background Art

[0002] Longjing tea is mainly produced in three major regions: West Lake, Qiantang and Yuezhou. The quality of Longjing tea produced in the same region also varies due to differences in picking time and craftsmanship. Traditional image-based Longjing tea quality identification mainly relies on digital image processing technology to manually extract image features and build classification models. However, due to the high similarity in appearance of Longjing tea from different origins and qualities, this brings great difficulties to traditional image processing and restricts the accuracy of identification.

[0003] The deep learning model based on convolutional neural network can automatically extract high-order features and realize the classification of high-similarity images. However, convolutional neural network has a lot of parameters and requires a large amount of labeled data. The labeled data mainly relies on manual work, which consumes a lot of manpower and material resources, which limits the implementation of deep learning models. Therefore, how to build a deep learning model with a small number of labeled samples for the target task, achieve accurate identification while saving time and labor costs, is a problem of great academic and engineering value. Summary of the invention

[0004] In order to solve the problems mentioned in the background technology, the present invention proposes a Longjing tea quality identification method based on deep features and TrAdaBoost, and adopts the following technical solutions:

[0005] A Longjing tea quality identification method based on deep features and TrAdaBoost comprises the following steps:

[0006] Step 1: Domain division and dataset annotation;

[0007] Step 2: Extraction, standardization and enhancement of image regions of interest;

[0008] Step 3: Train the deep learning model and build a feature extractor;

[0009] Step 4: Build the instance migration TrAdaBoost model;

[0010] Step 5: Use the test set to evaluate the model classification effect.

[0011] Furthermore, the step 1 includes the following specific steps:

[0012] Longjing tea images used for quality identification are collected as the target dataset, a small part of them are selected for annotation, and an auxiliary dataset with the same category space as the target dataset is established as the source domain, thus obtaining two Longjing tea quality datasets related to the source domain and the target domain.

[0013] Furthermore, the data sets of the source domain and the target domain have the same quality identification task. The difference between the source domain and the target domain is that all samples in the source domain are labeled, that is, fully annotated, while only a small number of samples in the target domain are labeled, that is, only a small number of annotations are provided. A small number means that only 10 samples of each category have labels.

[0014] Furthermore, the step 2 includes the following specific steps:

[0015] All labeled samples in the source domain and the target domain are merged as a training set, and then the training set images are subjected to operations such as region of interest extraction, standardization, and enhancement to obtain the preprocessed training set; merging labeled samples into a training set means merging the source domain and target domain samples with the same category space into the same category space; region of interest extraction means extracting the region of interest with the geometric center of the image as the center, with a range of 600×540 pixels, and the extracted region of interest is used as the data set image; enhancement means rotating, flipping, adding noise, scaling each image in the training set and saving a copy, thereby expanding the data scale to 5 times the original size to avoid overfitting due to excessive parameters of the deep learning model; standardization means performing standardization based on the mean and variance of each channel of the image.

[0016] Furthermore, the formula used in the standardization operation is:

[0017] output=(input-mean) / std

[0018] Among them, mean and std correspond to the mean and variance of each channel of the image, and input and output correspond to the input and output values ​​of each channel pixel of the image; after the standardization operation, each channel of the image obeys the standard normal distribution with a mean of 0 and a variance of 1.

[0019] Furthermore, the step 3 includes the following specific steps:

[0020] The preprocessed training set is used to train the deep learning model. The parameters of the trained model are fixed, and deep features are extracted for all samples. The model parameters trained on the ImageNet dataset are used as the initialization parameters of the deep neural network model. Then, the output number of the last fully connected layer is adjusted to the number of categories in the training set, that is, the number of grades for quality identification of Longjing tea. Finally, the processed training set data is trained in the model for several rounds until the model loss basically stops decreasing.

[0021] Furthermore, the deep feature extraction refers to fixing the parameters of the trained deep neural network model, removing the classifier and the last fully connected layer, and using the output after the sample is input into the network as the deep feature representation of the sample; the selected deep neural network model is the lightweight convolutional neural network architecture MobileNet V2.

[0022] Furthermore, step 4 includes the following specific steps:

[0023] The improved multi-classification TrAdaBoost model is trained using the deep features of the training set and the trained model is saved. The improved multi-classification TrAdaBoost model is trained using the deep features extracted from the image samples of the training set. During the iteration process, the weights of samples in the source domain that are similar to the target domain are increased, and the weights of samples that are dissimilar to the target domain are reduced, thereby constructing an instance-based transfer learning model.

[0024] Furthermore, the weight iteration method of the source domain samples is the same as that of the original TrAdaBoost algorithm, and the iteration method of the target domain samples is the same as that of the forward step-by-step algorithm, thereby achieving multi-classification.

[0025] Furthermore, the step 5 includes the following specific steps:

[0026] Unlabeled images of Longjing tea to be tested are used to extract deep features on the deep learning model, and then imported into the multi-classification TrAdaBoost model for quality identification. First, the unlabeled target domain samples, i.e., the test set samples, are imported into the trained deep learning model to obtain deep features, and then the deep features are imported into the trained TrAdaBoost classifier to evaluate the accuracy of Longjing tea quality identification. The test set images need to be standardized, but no enhancement is required. First, the test set samples are imported into the deep feature extractor to obtain a 1280-dimensional feature vector, and then imported into the trained TrAdaBoost model to obtain the prediction results. The model accuracy is measured by drawing the confusion matrix and calculating the test set accuracy.

[0027] The beneficial effects of the present invention are: making full use of the information provided by the associated source domain data set, using deep neural networks and strong generalization and similarity between real samples to build a transfer learning model. The model can achieve the quality identification of Longjing tea under the condition of small samples of the target task. The method consumes less time and computing power, is highly efficient, saves a lot of annotation costs and manpower and material resources, and adds application scenarios for the automatic identification of Longjing tea quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 This is a flow chart of the Longjing tea quality identification method of the present invention;

[0029] Figure 2 Extract schematic diagram for ROI;

[0030] Figure 3 Schematic diagram of source domain and target domain dataset;

[0031] Figure 4 The following is a schematic diagram of the MobileNet V2 network structure. Conv stands for convolution, S stands for stride, and P stands for padding.

[0032] Figure 5(a) is a schematic diagram of the Qiantang Longjing target domain confusion matrix;

[0033] Figure 5(b) is a schematic diagram of the confusion matrix of the target domain of Yuezhou Longjing. DETAILED DESCRIPTION

[0034] The present invention is further described in detail below with reference to the accompanying drawings and examples.

[0035] like Figure 1 As shown, a Longjing tea quality identification method based on deep features and TrAdaBoost of the present invention comprises the following steps:

[0036] Step 1: Domain division and dataset annotation. Collect Longjing tea images for quality identification and use them as the target dataset, and select a small number of them for annotation. Establish an auxiliary dataset with the same category space as the target dataset as the source domain. For example, if the target dataset is the four-grade Longjing tea quality distinction, the source domain dataset should also be the four-grade Longjing tea quality distinction, and fully annotate the dataset. Obtain two related Longjing tea quality datasets, the source domain and the target domain. The source domain and target domain datasets should have the same quality identification task. For example, both the source domain and the target domain are several grades of Longjing tea, but from different origins. The difference between the source domain and the target domain is that all samples in the source domain are labeled, that is, fully labeled, and only a small number of samples in the target domain are labeled, that is, only a small number of annotations. A small number means that only about 10 samples in each category have labels.

[0037] Step 2: Image region of interest extraction, standardization and enhancement: All labeled samples in the source domain and the target domain are merged as a training set, and then the training set images are subjected to region of interest extraction, standardization, enhancement and other operations to obtain the preprocessed training set. The merging of labeled samples into a training set means merging the source domain and target domain samples with the same category space into the same category space. Region of interest extraction means that in order to highlight the characteristics of Longjing tea itself and remove the possible influence of the background, the region of interest is extracted with the geometric center of the image as the center, with a range of 600×540 pixels, which basically does not contain background information, and the extracted region of interest is used as the data set image. Enhancement means that the images in the training set are randomly selected from 45° rotation, 90° rotation, horizontal flip, vertical flip, adding salt and pepper noise, adding Gaussian noise, and 1:2 scaling to process and save copies, so that the data scale is expanded to 5 times the original size to avoid overfitting due to the large number of parameters in the deep learning model. Standardization refers to standardization based on the mean and variance of each channel of the image. The formula used for the standardization operation is:

[0038] output=(input-mean) / std

[0039] Among them, mean and std correspond to the mean and variance of each channel of the image, and input and output correspond to the input and output values ​​of each channel pixel of the image. After the standardization operation, each channel of the image obeys the standard normal distribution with a mean of 0 and a variance of 1, which is conducive to the feature extraction of the convolutional layer of the neural network.

[0040] Step 3: Train the deep learning model and build a feature extractor: Use the preprocessed training set to train the deep learning model, fix the parameters of the trained model, and perform deep feature extraction on all samples. Use the model parameters trained on the ImageNet dataset as the initialization parameters of the deep neural network model, and then adjust the output number of the last fully connected layer to the number of categories in the training set, that is, the number of grades for Longjing tea quality identification. Finally, the processed training set data is trained in the model for several rounds until the model loss basically stops decreasing. Deep feature extraction means that the parameters of the trained deep neural network model are fixed, the classifier and the last fully connected layer are removed, and the output after the sample is input into the network is used as the deep feature representation of the sample. Considering the application stage, there are high requirements for the spatiotemporal complexity of the feature extraction network. Therefore, the selected deep neural network model is the excellent lightweight convolutional neural network architecture MobileNetV2, and the pre-trained model of this network architecture on the ImageNet dataset is an open resource on the Internet. First, use the pre-trained model parameters to initialize the MobileNet V2 model, and change the output of the fully connected layer to the number of categories in the training set. During the training process, the training set loss and accuracy are observed. When they are stable, the training is stopped and the model parameters are saved. The softmax layer and the fully connected layer of the trained MobileNet V2 model are removed, and the parameters of the remaining layers are saved to construct a deep feature extractor. The input image size of the feature extractor is 224×224×3, and the output is a 1280-dimensional feature vector.

[0041] Step 4: Construct an instance transfer TrAdaBoost model: Use the deep features of the training set to train the improved multi-classification TrAdaBoost model and save the trained model. Use the deep features extracted from the training set image samples to train the improved multi-classification TrAdaBoost model. During the iteration process, increase the weights of samples in the source domain that are similar to the target domain and reduce the weights of samples that are dissimilar to the target domain, thereby constructing an instance-based transfer learning model. The weight iteration method of the source domain samples is the same as the original TrAdaBoost algorithm, and the iteration method of the target domain samples is the same as the forward step-by-step algorithm (Stagewise Additive Modeling, SAMME) to achieve multi-classification.

[0042] Step 5: Use the test set to evaluate the classification effect of the model. Use the unlabeled Longjing tea images to extract deep features on the deep learning model, and then import them into the multi-classification TrAdaBoost model for quality identification; first, import the unlabeled target domain samples (that is, the test set samples) into the trained deep learning model to obtain deep features, and then import the deep features into the trained TrAdaBoost classifier to evaluate the accuracy of Longjing tea quality identification. The test set images also need to be standardized, but no enhancement is required. First, the test set samples are imported into the deep feature extractor to obtain a 1280-dimensional feature vector, and then imported into the trained TrAdaBoost model to obtain the prediction results. The model accuracy is measured by drawing the confusion matrix and calculating the test set accuracy.

[0043] Example:

[0044] To verify the effectiveness of this method, we collected Longjing tea of ​​different qualities from three production areas: West Lake, Qiantang, and Yuezhou, and constructed three datasets corresponding to different source and target domains. Step 1: Domain division and dataset annotation.

[0045] We collected Longjing tea of ​​different qualities from three origins in the same image acquisition device and constructed three datasets: West Lake Longjing, Qiantang Longjing and Yuezhou Longjing. Each dataset contains four different qualities of Longjing, with 100 images in each category. We set West Lake Longjing as the source domain and manually annotated all of them, and Qiantang Longjing and Yuezhou Longjing as the target domain, with only 10 images in each category manually annotated, thus constructing the Longjing tea quality identification task under small sample conditions.

[0046] Step 2: Image region of interest extraction, normalization and enhancement

[0047] The size of the original image is 1920×1080. In order to remove the background effect, we extract the middle 600×540 area as the region of interest (ROI), as shown in Figure 2 As shown in the figure. Using Python language, we built an image processing module under the Pytorch framework to perform data enhancement and standardization. The final training set contains 2200 images. The source domain and target domain dataset samples are shown in the figure. Figure 3 shown.

[0048] Step 3: Train the MobileNet V2 model and build a feature extractor

[0049] Use the Pytorch module to build a MobileNet V2 model with pre-trained parameter initialization. The network structure is as follows Figure 4As shown in the figure. The training set is imported for training. The image is uniformly scaled to 224×224 resolution before input. The batch-size is set to 32. The optimization method used is stochastic gradient descent, and the learning rate is set to 0.0001. The loss function uses cross entropy loss to evaluate the classification accuracy. The results show that the model has been basically stable after several rounds of iterations. The loss and accuracy of the test set and validation set are stable at a certain level, achieving a good training effect.

[0050] Step 4: Build a multi-classification TrAdaBoost model.

[0051] The pseudo code of the improved TrAdaBoost algorithm is shown in the following table.

[0052]

[0053] Step 5: Use the test set to evaluate the model classification effect.

[0054] Import the processed test set data into the trained model to evaluate the generalization ability of the model. Here, the confusion matrix is ​​used to indicate the quality identification of the two target domains, such as Figure 5(a)-5(b) The following table lists the accuracy of three methods: ordinary image processing, deep learning, and transfer learning in two target domains.

[0055]

[0056] The results show that the manually extracted color and texture features, when imported into the Support Vector Machine (SVM) classifier, do not extract enough information reflected by the image, resulting in low accuracy. When the MobileNet V2 model is used directly to migrate from the source domain to the target domain, since all samples are involved in the training, the deviation between the domains is not well eliminated. Although deep learning can extract high-order semantic features to improve the accuracy to a certain extent, the performance is still limited. When the deep features extracted by MobileNet V2 are combined with the TrAdaBoost classifier, the weights of similar samples are increased and the weights of dissimilar samples are reduced, thereby screening out samples with small domain differences and achieving effective migration. The final accuracy in the two target domains reached 94.5% and 93.3% respectively.

[0057] The above embodiments are used to illustrate the present invention rather than to limit the present invention. Any modification and change made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.

Claims

1. A Longjing tea quality identification method based on deep features and TrAdaBoost, characterized in that: The following steps are included: Step 1: Domain division and dataset annotation; The Longjing tea images used for quality identification are collected as the target dataset, a small number of them are selected for annotation, and an auxiliary dataset with the same category space as the target dataset is established as the source domain, thus obtaining two Longjing tea quality datasets related to the source domain and the target domain. The data sets of the source domain and the target domain have the same quality identification task. The difference between the source domain and the target domain is that all samples in the source domain are labeled, that is, fully annotated, while only a small number of samples in the target domain are labeled, that is, only a small number of annotations are provided. A small number means that only 10 samples of each category have labels. Step 2: Extraction, standardization and enhancement of image regions of interest; All labeled samples in the source domain and the target domain are merged as a training set, and then the training set images are subjected to region of interest extraction, standardization, and enhancement operations to obtain the preprocessed training set; merging labeled samples into a training set means merging source domain and target domain samples with the same category space into the same category space; region of interest extraction means extracting a region of interest with the geometric center of the image as the center, with a range of 600×540 pixels, and the extracted region of interest is used as the dataset image; enhancement means rotating, flipping, adding noise, scaling, and saving a copy of each image in the training set, thereby expanding the data scale to five times the original size to avoid overfitting due to excessive parameters in the deep learning model; Standardization refers to the standardization based on the mean and variance of each channel of the image; Step 3: Train the deep learning model and build a feature extractor; Deep feature extraction refers to fixing the parameters of the trained deep neural network model, removing the classifier and the last fully connected layer, and using the output after the sample is input into the network as the deep feature representation of the sample; the selected deep neural network model is the lightweight convolutional neural network architecture MobileNet V2; Step 4: Build the instance migration TrAdaBoost model; The improved multi-classification TrAdaBoost model is trained using the deep features of the training set, and the trained model is saved. The improved multi-classification TrAdaBoost model is trained using the deep features extracted from the image samples of the training set. During the iteration process, the weights of samples in the source domain that are similar to the target domain are increased, and the weights of samples that are dissimilar to the target domain are reduced, thereby constructing an instance-based transfer learning model. Step 5: Use the test set to evaluate the model classification effect; Unlabeled images of Longjing tea to be tested are used to extract deep features on the deep learning model, and then imported into the multi-classification TrAdaBoost model for quality identification. First, the unlabeled target domain samples, i.e., the test set samples, are imported into the trained deep learning model to obtain deep features, and then the deep features are imported into the trained TrAdaBoost classifier to evaluate the accuracy of Longjing tea quality identification. The test set images need to be standardized, but no enhancement is required. First, the test set samples are imported into the deep feature extractor to obtain a 1280-dimensional feature vector, and then imported into the trained TrAdaBoost model to obtain the prediction results. The model accuracy is measured by drawing the confusion matrix and calculating the test set accuracy.

2. The Longjing tea quality identification method based on deep features and TrAdaBoost according to claim 1, characterized in that: The formula used in the standardization operation is: , in, mean and std The mean and variance of each channel of the corresponding image, input and output The input and output values ​​of each channel pixel of the corresponding image; after the normalization operation, each channel of the image obeys the standard normal distribution with a mean of 0 and a variance of 1.

3. The Longjing tea quality identification method based on deep features and TrAdaBoost according to claim 1, characterized in that: The step 3 comprises the following specific steps: The preprocessed training set is used to train the deep learning model. The parameters of the trained model are fixed, and deep features are extracted for all samples. The model parameters trained on the ImageNet dataset are used as the initialization parameters of the deep neural network model. Then, the output number of the last fully connected layer is adjusted to the number of categories in the training set, that is, the number of grades for quality identification of Longjing tea. Finally, the processed training set data is trained in the model for several rounds until the model loss basically stops decreasing.

4. The Longjing tea quality identification method based on deep features and TrAdaBoost according to claim 1, characterized in that: The weight iteration method of the source domain samples is the same as that of the original TrAdaBoost algorithm, and the iteration method of the target domain samples is the same as that of the forward step-by-step algorithm, thereby achieving multi-classification.