Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 5, No. 2, 2023 82 Plant Leaf Diseases Classification Based on Few‐Shot Learning Wei Wu Taishan University, Tai'an, 271000, China Abstract: Plant leaf disease is one of the important factors affecting the normal growth of plants. It is important to accurately identify the types of leaf disease and take effective measures to ensure the increase of crop production. In this study, we propose a plant leaf diseases classification method based on Few-Shot Learning (FSL), which can obtain good identification accuracy in the classification task with few samples. By changing the parameter setting in FSL, some key features affecting classification accuracy are revealed. The proposal of this research method expands the application scope of artificial intelligence in agriculture, which has important practical significance. Keywords: Convolutional Neural Network, Few-Shot Learning, Meta Learning, Plant leaf disease identification. 1. Introduction In modern agriculture, plant leaf disease is one of the important factors affecting the normal plant growth. It is of great significance to identify the types of crop leaf disease timely and accurately and to ensure the steady growth of crop production and quality. In traditional ways, it’s mainly relied on artificial methods to identify plant leaf disease, such as consulting experts or experienced farmers. However, the acquisition of these knowledge has some disadvantages, such as high cost, low time efficiency and unstable accuracy. With the continuous development of computer technology, the automatic identification of plant leaf disease by intelligent machine has gained more and more attention in the modern agricultural management. In the past few years, the plant leaf disease was mainly identified through traditional machine learning methods such as Support Vector Machines, K-means, and Bayesian etc. With the rapid improvement of computing power and the continuous development of big data technology, more and more researchers turn their attention to the field of deep learning. For example, Ferentinos etc. [1] use a deep convolutional neural network for the detection and diagnosis of plant leaf diseases, which can achieve a recognition accuracy of 99.53%. The data for model training are obtained from a publicly available database which contains 87,848 images. Zhou etc. [2] propose a restructured residual dense network by combining the advantages of deep residual networks and dense networks for tomato leaf disease identification. It can obtain significant improvements over most of the state-of-the-art models in crop leaf identification. Deep learning is one of the important branches in the field of machine learning. Its deep network structure corresponds to the huge model parameters. A large amount of sample data is usually required to train these parameters to make the model achieve better results. The network model is easy to overfit if there are few training data. In many real-world applications the acquisition of sample data is very difficult. Some are because of the high cost of human and material resources, while some are small probability events and cannot be collected in large quantities in the short term. On the contrary, it does not need a lot of data to learn new things for human being. For example, infants are often taught a new animal by only a single picture. In order to enable computers to learn like humans, a new branch of deep learning called Few-Shot Learning (FSL), has gradually aroused the interest of more and more researchers. Using FSL to solve the classification problem means that the model can obtain the recognition ability of new categories with a small amount of training data. At present, there are three main methods: data enhancement, transfer learning and meta-learning. The data enhancement method mainly expands samples through data generation technologies such as picture flipping, cutting, scale change, color jitter and so on. Transfer learning refers to the transfer of knowledge from source domain to target domain. The source domain usually contains large amounts of data samples related or similar to the target domain. The underlying features of the target domain can be acquired by training on the source domain data. For example, Chen et al. [3] used deep transfer learning method for plant leaf disease classification and identification. This method designed an improved VGG network structure INC-VGGN, and used the large publicly available database ImageNet for pre-training of the network model, which finally achieved the identification accuracy of 91.83%. Meta- learning is a way of learning how to learn, rather than directly learning the knowledge itself. When the model has the ability of learning, it can quickly master the ability of classification by only a small number of training samples. Thus meta- learning is a learning way closer to humans. In this study we propose a plant leaf disease classification method based on FSL, which is realized by the way of meta-learning. The effectiveness of this method in the application of plant leaf disease classification are verified through experiments. 2. Research Method This study proposes a classification method of plant leaf diseases based on FSL, which is introduced from the aspects of dataset, feature extraction and meta-learning. 2.1. Dataset Traditional deep learning divides the required data into training set, validation set, and test set. Differently meta- learning is driven by task rather than data. Each task contains the support set and the query set, with the former providing a small amount of data for model tuning, and the latter being 83 used to verify the generalization ability of the model on that task. 2.2. Feature extraction In this study, the network structure before the fully connected layer in the Inception V3 model [4] was used for feature extraction. The model decomposes the larger convolutional kernel in the traditional network hierarchy to reducing the number of parameters of the model. The Inception module group is used to balance the depth and width of the network hierarchy, which improves the ability of feature extraction. In addition, it uses batch normalization to alleviate the problem of gradient disappearance in the deep network hierarchy. 2.3. Meta-learning The meta-learning method mainly includes two steps: meta-training and meta-testing: (1) Meta-training In this stage, the meta-training data set is organized into tasks for model training. N categories were randomly selected for each task, and T data were randomly sampled in each category. The former K data constitute the support set, expressed as S π‘₯ , 𝑦 βˆ— , which is often called N-way K-shot in FSL. The remaining (T-K) data of each category constitute the query set, expressed as Q π‘₯ , 𝑦 βˆ— . The support set in each task is used to enable the model to establish a classification pattern, while the query set is used to verify the effect of this pattern. In this study, the Prototype method [5] was used to support the establishment of the classification patterns. For an N-way K-shot task, the prototype feature 𝑐 of the category k can be expressed as: c 1 𝐾 π‘“βˆ… π‘₯ where x represents the sample data of category k, π‘“βˆ… represents a functional map with parameter βˆ… , which is automatically learned by the neural network model. Samples in the query set use the same functional map for feature extraction and measure the distance from each prototype. In this study the distance was measured by Euclidean distance. Given two n-dimensional vectors X π‘₯ π‘₯ … π‘₯ and Y 𝑦 𝑦 … 𝑦 , their Euclidean distance can be expressed as: d X, Y π‘₯ 𝑦 For a sample x with a label k in the query set, the Euclidean distance from each prototype feature is calculated. Then the probability distribution of the classification can be further calculated through the softmax function. The probability of x being classified into category k can be expressed as: π‘ƒβˆ… y k|x exp 𝑑 π‘“βˆ… π‘₯ , 𝑐 βˆ‘ exp 𝑑 π‘“βˆ… π‘₯ , 𝑐 The purpose of the meta-training stage is to enable the prototype features to represent the corresponding category as accurately as possible, and to maximize the probability of predicting the classification result of k. Therefore, the final loss function is defined as follows: J βˆ… logπ‘ƒβˆ… 𝑦 π‘˜|π‘₯ (2) Meta-testing After the meta-training process, the network model has the ability of few-shot learning. In the meta-test dataset, the prototype of each category of the support set is calculated through the feature extraction module. Then the category of each sample in the query set was predicted to test the effect of the trained model. 3. Experimental Results and Analysis To verify the algorithm of this study, several experiments were performed. The model was optimized by using a mini- batch stochastic gradient descent algorithm. The publicly available dataset PlantVillage [6] was used for plant leaf disease classification experiments. The dataset contains 54303 images of plant leaves, covering 14 plants and 26 leaf disease types, forming 38 categories based on the combination of plant and leaf disease types (including healthy type). In this study, samples from 28 categories were randomly selected as the meta-training dataset, and the remaining samples of 10 categories were used as the meta-test dataset. Different N-way K-shot parameters were configured to generate tasks during the meta-training phase in the experiment. The parameter N in the support set takes values of 3 and 5, and the parameter K takes 1,5 and 10. The query set was sampled in the same category as the support set, with 15 images constantly sampled for each category, but did not overlap with the support set samples. The meta-test phase generated 500 tasks, each with the same as the N-way K-shot parameters in the meta-training set. The classification accuracy of all tasks is averaged to evaluate the classification effect under the corresponding parameters. Table 1. Comparison of classification accuracy for different parameters Category number K=1 K=5 K=10 N=3 0.783 0.853 0.886 N=5 0.691 0.812 0.848 Table 1 compares the classification accuracy of plant leaf diseases using different N-way K-shot parameters. It can be seen that when the K value is the same, smaller N value results in higher classification accuracy. This is because N represents the number to be classified. A smaller N means a simpler classification task, which corresponds a larger probability of getting the correct classification result. When N is the same, a larger K value would acquire a higher classification accuracy. This is because K represents the number of samples in each category. A larger K value means more information in each category. Thus the calculated prototype features can represent the corresponding category more accurately, which results in higher classification accuracy. 4. Summary In this paper, the plant leaf disease classification was studied based on Few-Shot Learning method. N-way K-shot tasks were constructed for model training through meta- learning, and the category of each sample in the meta-test dataset is predicted by the prototype features. Some key features affecting the classification accuracy are revealed by changing the parameter configuration of the learning process. 84 Future studies will continue to explore the application of Few-shot Learning method in intelligent agriculture. Acknowledgment This work was supported by the Tai'an Science and technology innovation development project under Grant No.2021NS097. References [1] Ferentinos K P.Deep learning models for plant disease detection and diagnosis[J].Computers and Electronics in Agriculture , 2018, 145: 311-318. [2] Zhou C, Zhou S, Xing J, et al. Tomato leaf disease identification by restructured deep residual dense network[J]. IEEE Access, 2021, 9: 28822-28831. [3] Chen J, Chen J, Zhang D, et al. Using deep transfer learning for image-based plant disease identification[J]. Computers and Electronics in Agriculture, 2020, 173: 105393. [4] Szegedy C, Vanhoucke V, Ioffe S, et al. Rethinking the inception architecture for computer vision[C]//Proceedings of the IEEE conference on computer vision and pattern recognition. 2016: 2818-2826. [5] Snell J, Swersky K, Zemel R S. Prototypical networks for few- shot learning[J]. arXiv preprint arXiv:1703.05175, 2017. [6] Hughes D, SalathΓ© M. An open access repository of images on plant health to enable the development of mobile disease diagnostics[J]. arXiv preprint arXiv:1511.08060, 2015.