Image-based Classification of Soybean Pest Damage using an Attention-enhanced ResNet-20

M
Malrey Lee1,*
1Future Artificial Intelligence Technology, Baekje-daero, Deokjin-gu, Jeonju-si, Jeonbuk-do, 54896, Republic of Korea.
  • Submitted26-06-2026|

  • Accepted03-10-2026|

  • First Online 22-10-2026|

  • doi 10.18805/LRF-968

Background: Soybeans are primarily cultivated in open fields. In such environments, it is very difficult for experts to be deployed in real-time to diagnose pests. While deep learning offers promising diagnostic capabilities, standard convolutional neural networks often place heavy computational burdens on resource-constrained agricultural edge devices. 

Methods: In this paper, we propose an Advanced-ResNet-20 model that combines channel and spatial attention (CBAM) with the ResNet-20 structure. The model was evaluated on an independent stratified test partition (n = 641, seed 42) with data augmentations applied strictly on-the-fly to training batches only.

Result: The model achieved a test accuracy of 89.70% (91.11% with test-time augmentation), representing a 5.14% p improvement over the retrained baseline ResNet-20 (84.56%). With only 309,541 parameters (1.18 MB in FP32) and 1.01 GFLOPs, the proposed architecture provides a practical lightweight solution suitable for prospective deployment on mobile and drone hardware.

As the global food security crisis intensifies due to population growth and climate change, there is a strong demand for eco-friendly and sustainable agricultural practices. In particular, soybeans are a major global oilseed crop with high economic value, but pest infestations during cultivation are a critical cause of yield reduction (Mangang, 2017). This study focuses on foliar feeding damage in Mato Grosso, Brazil. The most common pests analyzed are caterpillars and the cucumber leaf beetle (Diabrotica speciosa) (Mignoni, 2021; Mishra et al., 2022).
       
Before the advent of automated pest diagnosis systems, pest diagnosis in open-field environments relied on visual inspection by experts or those with extensive farming experience. Consequently, it was difficult to implement preventive measures, which could only be taken after massive pest damage had already occurred. This made it impossible to actively prevent pest damage. Furthermore, pest monitoring became even more challenging as the farm area grew larger. To overcome this, automated pest detection and classification technologies utilizing artificial intelligence (Shuli et al., 2020), particularly convolutional neural networks (CNN), have recently been actively researched in the field of precision agriculture (Priti et al., 2026; Thippanna et al., 2023; Thenmozhi et al., 2019; Yamashita et al., 2018).
       
A recent prior study reported an accuracy of approximately 86.58% in an attempt to classify soybean pests using ResNet-20, a lightweight residual network (Cho, 2025).
       
However, the study failed to adequately reflect the characteristics of the dataset collected in actual open-field environments, such as variations in wind and sunlight and complex backgrounds.
       
In this study, we propose an Advanced ResNet-20 model that combines channel and spatial attention modules (CBAM) to maximize feature extraction in the existing ResNet-20 model. The architectural objective of feature attention is separated from the imbalance-handling strategy, which utilizes class-weighted categorical cross-entropy. This model is designed to predict the exact type of pest by selecting and emphasizing important feature channels.
       
The training data is from the public dataset of Mignoni (2021). The proposed Advanced ResNet-20 achieved a test accuracy of 89.70%, an improvement of +5.14% p over the identically retrained baseline ResNet-20 (84.56%).
    
The results of this study will provide a technical foundation that can be installed in future UGV (unmanned ground vehicle) or drone systems to perform precise pest diagnosis and production yield prediction in real time, even in low-spec hardware environments.
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.

Table 1: Stratified dataset split by class (Seed 42).


       
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.

Fig 1: Class of dataset.


 
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.

Table 2: Layer specifications and structural parameters of attention-ResNet-20.


       
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.

Fig 2: Structure of the proposed learning model.


       
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.

Table 3: Experimental training hyperparameters and computational setup.


    
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.
The advanced-ResNet-20 model was trained for 50 epochs and exhibited very stable characteristics on both training and validation data. Fig 3 is a graph showing the training and validation of the model in this study. As can be seen in Fig 3, the accuracy exceeded 90% in the first 10 epochs. This indicates that channel and spatial attention effectively learned to separate the features of pest damage on soybean leaves and the complex backgrounds of images acquired in open-field environments from the beginning. Ultimately, this model recorded a test accuracy of 89.70%, which is an improvement of approximately 5.14% compared to 86.58% in a previous study (Cho, 2025).

