The dataset used in this study consists of 6,410 images (DOI: 10.17632/bycbh73438.1). Labels represent feeding damage patterns rather than observed insect bodies. The class-wise distribution of the stratified dataset split with Seed 42 is detailed in Table 1.
Diabrotica speciosa is the most common species of Chrysomelidae found in soybean crops. This pest prefers soft leaves and creates small, round holes when feeding. It also cuts the edges of the leaves. Adult Diabrotica speciosa is a leaf-eating pest that can cause direct damage to flowers and pods.
The dataset used in this study consists of 6,410 images collected using smartphones and unmanned aerial vehicles (UAVs) from actual soybean farms in Mato Grosso State, Brazil
(Mignoni et al., 2021). The dataset has high field suitability as it includes variables of the actual open-field environment, such as sunlight, clouds, wind and shadows. The dataset used in this study was classified into a total of three classes. The normal class consisted of 896 healthy soybean leaves without pest damage, 3,309 leaves with missing leaves caused by Caterpillar and 2,205 leaves with fine feeding marks and discoloration caused by Diabrotica Speciosa. Additionally, data augmentation was performed to further increase the volume of data.
In this study, to address class imbalance and enhance the model’s generalization ability, 45°, 90° and 180° rotation augmentation were applied based on existing 500 * 500 pixel images. In addition, Random Resized Crop and Color Jittering techniques were used in parallel to accommodate various shooting altitudes and changes in illumination, thereby ensuring diversity in the training data. Fig 1 is a sample of the dataset for this study.
Advanced-ResNet-20
On-the-fly augmentation protocol includes CutMix (alpha=1.0), MixUp (alpha=0.4), RandomResizedCrop (224), rotation (+-15) and color jitter.
The layer specifications and structural parameters of Attention-ResNet-20 are summarized in Table 2.
The overall architecture and structural design of the proposed learning model are illustrated in Fig 2. The description of Fig 2 is as follows:
(1). The input layer (Input layer and initial conv layer) has two layers. The input layer receives a soybean leaf image of size 24 × 224 × 3 as input. The initial conv layer extracts basic visual features from the image and reduces the size of the data through the first convolution layer (3 * 3 filter, Stride 2, ReLU activation function).
(2). The learning stage (Stage 1, 2, 3) is the section where the learning operations of this model are performed and blocks are repeated from stage 1 to stage 3. Channels and spatial attention are combined in this learning stage.
The residual block selected skip connections to prevent vanishing gradients, a drawback of the basic CNN learning method and to resolve the issue of getting stuck in local solutions. Its role is to enable the extraction of effective features as the network structure deepens. Channels and spatial attention were added to this block.
CBAM attention mechanism is defined by channel attention Ms(F) and spatial attention Mc(F)
(Woo et al., 2018). Ms(F) = σ[MLP(AvgPool(F)] + MLP(MaxPool(F), while Mc(F) = σ(f7×7)[AvgPool(F); MaxPool(F)].
The experimental training hyperparameters and computational setup are presented in Table 3.
The attention mechanism of this model enables the learning model to reduce training time and increase accuracy by focusing only on important channel information, such as color and texture, as well as specific locations on leaves damaged by pests-specifically, those with holes or tears.
(3). Down sampling block
Located between stages, it uses 1 × 1 and 3 × 3 convolutions to adjust the size of feature maps and increase computational efficiency.
(4). Classification head
This is the section where the final decision is made based on the learned features.
Global average pooling (GAP) Calculates the average value of each channel to compress features into a single vector. This reduces the number of parameters and prevents overfitting.
Fully connected (Dense) and softmax synthesizes the compressed information to calculate the final probability for each class.
(5). Output
The model ultimately classifies the input image into one of the following three categories: Caterpillar, Diabrotica speciosa or normal.
This figure simplifies the series of processes in which an original image is input, learned by selecting only important parts through an attention mechanism and finally identified as the type of pest causing the damage. The proposed learning structure is designed to improve the accuracy of soybean pest diagnosis in this study.
The implementation environment of the model in this study is as follows. The loss function was used to address the imbalance in existing training models, where the number of normal leaves is significantly smaller than the data for pest-damaged leaves; therefore, higher weights were assigned to normal leaves. The optimization algorithm utilized the Adam optimization tool, which is commonly used in most studies. Performance evaluation metrics included Accuracy, Precision, Recall and F1-score. To resolve the imbalance in the dataset, the recognition rate for the normal dataset was evaluated.
The model in this study was trained using the PyTorch framework based on Python. Training was performed using an NVIDIA RTX series GPU environment. The model parameters were taken from those used in the ResNet-20 in previous studies and an attention model was added to prevent computation time from becoming too long.