A crop pest identification method and system based on a deep ensemble model
By preprocessing and data augmenting pest images using a deep ensemble model, and combining ResNet50, Volo, and Convformer models for identification, the problem of low pest identification accuracy is solved, achieving efficient and accurate pest identification, which has significant economic value.
Patent Information
- Application Number
- CN202310394237.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-13
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2043-04-13
AI Technical Summary
In agricultural production, pest identification is difficult, and traditional methods result in low identification accuracy, which cannot meet the requirements of real-time performance and accuracy, especially in complex backgrounds where the accuracy of pest image identification is low.
A method for identifying crop pests based on a deep ensemble model is adopted. The pest images are preprocessed and data augmented, and prediction is performed using ResNet50, Volo, and Convformer models. The Bagging ensemble algorithm is combined with multiple data augmentation methods to improve the identification accuracy.
It significantly improves the accuracy and efficiency of pest identification, reduces manpower and material costs, and can better guide pest and disease control measures in agricultural production.
Smart Images

Figure CN116524246B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of crop pest identification, specifically a method and system for identifying crop pests based on a deep ensemble model. Background Technology
[0002] In agricultural production, pests and diseases directly impact yields and food safety. According to a 2021 report by the Food and Agriculture Organization of the United Nations, 40% of global crop yields are currently lost annually due to pests. Currently, the annual affected area of crop pests exceeds 400 million hectares, resulting in an annual food loss of 14 million tons. By predicting the development of pests and diseases, agricultural producers can implement targeted and planned control measures to reduce losses.
[0003] In real-world agricultural scenarios, pests are diverse and widespread. The morphological characteristics of the same pest vary significantly at different developmental stages, while some different pests show little difference in morphology at the same growth stage. The data exhibits a pattern of high intraspecific variation and low interspecific variation. Furthermore, the distribution of pest data across different species in nature is uneven, and some pests are too small to be easily identified. Due to these characteristics, identifying crop pests is more challenging than identifying crop diseases. Current results on publicly available large-scale pest datasets indicate that accurate pest identification remains a significant challenge.
[0004] Traditional methods combining manual observation with experience in pest identification are prone to misdiagnosis, leading to the use of incorrect control methods. This not only results in losses of manpower, resources, and production costs but also fails to achieve the desired control effects, failing to meet the demands for real-time and accurate pest and disease forecasting. Furthermore, field-collected pest images often exhibit variations in sampling direction, pest location, and size. Consequently, when identifying large-scale pests and diseases against complex field backgrounds, traditional models cannot effectively focus on the targets in the images, resulting in low identification accuracy. Summary of the Invention
[0005] To overcome the problem of low pest identification accuracy caused by uneven distribution of pest species and complex image backgrounds, this invention proposes a method and system for identifying crop pests based on a deep ensemble model. Compared with other pest identification methods, this method can significantly improve the accuracy of pest identification.
[0006] The technical solution adopted in this invention is as follows:
[0007] A method for identifying crop pests based on a deep ensemble model includes the following process:
[0008] The acquired images of pests to be identified are preprocessed by adjusting the dimensions of the images to be identified to the input dimensions of the ResNet50 model, the Volo model, and the Convformer model, respectively.
[0009] Data augmentation methods are used to enhance the preprocessed image;
[0010] The ResNet50 model was used to predict the pest types in the preprocessed images of pests to be identified, and the first prediction result was obtained.
[0011] The Volo model is used to predict the pest types in the preprocessed images of pests to be identified, and a second prediction result is obtained.
[0012] The Convformer model is used to predict the pest types in the preprocessed images of pests to be identified, and a third prediction result is obtained.
[0013] The Bagging ensemble algorithm is used to integrate the first, second, and third prediction results to obtain the predicted probabilities of the pest categories contained in the existing dataset.
[0014] The pest category with the highest predicted probability among the pest categories contained in the existing dataset is taken as the final pest identification result.
[0015] Preferably, the dimensions of the pest image to be identified are adjusted to the input dimensions of the ResNet50 model, the Volo model, and the Convformer model, respectively, using the RandomResizedCrop method.
[0016] Preferably, the image is enhanced using the RandomErasing data augmentation method, the RandAugment data augmentation method, the Mixup data augmentation method, or the CutMix data augmentation method.
[0017] Preferably, the Token Mixer module used in the Volo model is outlook attention. For each pixel at spatial location (i,j), outlook attention calculates the similarity between the pixel and all neighboring pixels within a K×K local window centered at (i,j).
[0018] The structure of Outlook Attention is as follows:
[0019] For an input tensor X of dimension H×W×C, first use the weights... and The two linear layers project each C-dimensional label as follows: Outlook weights and Value representation;
[0020] make This represents all values within a local window centered at spatial location (i,j):
[0021] Adjust the Outlook weight dimension at spatial location (i,j) to The values are calculated in the form of a function called Softmax, and the result is used as the attention weights for value aggregation. The value mapping is as follows:
[0022]
[0023] Outlook attention densely aggregates representations of mapped values, obtaining the output by summing weighted values from the same location in different local windows:
[0024]
[0025] Where i is the x-coordinate of the spatial location, j is the y-coordinate of the spatial location, K is the size of the local window, H is the length of the input tensor, W is the width of the input tensor, and C is the number of channels of the input tensor. Weight W A The size of the value space, Weight W v The size of the value space, The size of the range of values for Outlook weight A. The value represents the size of the value space of V. This represents all values within a local window centered at spatial location (i,j). for The size of the value space, for The specific formula is as follows: p is the horizontal coordinate offset within the local window, and q is the vertical coordinate offset within the local window. For the value mapping result, This is the final output of Outlook Attention. This maps the values at spatial positions (i,j) in different local windows, where m is the horizontal coordinate offset between local windows and n is the vertical coordinate offset between local windows.
[0026] Preferably, the Outlook attention algorithm is expanded into a multi-head Outlook attention algorithm to achieve parallel computation, with the number of heads set to N and the weights W...A The dimension was adjusted to Then, Outlook Attention and value embedding are uniformly divided into N parts, and the Outlook Attention of the nth part is represented as follows: The value embedding of the nth part is represented as: Where C N Let C represent the dimension of each head, and satisfy C. N ×N=C, for each pair (A n V n Outlook attention is calculated separately, and the results are concatenated as the output of multi-head outlook attention.
[0027] in, Weight W A The size of the value space of A n For the nth part of the outlook attention, V n Embed the value of the nth part. For A n The size of the value space, For V n The size of the value space.
[0028] Preferably, in the Convformer model, the Token Mixer structure used by the Convformer module is a depthwise separable convolutional module. The structure of the depthwise separable convolutional module can be formally represented as follows:
[0029] Convolutions(X) = Conv pw2 (Conv dw (σ(Conv pw1 (X))))
[0030] Where Conv pw1 (·) and Conv pw2 (·) denotes pointwise convolution, Conv dw (·) represents depthwise convolution, and σ(·) represents a nonlinear activation function.
[0031] Preferably, deep transfer learning and fine-tuning strategies are used to train the ResNet50 model, Volo model, and Convformer model respectively:
[0032] The model is trained on the ImageNet dataset for a first preset number of epochs to obtain a pre-trained model. Then, using the transfer learning method, the final classification layer of the pre-trained model is replaced with a fully connected layer whose output dimension is the number of pest species. Finally, the model is trained on the pest training set for a second preset number of epochs using the fine-tuning method. Training is then complete.
[0033] The parameters that need to be set during training include:
[0034] opt: optimizer, of type str, using the 'adamw' optimizer;
[0035] epochs: Number of training epochs, int type; sched: Learning rate update strategy, str type, using 'cosine';
[0036] warmup-epochs: Number of warmup epochs, int type;
[0037] lr: learning rate, float type;
[0038] warmup-lr: learning rate during the warm-up phase, float type;
[0039] min-lr: Minimum learning rate, float type;
[0040] weight-decay: Weight decay strength, float type;
[0041] smoothing: Tag smoothing intensity, float type;
[0042] aa: AutoAugment data augmentation strategy parameter, str type, using 'rand-m9-mstd0.5-inc1';
[0043] mixup: The probability of applying the Mixup data augmentation strategy to the image; a float type.
[0044] cutmix: The probability of applying the CutMix data augmentation strategy to the image; a float type.
[0045] remode: The mode for applying RandomErasing data augmentation to the image, of type str, using 'pixel';
[0046] reprob: The probability of applying the RandomErasing data augmentation strategy to the image; a float type.
[0047] This invention also provides a crop pest identification system based on a deep ensemble model, comprising:
[0048] Preprocessing module: used to preprocess the acquired images of pests to be identified, and adjust the dimensions of the images of pests to be identified to the input dimensions of the ResNet50 model, the input dimensions of the Volo model, and the input dimensions of the Convformer model, respectively.
[0049] Enhancement module: Used to enhance images using data augmentation methods;
[0050] First prediction module: The ResNet50 model is used to predict the pest types in the preprocessed images of pests to be identified, and the first prediction result is obtained.
[0051] The second prediction module uses the Volo model to predict the types of pests in the preprocessed images of pests to be identified, and obtains the second prediction result.
[0052] The third prediction module: uses the Convformer model to predict the types of pests in the preprocessed images of pests to be identified, and obtains the third prediction result.
[0053] Integration module: Used to integrate the first prediction result, the second prediction result and the third prediction result using the Bagging integration algorithm to obtain the predicted probability of the pest categories contained in the existing dataset;
[0054] Identification module: Used to select the pest category with the highest predicted probability from the pest categories contained in the existing dataset as the final pest identification result.
[0055] The present invention also provides an electronic device, comprising:
[0056] One or more processors;
[0057] A storage device on which one or more programs are stored;
[0058] When the one or more programs are executed by the one or more processors, the one or more processors implement the crop pest identification method based on the deep ensemble model described above.
[0059] The present invention also provides a storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the crop pest identification method based on a deep ensemble model as described above.
[0060] The present invention has the following beneficial effects:
[0061] This invention first preprocesses and augments pest images, then integrates three models—ResNet50, Volo, and Convformer—through bagging to achieve pest species identification. This method is more efficient than manual, experience-based identification and provides more accurate predictions than traditional methods, bringing significant economic value to agricultural production. Attached Figure Description
[0062] Figure 1 This is an architecture diagram of the general vision model based on the Transformer architecture in this invention.
[0063] Figure 2 This is a flowchart of the crop pest identification method based on a deep ensemble model used in this invention. Detailed Implementation
[0064] The present invention will now be described in further detail with reference to the accompanying drawings and specific implementation methods.
[0065] This invention addresses the problem of low accuracy in pest identification under complex field conditions. It combines existing deep learning models with improvements, using transfer learning and fine-tuning strategies to train deep networks. Multiple data augmentation methods are applied to enhance the model's robustness against interference, and regularization techniques such as weight decay and label smoothing are used to prevent overfitting. The invention first preprocesses and augments pest images, constructs and pre-trains three deep learning models, then performs transfer learning on the pre-trained models, fine-tuning them on a pest training set with different model parameters to obtain the optimal model. Finally, the three trained models are integrated and tested on a test set to achieve pest species identification.
[0066] The specific steps of the crop pest identification method based on the deep ensemble model of this invention include:
[0067] Step 1: Divide the pest dataset into training set, validation set, and test set;
[0068] Step 2: For an image of a pest to be identified, adjust the image to a size suitable for the input dimensions of ResNet50, Volo, and Convformer models using the RandomResizedCrop method, and then use data augmentation methods to enhance the image.
[0069] Step 3: Construct the ResNet50 model, the Volo model, and the Convformer model;
[0070] Step 4: Train the model from Step 3 using deep transfer learning and fine-tuning strategies respectively;
[0071] Step 5: Use the Bagging ensemble algorithm to integrate the models (Resnet50, Volo, and Convformer) trained in Step 4 above to obtain the predicted probabilities of existing pest categories in the dataset.
[0072] Step 6: Select the pest category with the highest predicted probability as the final identification result.
[0073] The following is a supplementary introduction to some technical solutions:
[0074] For step 2, the data augmentation methods used in this invention include RandomErasing, RandAugment, Mixup, and CutMix. RandomErasing works by randomly erasing a rectangular region from an image without changing the original label. RandAugment randomly selects N augmentation operations from a set of data augmentation operations, each with an augmentation magnitude of M. Mixup randomly linearly combines two different images, simultaneously generating a linearly combined label. CutMix is a data augmentation strategy similar to MixUp, also simultaneously mixing two images and labels. However, unlike MixUp, CutMix does not linearly combine two images; instead, it randomly cuts a patch from another image and pastes it onto the first image.
[0075] The ResNet50 model in step 3 is a general-purpose residual network, widely used in image recognition due to its good performance. The Volo and Convformer models are Transformer-based network architectures. The architecture of each module in the general vision model of the Volo and Convformer models is as follows: Figure 1 As shown, each module generally consists of two parts: a Token Mixer module for fusing spatial location information and a Channel MLP module for fusing channel information. When the Token Mixer takes different forms, the general visual model also transforms into different types.
[0076] The Token Mixer module of the Volo model is called outlook attention. For each pixel at spatial location (i,j), outlook attention calculates the similarity between that pixel and all neighboring pixels within a K×K local window centered at (i,j). The structure of outlook attention can be formally described as follows:
[0077] For an input tensor X of dimension H×W×C, first use the weights as... and The two linear layers project each C-dimensional label as follows: Outlook weights and Value representation. Let This represents all values within a local window centered at (i,j), i.e.:
[0078]
[0079] Adjust the Outlook weight dimension at position (i,j) to The value mapping is in the form of a function called Softmax, and the result is directly used as the attention weight for value aggregation. Therefore, the value mapping is represented as:
[0080]
[0081] Outlook attention intensively aggregates representations of mapped values. The output is obtained by summing weighted values from the same location in different local windows:
[0082]
[0083] To improve the model's efficiency, the Outlook Attention algorithm can be expanded into a multi-head Outlook Attention algorithm for parallel computation. Assuming the number of heads is N, it is only necessary to adjust the weights W... A The dimension was adjusted to Then, Outlook attention and value embedding are uniformly divided into N parts, and the Outlook attention of the nth part is represented as follows: The value embedding of the nth part is represented as: Where C N Let C represent the dimension of each head, and satisfy C. N ×N=C. For each pair (A) n V n Outlook attention is calculated separately and then concatenated as the output of multi-head outlook attention.
[0084] The Token Mixer structure used by Convformer is a depthwise separable convolutional module. The structure of a depthwise separable convolutional module can be formally represented as:
[0085] Convolutions(X) = Conv pw2 (Conv dw (σ(Conv pw1(X)))), (4)
[0086] Where Conv pw1 (·) and Conv pw2 (·) denotes pointwise convolution, Conv dw (·) represents depthwise convolution, and σ(·) represents a nonlinear activation function.
[0087] In step 4, the parameters that need to be set when training the model are as follows:
[0088] opt: optimizer, str type, with optional parameters such as 'sgd', 'adam', 'adamw', 'lamd', etc. The default is the 'adamw' optimizer, which uses the adamw algorithm to update the training parameters.
[0089] epochs: Number of training epochs, int type, optional parameter, default is 300.
[0090] sched: Learning rate update strategy, str type, optional parameters include 'step', 'cosine', 'RMSProp', 'AdaDelta', etc., the default is 'cosine'.
[0091] warmup-epochs: Number of warm-up epochs, int type, optional parameter, defaults to 5. The model is unstable in the initial training phase, and the learning rate in the first few epochs needs to be set very small to ensure good convergence of the network.
[0092] lr: Learning rate, float type, optional parameter, defaults to 0.05.
[0093] warmup-lr: Learning rate during the warmup phase, float type, optional parameter, defaults to 1e. -6 .
[0094] min-lr: Minimum learning rate, float type, optional parameter, defaults to 1e. -5
[0095] weight-decay: Weight decay strength, float type, optional parameter, defaults to 0.05, is a commonly used regularization method.
[0096] smoothing: Label smoothing intensity, float type, optional parameter, optional range is [0,1], default is 0.1. Label smoothing is a regularization method to prevent model overfitting.
[0097] aa: AutoAugment data augmentation strategy parameter, str type, optional parameters are 'v0', 'original' and 'rand-m9-mstd0.5-inc1', the default is 'rand-m9-mstd0.5-inc1'.
[0098] mixup: The probability of applying the Mixup data augmentation strategy to the image. It is a float type, an optional parameter, and the range is [0,1]. The default value is 0.8.
[0099] cutmix: The probability of applying the CutMix data augmentation strategy to the image. It is a float type, an optional parameter, and the range is [0,1]. The default value is 1.0.
[0100] remode: The mode for applying the RandomErasing data augmentation strategy to the image. It is of type str and has optional parameters 'const', 'rand', and 'pixel', with the default being 'pixel'.
[0101] reprob: The probability of applying the RandomErasing data augmentation strategy to the image. It is a float type, an optional parameter, and can be in the range [0,1]. The default value is 0.25.
[0102] The optimal results of the above model parameters were obtained by validating different parameters on the validation set, and the trained model was used for final pest identification.
[0103] For step 5, this invention uses the Bagging ensemble algorithm to combine the prediction structures of the ResNet50 model, Volo model, and Convformer model, thus reducing the variance and generalization error of the model predictions. Specifically, the prediction results of all member models for each sample are summed and then divided by the total number of members in the ensemble; the final prediction result is the class with the highest probability. Assuming there are T member models and a classification task with Z classes, P... tz Let t = 1, ..., T be the predicted probabilities of the model for each class z = 1, ..., Z. The ensemble result can be calculated using the following formula:
[0104]
[0105] Where P z Let z be the predicted probability of category z.
[0106] To verify the effectiveness of the crop pest identification method based on a deep ensemble model proposed in this invention, IP102 was used as the experimental dataset. The identification results on the validation set and the test set are shown in Table 1:
[0107] Table 1
[0108]
[0109] The results in Table 1 show that the recognition accuracy of the two-model ensemble is generally higher than that of the individual models, and the recognition accuracy of the three-model ensemble is the highest, even 3% higher than that of the ResNet50 single model.
[0110] This invention employs deep learning, using transfer learning and fine-tuning strategies to train multiple deep networks for feature extraction and classification of pest images. Various data augmentation strategies are utilized to enhance the robustness of the models. The models with the highest accuracy are selected for Bagging ensemble, and a voting strategy is used to determine the pest category. This method provides accurate identification results and offers valuable guidance for predicting pest development dynamics and implementing preventative control measures in advance.
[0111] Example
[0112] The crop pest identification method based on the deep ensemble model in this embodiment includes the following steps:
[0113] Step 1: Obtain the dataset. Download publicly available data from the internet or take targeted photos to obtain as much pest data as possible. Divide the obtained pest data into training, validation, and test sets in a 7:1:2 ratio.
[0114] Step 2: Image Preprocessing and Data Augmentation. The images of the pests to be identified are preprocessed using RandomResizedCrop to obtain input images with a resolution of 224×224 or 384×384 (224×224 for ResNet50 input images, and 384×384 for Volo and Convformer input images). Then, data augmentation methods are used to augment the input images.
[0115] Step 3: Model Building. Build the ResNet50 model, Volo model, and Convformer model. The ResNet50 model uses a traditional model architecture with a total of 24M parameters.
[0116] The Volo model first performs 8x downsampling on the input image for Patch Embedding. The first stage of the model has 4 layers, using the Token Mixer module for outlook attention. Each layer has 6 heads, a local window size of 3×3, 3 MLP layers, and a feature embedding length of 192. The feature embedding is then downsampled by 2x. The second stage of the model has 14 layers, using the Token Mixer module for self-attention in Transformer. It has 12 heads, 3 MLP layers, a feature embedding length of 384, and a total of 26M parameters.
[0117] The Convformer model consists of four stages. Each stage first downsamples the feature embeddings from the previous stage. The Token Mixer structure of the four stages is a depthwise separable convolutional module. The feature embedding lengths of the four stages are 64, 128, 320 and 512 respectively, and the number of modules are 2, 2, 6 and 2 respectively.
[0118] Step 4: Train the model. First, train the model from Step 3 on the ImageNet dataset for 300 epochs to obtain a pre-trained model. Then, using transfer learning, replace the final classification layer of the pre-trained model with a fully connected layer whose output dimension is the number of pest species. On the pest training set obtained in Step 1, fine-tune the model for 150 epochs. During the training process, refer to the parameters described in Step 4 above for the selection of other parameters.
[0119] Step 5: Input the images in the test set into each trained model to obtain the prediction results of each model. Finally, use the Bagging ensemble algorithm to obtain the probability values of the ensemble model's predictions for each category. The category with the highest probability value is the final prediction result of the ensemble model.
[0120] In summary, this invention addresses the problem of low accuracy in pest identification under complex field conditions. It combines existing deep learning models with improvements, using transfer learning and fine-tuning strategies to train deep networks. Multiple data augmentation methods are applied to enhance the model's robustness against interference, and regularization techniques such as weight decay and label smoothing are used to prevent overfitting. This invention first preprocesses and augments pest images, constructs and pre-trains three deep learning models, then performs transfer learning on the pre-trained models, fine-tuning them on the pest training set with different model parameters to obtain the optimal model. Finally, the three trained models are integrated and tested on a test set to achieve pest identification. This method proposes a deep ensemble model-based method for identifying crop pests, which is more efficient than manual experience-based identification methods and provides more accurate predictions than traditional methods, bringing significant economic value to agricultural production.
Claims
1. A method for identifying crop pests based on a deep ensemble model, characterized in that, The process includes the following: The acquired images of pests to be identified are preprocessed by adjusting the dimensions of the images to be identified to the input dimensions of the ResNet50 model, the Volo model, and the Convformer model, respectively. Data augmentation methods are used to enhance the preprocessed image; The ResNet50 model was used to predict the pest types in the preprocessed images of pests to be identified, and the first prediction result was obtained. The Volo model is used to predict the pest class in the preprocessed image of pests to be identified, resulting in a second prediction result. The Volo model uses the Token Mixer module for outlook attention, which is applied to each spatial location. For each pixel, Outlook Attention calculates the pixel's relationship with the pixel in the array. Centered Similarity of all neighboring pixels within a local window of a certain size; The structure of Outlook Attention is as follows: For dimension The input tensor X is first weighted by... and The two linear layers will each C dimensional label projection is Outlook weights and Value representation; make Indicated by spatial location All values within the centered local window: ; spatial location The Outlook weighting dimension was adjusted to The values are calculated in the form of a function called Softmax, and the result is used as the attention weights for value aggregation. The value mapping is as follows: Outlook attention densely aggregates representations of mapped values, obtaining the output by mapping and summing values from the same location in different local windows: in, The x-coordinate of the spatial location. The vertical coordinate is the coordinate of the spatial location. This refers to the size of a local window. For the length of the input tensor, For the width of the input tensor, The number of channels in the input tensor. For weight The size of the value space, For weight The size of the value space, For Outlook weights The size of the value space, Value represents The size of the value space, Based on spatial location All values within the centered local window. for The size of the value space, for The specific formula for expression, p This represents the horizontal coordinate offset within the local window. q This represents the offset of the vertical coordinate within the local window. For the value mapping result, This is the final output of Outlook Attention. Spatial position in different local windows Value mapping at that location, m This represents the horizontal coordinate offset between local windows. n This represents the offset of the ordinate between local windows; The Convformer model is used to predict the pest types in the preprocessed images of pests to be identified, and a third prediction result is obtained. The Bagging ensemble algorithm is used to integrate the first, second, and third prediction results to obtain the predicted probabilities of the pest categories contained in the existing dataset. The pest category with the highest predicted probability among the pest categories contained in the existing dataset is taken as the final pest identification result.
2. The method for identifying crop pests based on a deep ensemble model according to claim 1, characterized in that, The dimensions of the pest images to be identified are adjusted using the RandomResizedCrop method to be the input dimensions of the ResNet50 model, the Volo model, and the Convformer model, respectively.
3. The method for identifying crop pests based on a deep ensemble model according to claim 1, characterized in that, The images are augmented using RandomErasing, RandAugment, Mixup, or CutMix data augmentation methods.
4. The method for identifying crop pests based on a deep ensemble model according to claim 1, characterized in that, The Outlook Attention algorithm is expanded into a multi-head Outlook Attention algorithm for parallel computation, with the number of heads set to [number to be specified]. N , weight The dimensions were adjusted to Then Outlook attention and value embedding were uniformly categorized as N Part 1, Section 2 n The Outlook attention for each part is represented as follows: , No. n The value embedding of each part is represented as , ,in Represent the dimension of each head, and satisfy... For each pair Outlook attention is calculated separately and then concatenated as the output of multi-head outlook attention. in, For weight The size of the value space, For the first n Outlook attention for each part For the first n Value embedding of each part for The size of the value space, for The size of the value space.
5. The method for identifying crop pests based on a deep ensemble model according to claim 1, characterized in that, In the Convformer model, the Token Mixer structure used by the Convformer module is a depthwise separable convolutional module. The structure of the depthwise separable convolutional module can be formally represented as: in and This represents pointwise convolution. Represents depthwise convolution. This represents a non-linear activation function.
6. The method for identifying crop pests based on a deep ensemble model according to claim 1, characterized in that, The ResNet50 model, Volo model, and Convformer model were trained using deep transfer learning and fine-tuning strategies, respectively. The model is trained on the ImageNet dataset for a first preset number of epochs to obtain a pre-trained model. Then, using the transfer learning method, the final classification layer of the pre-trained model is replaced with a fully connected layer whose output dimension is the number of pest species. Finally, the model is trained on the pest training set for a second preset number of epochs using the fine-tuning method. Training is then complete. The parameters that need to be set during training include: opt: optimizer, of type str, using the 'adamw' optimizer; epochs: Number of training epochs, int type; sched: Learning rate update strategy, str type, using 'cosine'; warmup-epochs: Number of warmup epochs, int type; lr: learning rate, float type; warmup-lr: learning rate during the warm-up phase, float type; min-lr: Minimum learning rate, float type; weight-decay: Weight decay strength, float type; smoothing: Tag smoothing intensity, float type; aa: AutoAugment data augmentation strategy parameter, str type, using 'rand-m9-mstd0.5-inc1'; mixup: The probability of applying the Mixup data augmentation strategy to the image; a float type. cutmix: The probability of applying the CutMix data augmentation strategy to the image; a float type. remode: The mode for applying the RandomErasing data augmentation strategy to the image, of type str, using 'pixel'; reprob: The probability of applying the RandomErasing data augmentation strategy to the image; a float type.
7. A crop pest identification system based on a deep ensemble model, characterized in that, include: Preprocessing module: used to preprocess the acquired images of pests to be identified, and adjust the dimensions of the images of pests to be identified to the input dimensions of the ResNet50 model, the input dimensions of the Volo model, and the input dimensions of the Convformer model, respectively. Enhancement module: Used to enhance images using data augmentation methods; First prediction module: The ResNet50 model is used to predict the pest types in the preprocessed images of pests to be identified, and the first prediction result is obtained. The second prediction module uses the Volo model to predict the pest types in the preprocessed images of pests to be identified, obtaining a second prediction result. The Volo model uses the Token Mixer module for outlook attention, which performs lookup attention for each spatial location. For each pixel, Outlook Attention calculates the pixel's relationship with the pixel in the array. Centered Similarity of all neighboring pixels within a local window of a certain size; The structure of Outlook Attention is as follows: For dimension The input tensor X is first weighted by... and The two linear layers will each C dimensional label projection is Outlook weights and Value representation; make Indicated by spatial location All values within the centered local window: ; spatial location The Outlook weighting dimension was adjusted to The values are calculated in the form of a function called Softmax, and the result is used as the attention weights for value aggregation. The value mapping is as follows: Outlook attention densely aggregates representations of mapped values, obtaining the output by mapping and summing values from the same location in different local windows: in, The x-coordinate of the spatial location. The vertical coordinate is the coordinate of the spatial location. This refers to the size of a local window. For the length of the input tensor, For the width of the input tensor, The number of channels in the input tensor. For weight The size of the value space, For weight The size of the value space, For Outlook weights The size of the value space, Value represents The size of the value space, Based on spatial location All values within the centered local window. for The size of the value space, for The specific formula for expression, p This represents the horizontal coordinate offset within the local window. q This represents the offset of the vertical coordinate within the local window. For the value mapping result, This is the final output of Outlook Attention. Spatial position in different local windows Value mapping at that location, m This represents the horizontal coordinate offset between local windows. n This represents the offset of the ordinate between local windows; The third prediction module: uses the Convformer model to predict the types of pests in the preprocessed images of pests to be identified, and obtains the third prediction result. Integration module: Used to integrate the first prediction result, the second prediction result and the third prediction result using the Bagging integration algorithm to obtain the predicted probability of the pest categories contained in the existing dataset; Identification module: Used to select the pest category with the highest predicted probability from the pest categories contained in the existing dataset as the final pest identification result.
8. An electronic device, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the crop pest identification method based on a deep ensemble model as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, It stores a computer program, wherein the computer program, when executed by a processor, implements the crop pest identification method based on a deep ensemble model as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Lepidoptera pest identification method based on neural network model
CN111160355A
Rice pest identification method based on improved residual network
CN113610108A