Fig 3: Training and validation performance.


       
The validation loss curve was similar to the training curve and converged to less than 0.05. This signifies that the model proposed in this study has resolved overfitting. Furthermore, it is evidence that the imbalance in the training data was resolved by efficiently adjusting the focal loss by assigning high training weights to normal leaves, which have fewer training samples.
       
The training and validation performance curves across epochs are illustrated in Fig 3.
       
In Fig 3, Accuracy is the blue graph. It maintains stability starting from 20 epochs and the Training and Validation graphs converge near 89.70%. Loss is the red graph. The initial loss value decreased very steeply. At the final convergence epoch, the Validation Loss curve was less than 0.05. This is evidence that the model is not overfitting the dataset. This dramatic improvement in learning accuracy is due to the ratio of weights assigned to the training data. Advanced-ResNet-20 did not assign equal weights to all types of training data; instead, it assigned higher weights to normal leaves, which had less training data. As a result, it resolved the imbalance across all types of training data. Additionally, channel attention was used to focus on the specific colors of damage caused by different pests, the irregularly distributed larval defects within the leaves and the small holes created by cucumber leaf beetles.
       
Table 4 summarizes the multi-class performance metrics evaluated on the held-out test partition.

Table 4: Diagnostic performance on held-out test set (n=641).


    
Focal loss ablation discussion: Focal loss degraded accuracy to 83.15%, possibly due to excessive weighting on minority class samples causing overfitting on subtle patterns. 
       
The verified confusion matrix for the test dataset (n=641) is detailed in Table 5.

Table 5: Verified confusion matrix (Test n=641).


       
The confusion matrix and corresponding error analysis for the test predictions are illustrated in Fig 4.

Fig 4: Confusion matrix and error analysis.


       
This matrix visually demonstrates the classification distribution across all classes on the held-out test set (n = 641). As documented in Table 5, the model correctly classified 310 out of 331 caterpillar samples (93.66% recall), 192 out of 220 Diabrotica speciosa samples (87.27% recall) and 73 out of 90 normal samples (81.11% recall), achieving an overall accuracy of 89.70% (575 correct predictions out of 641 test images).
       
The visual comparative analysis of feature representations and attention maps generated by the evaluated models is illustrated in Fig 5.

Fig 5: Visualization and attention map comparative analysis.


    
The visualization results in Fig 5 clearly suggest the superiority of this model. Generalization is assessed on the independent test set partition (89.70% accuracy) rather than validation loss .
       
The improvement in accuracy was achieved by applying channels and spatial attention structures. Although the model recognized data accurately, on-device hardware latency on physical microcontrollers was not measured and is designated for future research.
       
A computational complexity comparison among the evaluated models, in terms of parameters and inference overhead, is summarized in Table 6.

Table 6: Complexity comparison.

This study proposes an Advanced-ResNet-20 model for the classification of soybean pests. A test accuracy of 89.70% (91.11% with TTA) was achieved. The study is limited by the lack of external multi-farm validation. Furthermore, field robotic/UGV/drone trials were not conducted in this study.
       
In future research, we plan to conduct field validation tests by integrating this model into actual unmanned ground vehicles (UGVs) and real-time video streaming systems. Furthermore, we aim to expand the scope to diagnose pests and complex diseases in other crops, such as corn and wheat, in addition to soybeans, thereby developing it into a universal AI solution for global food security and the enhancement of agricultural productivity.
None.
 
Disclaimers
 
The views and conclusions expressed in this article are solely those of the authors and do not necessarily represent the views of their affiliated institutions. The authors are responsible for the accuracy and completeness of the information provided, but do not accept any liability for any direct or indirect losses resulting from the use of this content.
 
Data availability
 
The public dataset analyzed in this study is available on mendeley data (DOI: 10.17632/bycbh73438.1). Stratified train/validation/test split index files (split_seed42.json) and model checkpoints are archived to ensure independent verification.
 
Informed consent
 
