A method to reduce the long-tail effect of citrus leaf disease detection model
By constructing a data set with long-tail exponential attenuation and a class rebalancing method of decoupling structure, the citrus fruit tree leaf disease detection model is improved, the long-tail problem is solved, the detection accuracy is improved, especially the classification accuracy of tail categories, and the calculation complexity is reduced, which is suitable for application on edge devices.
Patent Information
- Application Number
- CN202311558928.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-21
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-11-21
AI Technical Summary
The existing deep learning-based fruit tree disease detection methods have long tail problems in the detection of leaf diseases of citrus fruit trees, resulting in poor detection results. Especially when the data set category distribution is uneven and the data volume is large, good detection accuracy cannot be achieved.
The data set is constructed using the sampling strategy of long-tail exponential attenuation, and the neural network is divided into two stages of feature learning and classifier learning through the class rebalancing method of decoupling structures. The features and classifiers are trained using CE loss function and IB loss function respectively, and combined with weight attenuation and maximum value regularization technology, an improved citrus fruit tree leaf disease detection model is constructed.
It effectively alleviates the long-tail effect, improves the accuracy of detection of leaf diseases of citrus fruit trees, especially the classification accuracy in tail categories, improves the average accuracy, and reduces the amount of calculation, making the model more suitable for deployment on edge devices with lower performance.
Smart Images