Not applicable.
 The authors declare that there are no conflicts of interest regarding the publication of this article. No funding or sponsorship influenced the design of the study, data collection, analysis, decision to publish, or preparation of the manuscript.

  1. Cho, O.H. (2025). Deep learning-driven precision agriculture: Application of ResNet-20 for the early detection and classification of soybean insect pests under real-world constraints. Legume Research-An International Journal. 48(7): 1215-1221. doi: 10.18805/LRF-844.

  2. Mangang, C.A., Devi, T.M. and Singh, N.G. (2017). Seasonal incidence of insect pests of soybean in relation to weather parameters. Legume Research-An International Journal. 40(6): 1139-1140. doi: 10.18805/LR-3482.

  3. Mignoni, M.E. (2021). Images of Soybean Leaves [Data set]. Mendeley Data, V1. https://doi.org/10.17632/bycbh73438.1.

  4. Mishra, N., Tripathi, M.K., Tiwari, S., Tripathi, N. and Trivedi, H.K. (2022). Morphological and molecular screening of soybean genotypes against yellow mosaic virus disease. Legume Research. 45(10): 1309-1316. doi: 10.18805/LR-4240. 

  5. Priti, P.S., Sharma, P. and Kumar, R. (2026). Estimation of losses due to insect pests in soybean. Indian Journal of Entomology. 88(1): 45-52. https://doi.org/10.55446/IJE.2025.2360.

  6. Shuli, X. and Lee, M. (2020). Classification accuracy improvement for small-size citrus pests and diseases using bridge connections in deep neural networks. Sensors. 20(17): 4992. https://doi.org/10.3390/s20174992.

  7. Thenmozhi, K. and Reddy, U.S. (2019). Crop pest classification based on deep convolutional neural network and transfer learning. Computers and Electronics in Agriculture. 164:  104906. https://doi.org/10.1016/j.compag.2019.104906.

  8. Thippanna, G., Priya, M.D. and Srinivas, T.A.S. (2023). An effective analysis of image processing with deep learning algorithms. International Journal of Computer Applications. 185(27): 1-5. https://doi.org/10.5120/ijca2023923014.

  9. Woo, S., Park, J., Lee, J.Y. and Kweon, I.S. (2018). CBAM: Convolutional Block Attention Module. In Proceedings of the European Conference on Computer Vision (ECCV). Springer. (pp. 3-19). https://link.springer.com/chapter/10.1007/978-3-030- 01234-2_1.

  10. Yamashita, R., Nishio, M., Do, R.K.G. and Togashi, K. (2018). Convolutional neural networks: An overview and application in radiology. Insights into Imaging. 9(4): 611- 629. https://doi.org/10.1007/s13244-018-0639-9.

Image-based Classification of Soybean Pest Damage using an Attention-enhanced ResNet-20

M
Malrey Lee1,*
1Future Artificial Intelligence Technology, Baekje-daero, Deokjin-gu, Jeonju-si, Jeonbuk-do, 54896, Republic of Korea.
  • Submitted26-06-2026|

  • Accepted03-10-2026|

  • First Online 22-10-2026|

  • doi 10.18805/LRF-968

Background: Soybeans are primarily cultivated in open fields. In such environments, it is very difficult for experts to be deployed in real-time to diagnose pests. While deep learning offers promising diagnostic capabilities, standard convolutional neural networks often place heavy computational burdens on resource-constrained agricultural edge devices. 

Methods: In this paper, we propose an Advanced-ResNet-20 model that combines channel and spatial attention (CBAM) with the ResNet-20 structure. The model was evaluated on an independent stratified test partition (n = 641, seed 42) with data augmentations applied strictly on-the-fly to training batches only.

Result: The model achieved a test accuracy of 89.70% (91.11% with test-time augmentation), representing a 5.14% p improvement over the retrained baseline ResNet-20 (84.56%). With only 309,541 parameters (1.18 MB in FP32) and 1.01 GFLOPs, the proposed architecture provides a practical lightweight solution suitable for prospective deployment on mobile and drone hardware.

As the global food security crisis intensifies due to population growth and climate change, there is a strong demand for eco-friendly and sustainable agricultural practices. In particular, soybeans are a major global oilseed crop with high economic value, but pest infestations during cultivation are a critical cause of yield reduction (Mangang, 2017). This study focuses on foliar feeding damage in Mato Grosso, Brazil. The most common pests analyzed are caterpillars and the cucumber leaf beetle (Diabrotica speciosa) (Mignoni, 2021; Mishra et al., 2022).
       
Before the advent of automated pest diagnosis systems, pest diagnosis in open-field environments relied on visual inspection by experts or those with extensive farming experience. Consequently, it was difficult to implement preventive measures, which could only be taken after massive pest damage had already occurred. This made it impossible to actively prevent pest damage. Furthermore, pest monitoring became even more challenging as the farm area grew larger. To overcome this, automated pest detection and classification technologies utilizing artificial intelligence (Shuli et al., 2020), particularly convolutional neural networks (CNN), have recently been actively researched in the field of precision agriculture (Priti et al., 2026; Thippanna et al., 2023; Thenmozhi et al., 2019; Yamashita et al., 2018).
       
A recent prior study reported an accuracy of approximately 86.58% in an attempt to classify soybean pests using ResNet-20, a lightweight residual network (Cho, 2025).
       
However, the study failed to adequately reflect the characteristics of the dataset collected in actual open-field environments, such as variations in wind and sunlight and complex backgrounds.
       
In this study, we propose an Advanced ResNet-20 model that combines channel and spatial attention modules (CBAM) to maximize feature extraction in the existing ResNet-20 model. The architectural objective of feature attention is separated from the imbalance-handling strategy, which utilizes class-weighted categorical cross-entropy. This model is designed to predict the exact type of pest by selecting and emphasizing important feature channels.
       
The training data is from the public dataset of Mignoni (2021). The proposed Advanced ResNet-20 achieved a test accuracy of 89.70%, an improvement of +5.14% p over the identically retrained baseline ResNet-20 (84.56%).
    
The results of this study will provide a technical foundation that can be installed in future UGV (unmanned ground vehicle) or drone systems to perform precise pest diagnosis and production yield prediction in real time, even in low-spec hardware environments.
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.

Table 1: Stratified dataset split by class (Seed 42).


       
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.

Fig 1: Class of dataset.


 
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.

Table 2: Layer specifications and structural parameters of attention-ResNet-20.


       
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.

Fig 2: Structure of the proposed learning model.


       
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.

Table 3: Experimental training hyperparameters and computational setup.


    
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.
The advanced-ResNet-20 model was trained for 50 epochs and exhibited very stable characteristics on both training and validation data. Fig 3 is a graph showing the training and validation of the model in this study. As can be seen in Fig 3, the accuracy exceeded 90% in the first 10 epochs. This indicates that channel and spatial attention effectively learned to separate the features of pest damage on soybean leaves and the complex backgrounds of images acquired in open-field environments from the beginning. Ultimately, this model recorded a test accuracy of 89.70%, which is an improvement of approximately 5.14% compared to 86.58% in a previous study (Cho, 2025).

Fig 3: Training and validation performance.


       
The validation loss curve was similar to the training curve and converged to less than 0.05. This signifies that the model proposed in this study has resolved overfitting. Furthermore, it is evidence that the imbalance in the training data was resolved by efficiently adjusting the focal loss by assigning high training weights to normal leaves, which have fewer training samples.
       
The training and validation performance curves across epochs are illustrated in Fig 3.
       
In Fig 3, Accuracy is the blue graph. It maintains stability starting from 20 epochs and the Training and Validation graphs converge near 89.70%. Loss is the red graph. The initial loss value decreased very steeply. At the final convergence epoch, the Validation Loss curve was less than 0.05. This is evidence that the model is not overfitting the dataset. This dramatic improvement in learning accuracy is due to the ratio of weights assigned to the training data. Advanced-ResNet-20 did not assign equal weights to all types of training data; instead, it assigned higher weights to normal leaves, which had less training data. As a result, it resolved the imbalance across all types of training data. Additionally, channel attention was used to focus on the specific colors of damage caused by different pests, the irregularly distributed larval defects within the leaves and the small holes created by cucumber leaf beetles.
       
Table 4 summarizes the multi-class performance metrics evaluated on the held-out test partition.

Table 4: Diagnostic performance on held-out test set (n=641).


    
Focal loss ablation discussion: Focal loss degraded accuracy to 83.15%, possibly due to excessive weighting on minority class samples causing overfitting on subtle patterns. 
       
The verified confusion matrix for the test dataset (n=641) is detailed in Table 5.

Table 5: Verified confusion matrix (Test n=641).


       
The confusion matrix and corresponding error analysis for the test predictions are illustrated in Fig 4.

Fig 4: Confusion matrix and error analysis.


       
This matrix visually demonstrates the classification distribution across all classes on the held-out test set (n = 641). As documented in Table 5, the model correctly classified 310 out of 331 caterpillar samples (93.66% recall), 192 out of 220 Diabrotica speciosa samples (87.27% recall) and 73 out of 90 normal samples (81.11% recall), achieving an overall accuracy of 89.70% (575 correct predictions out of 641 test images).
       
The visual comparative analysis of feature representations and attention maps generated by the evaluated models is illustrated in Fig 5.