Figure CN117593626B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of fruit tree leaf disease detection, and particularly relates to a method for alleviating the long-tail effect of a citrus fruit tree leaf disease detection model. Background Art
[0002] Plant diseases are one of the major issues that directly degrade agricultural production quality. Detecting and classifying plant diseases is a key task in improving plant production quality and promoting economic growth. Citrus is the largest plant species in the Rutaceae family and the most traded agricultural commodity in the world. Citrus trees have a high number of commercial and spontaneous hybrids. Detecting plant diseases is crucial because vegetable and fruit foods are associated with numerous health benefits and reduced disease risk.
[0003] Due to significant advances in computer vision and image analysis, particularly deep learning, which has become a widely accepted and widely used method for orchard disease detection, a variety of visual image-based disease detection methods have emerged. Within the field of deep learning, two prominent techniques, convolutional neural networks (CNNs) and visual transformers (ViTs), have found widespread application in agricultural disease detection. For example, Scaled YOLOv4 P7 achieves rapid early prediction of citrus leaf diseases, and Res2Net 101 DCN-BiFPN's CenterNet2 achieves higher early prediction accuracy for citrus leaf diseases than other efficient detection models.
[0004] Previous research has shown that current deep learning-based fruit tree pest and disease detection methods exhibit good performance across all algorithmic aspects when the amount of data across categories in a dataset is balanced. The uneven distribution of data across categories within a dataset is known as the "long tail problem." When this problem exists, these research methods cannot fully demonstrate their optimal performance, thus failing to achieve the current state of detection results. In citrus cultivation, diseases vary in onset time, type, and severity, leading to an imbalance in the number of images within a category in disease datasets, thus causing the "long tail problem."
[0005] Therefore, many researchers have begun researching solutions to the long-tail problem. For example, the bilateral branching network (BBN) can effectively alleviate the long-tail problem by decoupling the algorithm learning process into representation learning and classification, exploring how different balancing strategies affect the model for long-tail identification. It has achieved good detection results on the mageNet-LT, Places-LT, and iNaturalist datasets, but its detection performance is not good in the specific scenario of citrus fruit tree leaf disease.
[0006] The present invention is based on the detection of leaf diseases of citrus fruit trees. It designs an innovative structure that allows it to be combined with the current long-tail improvement method with outstanding effects, greatly alleviating the problem of poor performance in citrus leaf disease detection caused by the long-tail effect, and achieving improved accuracy in fruit tree leaf disease detection. Summary of the Invention
[0007] The present invention provides a method for alleviating the long-tail effect of the citrus fruit tree leaf disease detection model, which solves the long-tail problem of uneven category distribution of the current citrus fruit tree disease data set and the long-tail phenomenon of large differences in data volume between categories, resulting in poor detection effect of citrus fruit tree diseases.
[0008] In order to solve the above technical problems, the technical solution of the present invention is: a method for reducing the long-tail effect of a citrus fruit tree leaf disease detection model, comprising the following steps:
[0009] S1. Collect citrus leaf images by taking photos, construct a citrus leaf dataset using a long-tail exponential decay sampling strategy, and divide the dataset into a training set, a test set, and a validation set.
[0010] S2. Constructing a neural network with Resnet32 as the backbone network, decoupling the neural network using class rebalancing based on a decoupling structure, and training the decoupled feature learning network and classifier learning network using the training set to obtain an improved citrus leaf disease detection model that mitigates the long-tail effect;
[0011] S3. Verify the improved citrus fruit tree leaf disease detection model through the test set and the validation set, and perform citrus fruit tree leaf disease detection through the verified citrus fruit tree leaf disease detection model.
[0012] The beneficial effects of the present invention are: through decoupling design, the present invention trains the feature learning and classifier learning of the neural network separately, and makes full use of the performance improvement of the two stages, thereby realizing accurate prediction of citrus plant disease leaf data with long-tail problem of unbalanced number of categories. At the same time, the present invention has a cleverly designed structure, which integrates the latest long-tail feature learning method and classifier design ideas, and constructs an improved citrus fruit tree leaf disease detection model, achieving the purpose of maintaining the classification accuracy of the head class and improving the classification accuracy of the tail class in the long-tail classification, solving the long-tail problem of uneven category distribution of the current citrus fruit tree disease data set and the long-tail phenomenon of large difference in data volume between categories, resulting in poor detection effect of citrus fruit tree diseases.
[0013] Furthermore, the formula for the long-tail exponential decay in step S1 is:
[0014]
[0015]
[0016] Among them, n represents the specific number of samples of each class of citrus fruit tree leaf diseases, n max represents the number of samples of the citrus leaf disease category with the largest sample size, ρ represents the imbalance degree, C represents the total number of categories of citrus leaf diseases, i represents the category label of the citrus leaf disease sample, n min Indicates the number of samples of the citrus fruit tree leaf disease category with the smallest sample size.
[0017] The beneficial effect of the above further scheme is: the long-tail attenuation formula is used to construct a citrus fruit tree disease dataset. Through the long-tail attenuation index, the dataset can be artificially transformed into a dataset with a long-tail problem, so that each leaf disease category shows an uneven exponential decline.
[0018] Furthermore, the specific steps of step S2 are:
[0019] S21. Build a neural network with Resnet32 as the backbone network;
[0020] S22. Decoupling the neural network by class rebalancing based on the decoupling structure. That is, the neural network is divided into two stages, wherein the first stage is a feature learning network, and the second stage is a feature fine-tuning learning network and a classifier learning network;
[0021] S23. Select the CE loss function as the objective function of the first-stage feature learning network, add weight decay, perform feature learning through the training set, and save the network parameters;
[0022] S24. Load the network parameters of the first stage and train the feature fine-tuning learning network of the second stage through maximum normalization Maxnormal and weight decay;
[0023] S25. Select the IB loss function to train the classifier learning network to obtain an improved citrus fruit tree leaf disease detection model that reduces the long-tail effect.
[0024] The beneficial effects of the above further scheme are: in the first stage, weight decay is used to improve the feature extraction ability of the trained neural network to ensure sufficient feature learning. In the second stage, the size of the input weight is limited by maximum regularization Maxnormal, and the model is trained again on the already trained one-stage model. Without affecting the existing parameters on a large scale, more accurate training results are obtained. In addition, the category rebalancing method is combined to train a classifier with excellent performance. The two stages share network weights, which solves the long-tail problem while greatly reducing the amount of computation, making it more suitable for field detection and easier to deploy on edge devices with relatively low performance.
[0025] Furthermore, the expression of the CE loss function in step S23 is:
[0026]
[0027] Among them, C represents the total number of categories of citrus fruit tree leaf diseases, i represents the category label of citrus fruit tree leaf disease samples, and y i Indicates the true citrus fruit tree leaf disease category label, p i Represents the probability that the predicted citrus fruit tree leaf disease is class label i.
[0028] Furthermore, in step S23, the weight decay adopts the L2 norm, and the formula of the weight decay is:
[0029]
[0030] Among them, min(·) means taking the minimum value, represents the objective function CE loss function, w and b represent the solution parameters of the feature learning network, α represents the parameter that controls the degree of regularization set by humans, and ||·|| represents the L2 norm.
[0031] The beneficial effects of the above further scheme are: preventing network overfitting through weight decay, improving the feature learning ability of the model, controlling the complexity of the network, and making the network tend to learn common features.
[0032] Furthermore, the expression of the IB loss function in step S24 is:
[0033]
[0034] Where m represents the number of samples of citrus fruit tree leaf diseases, D m represents the total sample space of citrus fruit tree leaf diseases, θ k represents the weight of the kth citrus leaf disease category, τ(y,f(x,ω)) represents the empirical risk function, x represents the input of the classifier learning network, y represents the true label of the citrus leaf disease, ω represents the parameter in the classifier learning network that needs to be updated by backpropagation, f(x,ω) represents the output of the classifier learning network, h represents the feature vector of the classifier learning network, and ||·||1 represents the L1 norm.
[0035] The beneficial effect of the above further scheme is that the IB loss function applied to long-tail distribution data can reduce the weights of categories with large sample sizes at the edges to ensure that the classifier can generate smoother edges and prevent the classifier from being affected by large samples and causing large deviations. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 The present invention is a flow chart of a method for alleviating the long-tail effect of a citrus fruit tree leaf disease detection model.
[0037] Figure 2 This is the classification category of citrus fruit tree leaf diseases of the present invention.
[0038] Figure 3 This is a data distribution diagram of the citrus fruit tree leaf disease imbalance degree of 50 and 100 in the present invention.
[0039] Figure 4 This is a comparison chart of the classification accuracy of each category when the imbalance degree of the present invention is 50.
[0040] Figure 5 This is a comparison chart of the classification accuracy of each category when the imbalance degree of the present invention is 100. DETAILED DESCRIPTION
[0041] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and it should be understood that the scope of protection of the present invention is not limited to such specific descriptions and embodiments. Those skilled in the art can make various other specific variations and combinations based on the technical teachings disclosed in the present invention without departing from the essence of the present invention, and such variations and combinations are still within the scope of protection of the present invention.
[0042] Example
[0043] like Figure 1 As shown, the present invention provides a method for alleviating the long-tail effect of a citrus fruit tree leaf disease detection model, comprising the following steps:
[0044] S1. Collect citrus leaf images by taking photos, construct a citrus leaf dataset using a long-tail exponential decay sampling strategy, and divide the dataset into a training set, a test set, and a validation set.
[0045] S2. Constructing a neural network with Resnet32 as the backbone network, decoupling the neural network using class rebalancing based on a decoupling structure, and training the decoupled feature learning network and classifier learning network using the training set to obtain an improved citrus leaf disease detection model that mitigates the long-tail effect;
[0046] S3. Verify the improved citrus fruit tree leaf disease detection model through the test set and the validation set, and perform citrus fruit tree leaf disease detection through the verified citrus fruit tree leaf disease detection model.
[0047] In this embodiment, the image of citrus fruit tree leaves is collected by shooting with a mobile phone, with a resolution of 4800×4344 pixels and a shooting distance of 0.2 to 0.5 meters. Figure 2 As shown in Figure 1, there are 8 categories for the classification of citrus tree leaf diseases in orchards. In the long-tail problem, the imbalance degree ρ specifically refers to the ratio of the number of samples in the category with the largest sample size to the number of samples in the category with the smallest sample size.
[0048] Long-tail exponential decay is used to create long-tail problem data sets. By decaying the exponential, long-tail problems can appear in normal average data sets, such as Figure 3 (a) and Figure 3 As shown in (b), the data of citrus tree leaf diseases in orchards are divided into two groups with imbalance degrees of ρ = 50 and ρ = 100. The sample size of each category decreases exponentially, which is a long-tail phenomenon.
[0049] The formula for the long-tail exponential decay in step S1 is:
[0050]
[0051]
[0052] Among them, n represents the specific number of samples of each class of citrus fruit tree leaf diseases, n max represents the number of samples of the citrus leaf disease category with the largest sample size, ρ represents the imbalance degree, C represents the total number of categories of citrus leaf diseases, i represents the category label of the citrus leaf disease sample, n min Indicates the number of samples of the citrus fruit tree leaf disease category with the smallest sample size.
[0053] In this embodiment, anthracnose is the category with the largest sample size, and black spot is the category with the smallest sample size. The sample class labels 0-7 represent anthracnose, healthy leaves, leaf miner, brown spot, sand bark, yellow dragon disease, ulcer disease, and black spot, respectively. A dataset of citrus fruit tree leaves is obtained through a sampling strategy, and the training set, test set, and validation set are divided into training set, test set, and validation set in a ratio of 8:1:1. Among them, the total training samples of the datasets with imbalance degrees of 50 and 100 are 2768 and 2473, respectively, and the validation set and test set are both 332 samples.
[0054] The specific steps of step S2 are:
[0055] S21. Build a neural network with Resnet32 as the backbone network;
[0056] S22. Decoupling the neural network by class rebalancing based on the decoupling structure. That is, the neural network is divided into two stages, wherein the first stage is a feature learning network, and the second stage is a feature fine-tuning learning network and a classifier learning network;
[0057] S23. Select the CE loss function as the objective function of the first-stage feature learning network, add weight decay, perform feature learning through the training set, and save the network parameters;
[0058] S24. Load the network parameters of the first stage and train the feature fine-tuning learning network of the second stage through maximum normalization Maxnormal and weight decay;
[0059] S25. Select the IB loss function to train the classifier learning network to obtain an improved citrus fruit tree leaf disease detection model that reduces the long-tail effect.
[0060] The expression of the CE loss function in step S23 is:
[0061]
[0062] Among them, C represents the total number of categories of citrus fruit tree leaf diseases, i represents the category label of citrus fruit tree leaf disease samples, and y i Indicates the true citrus fruit tree leaf disease category label, p i Represents the probability that the predicted citrus fruit tree leaf disease is class label i.
[0063] The weight attenuation in step S23 adopts the L2 norm, and the formula of the weight attenuation is:
[0064]
[0065] Among them, min(·) means taking the minimum value, represents the objective function CE loss function, w and b represent the solution parameters of the feature learning network, α represents the parameter that controls the degree of regularization set by humans, and ||·|| represents the L2 norm.
[0066] The expression of the IB loss function in step S25 is:
[0067]
[0068] Where m represents the number of samples of citrus fruit tree leaf diseases, D m represents the total sample space of citrus fruit tree leaf diseases, θ k represents the weight of the kth citrus leaf disease category, τ(y,f(x,ω)) represents the empirical risk function, x represents the input of the classifier learning network, y represents the true label of the citrus leaf disease, ω represents the parameter in the classifier learning network that needs to be updated by backpropagation, f(x,ω) represents the output of the classifier learning network, h represents the feature vector of the classifier learning network, and ||·||1 represents the L1 norm.
[0069] In this embodiment, different loss functions are combined with network architecture optimization, and a flexible module for introducing long-tail improvement strategies is designed. This method improves the model based on a decoupled structure. In the first phase, regularization is used to improve the network's feature extraction capabilities. In the second phase, a classifier with high performance is trained using a class rebalancing method. The two phases share network weights, significantly reducing the amount of computation while solving the long-tail problem. This makes the method more suitable for field testing and easier to deploy on relatively low-performance edge devices.
[0070] This embodiment selects Resnet32 as the backbone network. Resnet32 consists of four basic residual blocks and has a parameter count of 0.46M. It is a network with fewer parameters in the Resnet series and is widely used in long-tail problems.
[0071] In the first phase, weight decay is added to ResNet32 for feature learning. The network's classifier uses the CE loss function, and the network parameters are saved after feature learning. The CE loss function not only extracts feature information but also gives a higher preference for fewer categories when providing classification results.
[0072] In the second stage, the network parameters of the first stage are loaded, and the maximum value regularization Maxnormal and weight decay Weight Decay are added to perform feature fine-tuning learning. The purpose of the maximum value regularization Maxnormal is to limit the size of the input weight so that ||w|| 2 There is a maximum limit. Fine-tuning learning involves retraining the successfully trained model from the first phase, achieving more accurate training results without significantly impacting existing parameters. The IB loss function is used as the loss function in classifier design to train the classifier. When applied to data from a long-tail distribution, the IB loss function can reduce the weights of classes with large sample sizes at the edges, ensuring that the classifier generates smoother edges and avoids significant deviations from large sample sizes. Therefore, the second phase of fine-tuning the classifier allows for better utilization of the learned feature representations while incorporating a loss on the number of classes, thereby improving long-tail classification accuracy.
[0073] The innovative structure of the improved citrus fruit tree leaf disease detection model of the present invention enables it to be combined with the currently effective long-tail improvement method, making it more compatible.
[0074] In this embodiment, accuracy is selected as the evaluation index model of the orchard leaf disease detection algorithm, and the formula is as follows:
[0075] Precision = TP / (TP+FP)
[0076] Where TP is the corresponding number of correctly detected citrus leaf diseases, and FP is the corresponding number of falsely detected citrus leaf diseases.
[0077] The effect of the improved citrus leaf disease detection model is as follows: Figure 4 and Figure 5 As shown in the figure, the present invention takes the network Resnet32 as the benchmark, and the results show that, for data that conforms to the long-tail distribution, the category rebalancing method based on the decoupling structure can effectively improve the classification problem of the tail class data.
[0078] from Figure 4 It can be seen that when the imbalance degree is 50, although the basic model has a high classification accuracy in the head class, its classification accuracy in the tail class is low. The improved citrus fruit tree leaf disease detection model can effectively improve the classification accuracy of the tail class while maintaining the classification accuracy of the head class samples. Its average accuracy is increased from 50.7% to 78.7%, an increase of 28%.
[0079] like Figure 5 As shown in the figure, when the imbalance degree is 100, the accuracy of the basic model in the classification of the tail class becomes very low, and a serious classifier imbalance has occurred. The improved citrus fruit tree leaf disease detection model can improve the classification accuracy of the tail class while keeping the accuracy of the head class basically unchanged. Moreover, in terms of computation, the improved citrus fruit tree leaf disease detection model shares network parameters, but only trains feature learning and classifier learning in stages. The computational amount does not increase much compared to the original algorithm, but it has achieved significant improvement. Its average accuracy has increased from 41.4% to 79.5%, an increase of 38.1%.
[0080] In summary, the present invention can timely integrate the latest long-tail feature learning methods and classifier design ideas through its cleverly designed structure, and the improved citrus fruit tree leaf disease detection model has the advantages of being universal, lightweight, efficient and stable. At the same time, it achieves the purpose of maintaining the accuracy of head class classification and improving the accuracy of tail class classification in long-tail classification, effectively alleviating the long-tail problem in the detection process of citrus fruit tree leaf diseases in orchards, and is suitable for the problem of low algorithm detection rate caused by data imbalance caused by irregular onset time, type and degree of agricultural diseases, laying the foundation for the automatic monitoring and early warning system of fruit tree diseases in orchards.
Claims
1. A method for reducing the long-tail effect of a citrus leaf disease detection model, characterized in that: The following steps are involved: S1. Collect citrus leaf images by taking photos, construct a citrus leaf dataset using a long-tail exponential decay sampling strategy, and divide the dataset into a training set, a test set, and a validation set. The formula for long-tail exponential decay is: in, Indicates the specific number of samples for each category of citrus fruit tree leaf diseases, Indicates the number of samples of the citrus fruit tree leaf disease category with the largest sample size, Indicates the degree of imbalance, Represents the total number of categories of citrus fruit tree leaf diseases, Indicates the category label of citrus fruit tree leaf disease samples, Indicates the number of samples of the citrus fruit tree leaf disease category with the smallest sample size; S2. Construct a neural network with Resnet32 as the backbone network, decouple the neural network using category rebalancing based on a decoupling structure, and train the decoupled feature learning network and classifier learning network using the training set to obtain an improved citrus leaf disease detection model that reduces the long-tail effect. Specifically, the following is the process: S21. Build a neural network with Resnet32 as the backbone network; S22. Decoupling the neural network by class rebalancing based on the decoupling structure. That is, the neural network is divided into two stages, wherein the first stage is a feature learning network, and the second stage is a feature fine-tuning learning network and a classifier learning network; S23. Select the CE loss function as the objective function of the first-stage feature learning network, add weight decay, perform feature learning through the training set, and save the network parameters; S24. Load the network parameters of the first stage, and train the feature fine-tuning learning network of the second stage through maximum normalization Maxnormal and weight decay, wherein the maximum normalization Maxnormal is used to limit the size of the input weight; S25. Selecting the IB loss function to train the classifier learning network to obtain an improved citrus fruit tree leaf disease detection model that reduces the long-tail effect; S3. Verify the improved citrus fruit tree leaf disease detection model through the test set and the validation set, and perform citrus fruit tree leaf disease detection through the verified citrus fruit tree leaf disease detection model.
2. The method for reducing the long-tail effect of the citrus leaf disease detection model according to claim 1, characterized in that: The expression of the CE loss function in step S23 is: in, Represents the total number of categories of citrus fruit tree leaf diseases, Indicates the category label of citrus fruit tree leaf disease samples, Indicates the true citrus leaf disease category label. Indicates that the predicted citrus fruit tree leaf disease is a category label probability.
3. The method for alleviating the long-tail effect of the citrus leaf disease detection model according to claim 1, characterized in that: The weight attenuation in step S23 adopts the L2 norm, and the formula of the weight attenuation is: in, Indicates taking the minimum value, Represents the objective function CE loss function, and Both represent the solution parameters of the feature learning network, represents the artificially set parameter that controls the degree of regularization, represents the L2 norm.
4. The method for alleviating the long-tail effect of the citrus leaf disease detection model according to claim 1, characterized in that: The expression of the IB loss function is: in, Indicates the number of samples of citrus leaf diseases, represents the total sample space of citrus fruit tree leaf diseases, Indicates the The weight of each citrus fruit tree leaf disease category, represents the empirical risk function, represents the input of the classifier learning network, Indicates the true label of citrus leaf diseases. Represents the parameters that need to be back-propagated and updated within the classifier learning network, represents the output of the classifier learning network, represents the feature vector of the classifier learning network, represents the L1 norm.
Citation Information
Patent Citations
Citrus disease online identification method based on improved InceptionV3
CN115170889A
Long-tail small sample sonar image classification method and system based on deep transfer learning
CN115953631A