Fig 5: Visualization and attention map comparative analysis.


    
The visualization results in Fig 5 clearly suggest the superiority of this model. Generalization is assessed on the independent test set partition (89.70% accuracy) rather than validation loss .
       
The improvement in accuracy was achieved by applying channels and spatial attention structures. Although the model recognized data accurately, on-device hardware latency on physical microcontrollers was not measured and is designated for future research.
       
A computational complexity comparison among the evaluated models, in terms of parameters and inference overhead, is summarized in Table 6.

Table 6: Complexity comparison.

This study proposes an Advanced-ResNet-20 model for the classification of soybean pests. A test accuracy of 89.70% (91.11% with TTA) was achieved. The study is limited by the lack of external multi-farm validation. Furthermore, field robotic/UGV/drone trials were not conducted in this study.
       
In future research, we plan to conduct field validation tests by integrating this model into actual unmanned ground vehicles (UGVs) and real-time video streaming systems. Furthermore, we aim to expand the scope to diagnose pests and complex diseases in other crops, such as corn and wheat, in addition to soybeans, thereby developing it into a universal AI solution for global food security and the enhancement of agricultural productivity.
None.
 
Disclaimers
 
The views and conclusions expressed in this article are solely those of the authors and do not necessarily represent the views of their affiliated institutions. The authors are responsible for the accuracy and completeness of the information provided, but do not accept any liability for any direct or indirect losses resulting from the use of this content.
 
Data availability
 
The public dataset analyzed in this study is available on mendeley data (DOI: 10.17632/bycbh73438.1). Stratified train/validation/test split index files (split_seed42.json) and model checkpoints are archived to ensure independent verification.
 
Informed consent
 
Not applicable.
 The authors declare that there are no conflicts of interest regarding the publication of this article. No funding or sponsorship influenced the design of the study, data collection, analysis, decision to publish, or preparation of the manuscript.

  1. Cho, O.H. (2025). Deep learning-driven precision agriculture: Application of ResNet-20 for the early detection and classification of soybean insect pests under real-world constraints. Legume Research-An International Journal. 48(7): 1215-1221. doi: 10.18805/LRF-844.

  2. Mangang, C.A., Devi, T.M. and Singh, N.G. (2017). Seasonal incidence of insect pests of soybean in relation to weather parameters. Legume Research-An International Journal. 40(6): 1139-1140. doi: 10.18805/LR-3482.

  3. Mignoni, M.E. (2021). Images of Soybean Leaves [Data set]. Mendeley Data, V1. https://doi.org/10.17632/bycbh73438.1.

  4. Mishra, N., Tripathi, M.K., Tiwari, S., Tripathi, N. and Trivedi, H.K. (2022). Morphological and molecular screening of soybean genotypes against yellow mosaic virus disease. Legume Research. 45(10): 1309-1316. doi: 10.18805/LR-4240. 

  5. Priti, P.S., Sharma, P. and Kumar, R. (2026). Estimation of losses due to insect pests in soybean. Indian Journal of Entomology. 88(1): 45-52. https://doi.org/10.55446/IJE.2025.2360.

  6. Shuli, X. and Lee, M. (2020). Classification accuracy improvement for small-size citrus pests and diseases using bridge connections in deep neural networks. Sensors. 20(17): 4992. https://doi.org/10.3390/s20174992.

  7. Thenmozhi, K. and Reddy, U.S. (2019). Crop pest classification based on deep convolutional neural network and transfer learning. Computers and Electronics in Agriculture. 164:  104906. https://doi.org/10.1016/j.compag.2019.104906.

  8. Thippanna, G., Priya, M.D. and Srinivas, T.A.S. (2023). An effective analysis of image processing with deep learning algorithms. International Journal of Computer Applications. 185(27): 1-5. https://doi.org/10.5120/ijca2023923014.

  9. Woo, S., Park, J., Lee, J.Y. and Kweon, I.S. (2018). CBAM: Convolutional Block Attention Module. In Proceedings of the European Conference on Computer Vision (ECCV). Springer. (pp. 3-19). https://link.springer.com/chapter/10.1007/978-3-030- 01234-2_1.

  10. Yamashita, R., Nishio, M., Do, R.K.G. and Togashi, K. (2018). Convolutional neural networks: An overview and application in radiology. Insights into Imaging. 9(4): 611- 629. https://doi.org/10.1007/s13244-018-0639-9.
In this Article
Published In
Legume Research

Editorial Board

View all (0)