Abstract
The use of machine learning is an emerging approach in precision agriculture, including pest identification, disease diagnostics, and soil health monitoring. Root-knot nematodes (Meloidogyne spp.) are a key group of soil-dwelling metazoans that cause plant diseases and lead to significant yield losses in major crops. Identification of these nematodes is essential for pest management. Manual identification of large samples is time-consuming, labour-intensive, and subject to inter- and intra-rater variations, which may affect the consistency and reliability of results. Moreover, the number of skilled taxonomists is on the decline. Automating the identification process can enhance accuracy and consistency while significantly reducing the time required for sample identification. In this study, a deep-learning architecture was developed using convolutional neural networks (CNNs) to identify three major root-knot species: Meloidogyne graminicola, M. incognita, and M. javanica, which are among the most economically damaging plant-parasitic nematodes, causing significant yield losses in major crops worldwide. The algorithm, based on AlexNet and VGG16 architectures, achieved an accuracy of ~ 95%. In contrast, manual annotation by three independent annotators yielded moderate agreement (Kappa = 0.56), underscoring the challenges of inter-rater variability in large-scale nematode identification. Integrated Gradients analysis revealed that the model used taxonomically relevant features of the perineal pattern images during classification. The model also showed stable training behaviour across cross-validation folds, with minimal signs of overfitting. The machine learning model demonstrated improved reliability and precision in nematode identification. By addressing the challenge of accurate taxonomic classification, especially for non-experts, this approach offers a new paradigm for rapid and consistent identification of nematodes, essential for large-scale deployment of diagnostics and precision management of plant-parasitic nematodes.
Supplementary Information
The online version contains supplementary material available at 10.1038/s41598-025-33143-y.
Keywords: Machine learning, Nematode identification, Root-knot nematode, CNN, AlexNet
Subject terms: Computational biology and bioinformatics, Ecology, Ecology, Plant sciences
Introduction
The International Meloidogyne Project (IMP) drew global attention to the genus Meloidogyne, commonly known as root-knot nematodes (RKNs), due to their significant impact on global food production1. They are among the most polyphagous plant-parasitic nematode (PPN) genera described so far. Available data on economic yield loss due to nematode infection often underestimate their true impact. Global annual yield loss caused by plant-parasitic nematodes (PPNs) is estimated to cost around USD 175 billion2 with RKNs alone accounting for approximately USD 157 billion3,4. A review by Jones et al. 5 based on a global survey of members of nematological societies found that nematologists also consider Meloidogyne to be the most damaging group of PPNs. The genus Meloidogyne comprises 100 species5,6. Among them, only five, namely, M. incognita, M. javanica, M. arenaria, M. hapla, and M. graminicola are known as ‘major’ species of RKNs6. They are the most studied, abundantly distributed species infecting a broad range of major crops.
Morphology-based identification is the initial step in nematode identification. However, owing to their small size, cryptic behaviour, highly conserved morphology with inter- and intraspecific morphometric variability, and high genetic variation within a population, the systematics of nematodes has always been a challenge for taxonomists7,8. Numerous cases of misidentifying RKNs have shown that using a combination of tools and techniques is essential for accurate species confirmation. For example, M. fallax was initially misidentified as M. chitwoodi, and M. paranaensis and M. enterolobii were originally identified as M. incognita6. Morphological features such as the perineal pattern, number of head annuli, and the length of the body, stylet, tail, spicules, and gubernaculum are considered important taxonomic characteristics9. However, accurate identification and measurement of these features require significant expertise in nematode taxonomy, a skill that is becoming increasingly rare.
With the advent of modern sequencing technologies and the decreasing cost of sequencing over time, PCR (polymerase chain reaction)-based methods for nematode identification have also gained popularity due to their greater accuracy and suitability for non-taxonomists10,11. Multiple molecular approaches, such as SCAR (sequence characterized amplified region) markers, qPCR, LAMP (loop-mediated isothermal amplification), and RPA (recombinase polymerase amplification), have been developed to overcome limitations of morphology-based techniques and to allow high-throughput processing11,12. However, these methods require specialised expertise, laboratory infrastructure, and recurring chemical costs, making large-scale sample processing technically challenging and financially prohibitive9.
To address these challenges, the integration of traditional morphology-based nematode identification with modern machine-learning-based automation presents a promising alternative. Such approaches can enable high-throughput identification of nematodes without the constant need for domain experts, facilitating faster screening and monitoring, particularly critical in the context of ongoing biodiversity loss as nematodes play key roles in ecosystem functioning and considered as important bioindicators for soil health and environmental change13,14.
In recent years, the application of machine learning (ML)-based identification across diverse taxonomic groups has emerged as a powerful tool for automated species classification. The primary advantage of this approach, particularly in nematology, is its ability to accurately process large numbers of samples, including minute ones like eggs and cysts, even in cluttered images15.
To date, there are only a few reported instances of ML-based models applied to nematode identification. For example, Hakim et al.16 developed a deep-learning technique using Caenorhabditis elegans, integrating multiple image-processing algorithms into a single platform, WorMachine, to enable fully automated analysis of phenotypic traits. This, along with other approaches, such as automatic morphometric measurements for distinguishing closely related cyst nematode species17, demonstrated the potential of CNNs and other deep learning methods for accurate identification and phenomics of nematodes.
The consistency and accuracy offered by ML-based nematode identification may also help alleviate another major challenge commonly associated with manual identification: intra- and inter-rater variation in taxonomic assignments, especially given the cryptic nature of nematodes and the lack of easily discernible morphological features, as highlighted above.
The objective of this study was to develop a machine-learning-based framework for the image-based identification of three major RKN species based on their perineal patterns. We targeted the three most important RKN species: Meloidogyne incognita, M. javanica, and M. graminicola. To achieve this, we utilised the AlexNet CNN model in combination with the VGG16 architecture. This approach may help overcome the challenges associated with rapid and accurate identification of large RKN samples, as well as address the declining number of skilled taxonomists available for such tasks.
Materials and methods
1. Collection, maintenance and molecular identification using SCAR:
Root-knot nematode (RKN)-specific sampling was carried out across vegetable and rice (Oryza sativa L.) cropping systems in Dumka and Giridih districts of Jharkhand, India during 2021–202214. The host crops included tomato (Solanum lycopersicum), okra (Abelmoschus esculentus), eggplant (Solanum melongena), and pointed gourd (Trichosanthes dioica). Five RKN isolates from rice were maintained on a susceptible rice cultivar (cv. Pusa Basmati-1121) using isolates derived from single egg masses. Similarly, RKN populations from vegetables were propagated on susceptible hosts such as tomato (cv. Pathar Kuchi), okra (cv. Arka Anamika), and brinjal (cv. Harshit). All plants were maintained in the greenhouse facility of the Indian Statistical Institute, Giridih, under appropriate agronomic management practices.
Initial RKN species identification was carried out based on perineal pattern morphology. To confirm species identity, SCAR markers specific to Meloidogyne incognita, M. javanica, and M. graminicola were used. DNA was extracted from single second-stage juvenile specimens using the worm lysis buffer method18. SCAR primers and PCR cycle conditions were adopted from Mondal et al.19. Following molecular confirmation, representative populations of each of the three RKN species were used for perineal pattern dissection and imaging.
2. Perineal pattern processing, image acquisition and dataset description:
Mature females of each RKN species were dissected from NaOCl–acid-fuchsine-stained roots of their respective host plants20. The preparation of perineal pattern specimens followed Mondal et al. 20 protocol. Briefly, the posterior portions of stained females were excised using a razor blade on a glass slide in 45% lactic acid solution to remove adhering muscular tissues. The cleared cuticle was mounted in anhydrous glycerin on a glass slide and sealed using the wax-ring method21. In total, 348 perineal patterns corresponding to three RKN species were used for further image acquisition (Table 1).
Table 1.
Distribution of perineal pattern images used for training and testing the machine learning models across three root-knot nematode species. The dataset was divided into training (80%) and test (20%) sets for each species: Meloidogyne graminicola (class 0), M. incognita (class 1), and M. javanica (class 3).
| Dataset | M. graminicola (class 0) |
M. incognita (class 1) |
M. javanica (class 2) |
|---|---|---|---|
| Train set | 139 | 56 | 83 |
| Test set | 35 | 14 | 21 |
Each permanent mount was examined under brightfield illumination using a compound light microscope at 40× magnification (Zeiss Axio Scope A1), and high-resolution digital images (300 dpi) were captured using the integrated camera system. These images were then labelled according to species identity, which had been previously confirmed using SCAR-based molecular markers. The curated image dataset formed the basis for developing and evaluating the ML models used in this study (Fig. 1).
Fig. 1.
Representative perineal pattern images of three root-knot nematode species: M. graminicola, M. incognita, and M. javanica. The arrow in the M. graminicola image indicates the phasmids. In M. incognita, the arrow highlights the high dorsal arch, while in M. javanica, the distinct presence of lateral lines is evident.
3. Implementation of Machine Learning Models
a) Model Description: AlexNet and VGG16
Convolutional Neural Networks (CNNs) are a class of deep learning neural networks inspired by the perception mechanisms of the animal nervous system. Originally developed in the 1990s22, CNNs have since become a powerful tool for image-based classification tasks due to their ability to automatically extract spatial features from visual data.
In this study, we used two widely adopted CNN architectures, AlexNet and VGG16, because of their efficiency in handling complex biological images. Both models consist of multiple layers, including convolutional, max-pooling, and fully connected layers, which progressively process the input image to generate class predictions. CNNs operate on three-dimensional input data (height, width, and depth) and optimise internal weights through backpropagation during training.
AlexNet23
is a deep CNN that brought a breakthrough in large-scale image classification by incorporating GPU-based computation. It consists of five convolutional layers (for extracting image features), three max-pooling layers (for reduction of the spatial size of features), two fully connected layers, and a final softmax output layer (for converting the model’s outputs into class probabilities). The hidden layers use ReLU (Rectified Linear Unit) activation, a function that introduces non-linearity and enables the model to learn complex patterns. AlexNet won the 2012 ImageNet competition with a significant margin, marking a major milestone in deep learning.
VGG1624
is known for its simplicity and depth, featuring 16 weight layers: 13 convolutional layers, five max-pooling layers, and three fully connected layers. Its uniform architecture allows for consistent feature extraction and strong performance in classification tasks. VGG16 performed exceptionally well in the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) 2014. A detailed, layer-by-layer schematic of both models is provided in Supplementary Figure S1.
These models were selected given their performance in image classification tasks, particularly in biological and medical imaging where complex and detailed patterns are common. Both models are well-established, extensively used in numerous research projects, and offer a balance between correct classification of images (i.e., accuracy in the context of ML models) and computational efficiency (for example, see Leek et al.25).
AlexNet with its relatively shallow architecture reduces the chance of overfitting which is particularly relevant for small datasets, as in our study. Furthermore, the use of ReLU activation allows faster convergence during training. VGG16, on the other hand, has comparatively deeper and more uniform architecture and is particularly effective at extracting hierarchical image features, making it suitable for distinguishing minute morphological differences, such as those observed in perineal patterns images. Together, these models provide complementary advantages in processing moderately sized biological image datasets, offering a robust starting point for automated nematode species identification.
b) Modelling Framework
i) Image Pre-processing and Augmentation
In this study, all perineal pattern images were resized to a uniform dimension of 227 × 227 pixels to meet the input requirements of the AlexNet architecture. This resizing ensured computational consistency across all samples and facilitated efficient model training. While the original biological images showed minor variations in their spatial dimensions, as is common during microscopy-based image acquisition, this step preserved key structural characteristics of the perineal patterns. It helped standardize the input images without compromising important morphological features, thereby maintaining biological relevance in the classification process.
To improve the generalisation ability of the models and reduce overfitting, particularly given the limited size of the dataset, standard image augmentation techniques were applied. These included flipping, rotation, and axis shifting of input images to simulate real-world variability commonly encountered in microscopy-based imaging of perineal patterns. Such transformations enhance the diversity of the training data and help the model learn robust, position- and orientation-invariant features, thereby improving performance on unseen samples.
Image augmentation was performed using Keras’ ImageDataGenerator, applying the following augmentation strategies:
-
(i)
Random rotation of images between 0 and 5 degrees to slightly tilt the images within a small range. This made the model more robust to minor variations in orientation. This method simulates real-world changes like camera angle shifts without distorting key features. The technique improved generalization, enhancing performance on unseen data.
-
(ii)
Image shifting along the X-axis by 10% and Y-axis by 10% involved moving the image horizontally and vertically within the specified range. This technique simulates minor changes in object positioning, helping the model become more invariant to small shifts in position.
-
(iii)
Images flipped horizontally to obtain mirror reflections. Horizontal flipping of images created a mirror image, swapping the left and right sides. This augmentation simulates variations in object orientation, such as reflecting a subject or scene. It helps the model recognize objects regardless of their direction. By increasing dataset diversity, horizontal flipping enhances the model’s ability to generalize to different viewpoints.
These augmentations were applied dynamically during training. The total number of augmented images per fold was equal to the number of training images multiplied by the number of epochs. During each epoch, a new random augmentation was applied when an image was loaded. As a result, no augmented images were stored or saved, and the original dataset remained unchanged. However, the model was exposed to 100 randomly augmented variants of each image per fold, amounting to approximately 500 augmented views per image across the five-fold training, thereby enhancing learning without modifying the original dataset.
ii) experimental setup
The labelled dataset comprised perineal pattern images of three RKN species: Meloidogyne graminicola (174 images), M. incognita (70 images), and M. javanica (104 images) (Table 1). Each image corresponds to the perineal pattern dissected from a single mature female nematode (see Sect. 2 for details on perineal pattern processing). To ensure robustness and minimise the impact of dataset variability, we adopted a 5-fold cross-validation scheme.
The dataset was stratified by species to maintain proportional representation in each fold. The M. graminicola (class 0), M. incognita (class 1), and M. javanica (class 2) images were evenly distributed so that, in each fold, approximately 80% of the images from each class were used for training and 20% for validation, preserving the original class proportions (Supplementary Table S1 and Figure S2).
AlexNet was trained using randomly initialized weights from scratch, without any pretrained parameters, whereas the VGG16 model loads pretrained weights learned from the ImageNet dataset, which contains about 1.2 million images across 1000 categories. Training was performed using Stochastic Gradient Descent optimiser with a learning rate of 0.01. The categorical cross-entropy loss function was used, appropriate for multi-class classification tasks. Models were trained for 100 epochs with a batch size of 1, allowing for weight updates after each individual sample. All hyperparameters were tuned using the validation subset within each fold.
iii) Model training
The goal of model training was to develop a function that accurately assigns species labels to input images using a supervised classification approach. Let
represent an input image and
the true label. The classification model is denoted as a function
, where θ represents the set of model parameters (weights and biases of the neural network). The predicted class label
is the output of this function, i.e.,
![]() |
The model was trained by minimising a categorical cross-entropy loss function
, which measures the discrepancy between the true and predicted labels for multi-class classification. The loss function is defined as:
![]() |
where
is the number of classes,
is the true binary indicator (0 or 1) if class label
is the correct classification, and
is the predicted probability for class
.
To minimise the average loss over the entire training dataset
, the goal was to find the optimal set of parameters
such that: 
After training, for a new test image
, the final prediction
is given by:
![]() |
i.e., the class with the highest predicted probability is selected as the model’s output.
A schematic overview of this training process is shown in Fig. 2, illustrating the full pipeline from image input to species classification.
Fig. 2.
Schematic representation of the machine learning workflow for root-knot nematode identification. Perineal pattern images from morphologically and molecularly confirmed specimens were pre-processed and used as input for two convolutional neural network (CNN) models, AlexNet and VGG16. The models were trained and validated using 5-fold cross-validation and evaluated on an independent test set to classify three Meloidogyne species: M. graminicola (class 0), M. incognita (class 1), and M. javanica (class 2).
iv) Model evaluation
To evaluate the performance of the trained models, we used four standard classification metrics: accuracy, precision, recall, and F1-score. Given the class imbalance in our dataset, we used the macro F1-score to ensure equal weight for each class, regardless of its frequency. Specifically, we performed 5-fold cross-validation, computing the macro F1-score for each fold independently. The final reported result is the mean of the macro F1-scores across all 5-folds. These metrics provide a comprehensive understanding of the models’ ability to distinguish among the three nematode species.
Let TP, TN, FP, and FN denote true positives, true negatives, false positives, and false negatives, respectively. The metrics are defined as follows:
Accuracy: The proportion of total correct predictions out of all predictions:
![]() |
-
b)
Precision: The proportion of correct positive predictions among all positive predictions:
![]() |
-
c)
Recall (Sensitivity): The proportion of correctly predicted positive cases among all actual positives:
![]() |
-
d)
F1-score: The harmonic mean of precision and recall:
![]() |
-
e)
Macro of the evaluation metrics.
![]() |
To further assess classification performance, a confusion matrix was generated for each model, indicating how many samples from each true class were predicted into each possible class. This allowed us to identify patterns of the misclassification.
c) Comparison with human annotations: Inter-Rater agreement analysis
To evaluate the consistency of manual nematode identification and compare it with model-based classification, a subset of perineal pattern images was independently annotated by three trained nematode taxonomists. These manual annotations were then used to assess inter-rater variability.
Fleiss’ kappa coefficient was calculated to measure the level of agreement among the three human annotators26. This statistical measure quantifies agreement in categorical classification tasks among multiple annotators and is commonly used to assess the reliability of manual identification methods.
To compare the classification outputs of the ML models (AlexNet and VGG16) with those of the human annotators, we used Cochran’s Q test, a non-parametric statistical method for detecting differences in proportions across three or more related classifiers.
In addition, McNemar’s test was used for post hoc pairwise comparisons to evaluate differences in classification outcomes between pairs of annotators or between a rater and a model27. This test is suitable for detecting statistically significant disagreements between two classifiers applied to the same set of samples. These statistical analyses allowed us to quantitatively compare the reproducibility and consistency of manual and automated RKN identification.
d) Model Interpretability Using Integrated Gradients
When a nematode taxonomist identifies RKN species based on perineal patterns, they do so by carefully examining specific morphological features, such as the shape of the dorsal arch, presence of lateral lines, and positioning of phasmids, that are considered taxonomically relevant. However, in the case of ML models, it is often unclear which parts of the image were used to arrive at a classification decision. Without such interpretability, even a highly accurate model may be perceived as a black box, limiting its acceptance by the end-users such as taxonomists.
To address this issue, we applied Integrated Gradients method28, a widely used interpretability technique for deep neural networks, to visualise the decision-making process of the trained models. IG attributed the model’s prediction to individual input pixels by computing the gradient of the model’s output with respect to the input image and integrating these gradients along a straight-line path from a baseline image (a black image) to the actual input. Mathematically, the integrated gradient for an input feature
with respect to a baseline
is defines as
![]() |
where
is the model’s output function. In practice, the integral was approximated using a Riemann summation over a finite number of steps. In addition, standard gradient-based saliency maps were also generated for comparison.
This process generated attribution maps for all test images that highlighted the image regions contributing most to the final prediction. They were visually examined to assess whether the highlighted features corresponded to morphological regions used by human taxonomists. This allowed us to assess whether the models relied on taxonomically relevant regions of the perineal pattern during classification, thereby providing insight into the basis of their predictions and reducing the black-box nature of the approach.
Results
Model performance on classification
The results show that both AlexNet and VGG16 performed well in classifying perineal pattern images of the three Meloidogyne species. Across all evaluation metrics, the models demonstrated high accuracy, precision, recall, and F1-scores, with only minor differences between them. AlexNet achieved an overall accuracy of 94.85%, with a precision of 0.9594, recall of 0.9485, and a macro F1-score of 0.9490. VGG16 showed slightly lower performance, with an accuracy of 94.12%, precision of 0.9443, recall of 0.9454, and a macro F1-score of 0.9432 (Table 2). These results suggest that both models are capable of accurately identifying RKN species from the perineal pattern images, even with a moderately imbalanced dataset.
Table 2.
Performance metrics of the AlexNet and VGG16 models for classifying Meloidogyne species based on perineal pattern images. Values represent the mean ± Standard deviation across 5 cross-validation folds.
| Model | Precision | Recall | Macro F1 | Accuracy |
|---|---|---|---|---|
| AlexNet | 0.9594 ± 0.0069 | 0.9485 ± 0.0114 | 0.9490 ± 0.0113 | 0.9485 ± 0.0114 |
| VGG16 | 0.9443 ± 0.0018 | 0.9454 ± 0.0312 | 0.9432 ± 0.0123 | 0.9412 ± 0.143 |
Similarly, confusion matrices for both models (Fig. 3) show that all test images of M. graminicola and M. incognita were correctly classified by both models. Misclassification occurred with M. javanica, which was occasionally predicted as M. incognita. AlexNet misclassified 3 out of 21 M. javanica images, while VGG16 misclassified four such images. Overall, these results confirmed that both AlexNet and VGG16 can be effectively used for automated, image-based identification of Meloidogyne spp., with AlexNet offering slightly higher classification precision and stability across species.
Fig. 3.
Confusion matrices showing the classification performance of the deep learning models on the test dataset. (A) AlexNet and (B) VGG16. Rows represent the true class labels and columns represent the predicted class labels: class 0 = Meloidogyne graminicola, class 1 = M. incognita, and class 2 = M. javanica. The models correctly classified all test images of M. graminicola and M. incognita. Few misclassifications occurred between M. javanica and M. incognita, possibly because of the morphological similarity in perineal pattern features.
Comparison with human annotations
To evaluate how the ML models compared with human expertise, the perineal pattern images was independently annotated by three experienced nematode taxonomists. The level of agreement among the human annotators was assessed using Fleiss’ kappa, calculated to be 0.56 indicating moderate agreement between human annotators. The results once again highlighted the challenges associated with manual identification, even among trained experts.
To statistically compare the classification accuracy of the models with human performance, Cochran’s Q test was performed. The results demonstrated that the identifications by the human annotators varied significantly (Q = 19.17, p < 0.01), indicating that at least one rater differed from the others in terms of classification accuracy. To further understand these differences, a post hoc test was conducted using pairwise McNemar’s test, which evaluates the differences between classifiers in pairwise comparisons. The most significant differences were found between rater 2 and AlexNet, as well as between rater 2 and VGG16 (p < 0.001), indicating that both models consistently outperformed rater 2. However, no significant difference was observed between the models and the other two human annotators (rater 1 and rater 3), who showed high agreement with each other.
These results supported our hypothesis that ML based identification of nematodes could achieve greater accuracy, while processing large numbers of samples. While human experts may differ in their interpretations, the ML models showed consistent performance across species. This consistency is particularly valuable while implementing nematode management options, where misidentification could lead to control failure.
Model interpretability
The integrated gradients visualisations (Fig. 4) showed that the regions of the perineal pattern used by the models for classification largely corresponded with the same morphological features used by human experts. For example, the phasmid region in M. graminicola, the elevated dorsal arch in M. incognita, and the lateral lines in M. javanica were consistently highlighted in the attribution maps. This suggests that the models are not relying on random artefacts or background noise but utilised taxonomically meaningful features while classifying the perineal pattern images. Application of integrated gradients to both models confirmed that the models selected the morphologically important features to classify the image, in the same manner as manual identification, thus increasing the credibility and transparency of the models.
Fig. 4.
Visualisation of model interpretability using integrated gradients for representative perineal pattern images of root-knot nematode species. Each row corresponds to one species: Meloidogyne graminicola, M. incognita, and M. javanica. For each species, the left image shows the original input image, the middle image shows the saliency map from standard gradients, and the right image shows the attribution map generated using the Integrated Gradients (IG) method. The highlighted regions (green contours) in the IG maps indicate the areas that most influenced the model’s classification. These regions broadly align with taxonomically important morphological features such as the dorsal arch and phasmid position.
In contrast, saliency maps generated using standard gradients did not highlight any clearly interpretable or consistent regions of the perineal patterns, supporting the use of integrated gradients for more reliable model interpretation.
Model training dynamics
The changes in model accuracy during training are shown in Fig. 5. For both AlexNet and VGG16, the accuracy on the training set steadily improved over the 100 training cycles (epochs), indicating that the models successfully learned to distinguish between the nematode species. The accuracy on the validation set followed a similar pattern, although minor fluctuations were observed. These fluctuations could be attributed to the limited number of images used for validation and variations introduced as a result of the cross-validation folds.
Fig. 5.
Training and validation accuracy curves across 5-fold cross-validation for AlexNet and VGG16 over 100 epochs. Panels (A) and (C) show training and validation accuracy, respectively, for AlexNet; panels (B) and (D) show the corresponding accuracy curves for VGG16. Each coloured line represents one cross-validation fold. The consistent trends and minimal divergence between training and validation accuracy indicate stable learning and no signs of overfitting in either model.
Figure 5 did not provide any evidence of model overfitting. Throughout the training process, the validation accuracy remained close to the training accuracy, suggesting that both models generalised well to new data. The learning behaviour was stable across epochs, supporting the consistency of the final classification results. Overall, the training behaviour of both models was stable, and the final models produced consistent results across different image samples.
Discussion
The results of our study align well with the limited but growing body of research applying ML techniques to the identification of phytonematodes. The deep learning framework developed by Akintayo et al.15 achieved ~ 95% accuracy in identifying cyst nematode eggs from cluttered images. Similarly, the CNN model NemaNet demonstrated over 96% accuracy in identifying important soybean-infecting nematodes, including Helicotylenchus dihystera, M. incognita, Pratylenchus brachyurus, Heterodera glycines, and Rotylenchulus reniformis29.
Free-living nematodes such as Acantholaimus and Sabatieria have also been identified with 93% and 100% accuracy, respectively, using a random forest model30. Qing et al.31 utilised a publicly available nematode image dataset (‘I-Nema’) to develop a web-based deep learning application, ‘NemaRec’, aimed at using nematodes as indicators of biological soil health32. Their ResNet101 model achieved classification accuracies of 60% for nematode genera, 76% for c–p values, and 76% for feeding types across 19 genera.
In another recent study, Singh et al.33 used a lightweight CNN model to classify five nematode species: Anguina tritici, Heterorhabditis, Helicotylenchus, M. incognita, and Xiphinema. Their model outperformed commonly used architectures like VGG16, InceptionV3, and ResNet50, with reported accuracies and F1-scores ranging from 98 to 99% and 93–97%, respectively. These values are slightly higher than the accuracies reported in our study. To our understanding, this may be attributed to the selection of species with distinct and easily recognisable shapes. For example, A. tritici and Helicotylenchus have coiled or helical shapes that are visually distinct, and Xiphinema is clearly separable based on its much longer body size. While there may be some visual overlap between Heterorhabditis females and Meloidogyne juveniles due to their pointed tails, the presence of a stylet in Meloidogyne offers a reliable distinguishing feature.
In comparison to earlier CNN-based models for nematode identification, our study provided several key advancements. For example, NemaNet29 focused on five nematode pests of soybean using whole-body brightfield microscopic images, while NemaRec31 undertaken genus-level classification for ecological monitoring using images of nematode head, tail, and body regions. In contrast, specific objective of our study was to undertake species level identification using perineal pattern images, routinely used by nematode taxonomists for identification of root-knot nematodes. While both previous models achieved high classification accuracy, neither incorporated model interpretability or compared performance against human experts. Our model addresses both these gaps by applying integrated gradients to highlight biologically relevant image features and by evaluating performance against expert annotators thus increasing the reliability of the model and avoiding the black box nature of the ML models. A detailed comparison with NemaNet and NemaRec is provided in Supplementary Table S2.
The algorithm developed in our study achieved nearly 95% accuracy in the image-based identification of Meloidogyne spp., demonstrating the significant potential of ML for improving species-level identification of plant-parasitic nematodes (Table 2). As discussed earlier, both models made a few misclassifications (Fig. 4), particularly with M. javanica being occasionally identified as M. incognita, presumably due to the similar morphology of their perineal patterns. Taxonomically, M. javanica is distinguished from M. incognita by the presence of lateral lines, subtle differences that are sometimes difficult to detect, even for experienced nematologists.
Future improvements in classification accuracy may be achieved by combining custom computer vision algorithms (CCVAs) with CNN models. Thevenoux et al. 18, for example, integrated manually derived morphological landmarks (e.g., the length from basal knobs to anterior head, and basal knob width) with a CNN (EB-Net) for distinguishing the quarantine pests Globodera rostochiensis and G. pallida. Their approach yielded classification accuracies of 85% (CCVA) and 71% (CNN). In our context, incorporating specific perineal pattern features such as vulval slit length, vulva-to-anus distance, inter-phasmidial distance, and vulva-to-tail terminus length could further improve the model’s ability to distinguish between visually similar species.
Root-knot nematodes (Meloidogyne spp.) are among the most damaging plant-parasitic nematodes, inflicting major yield losses in a wide range of crops and vegetables globally. Automating species-level identification of these nematodes can substantially support pest management strategies. In this study, we developed a deep learning architecture for the accurate classification of three major species, M. graminicola, M. incognita, and M. javanica, which are among the most economically important RKNs. Since Meloidogyne spp. can infest nearly every crop34, accurate and efficient identification is essential for both management and research.
Computer-assisted species identification has broad applications across fields, including biodiversity assessment, climate change research, pest forecasting, and conservation35–37. This is especially important given the laborious nature of manual identification and the declining availability of trained taxonomists. To our knowledge, this is one of the earliest examples of the application of ML for identifying RKN species.
One limitation of the current study is the relatively small number of training images. While the algorithm performed well, a larger and more diverse dataset would likely enhance model robustness. Additionally, the current model is limited to only three Meloidogyne species. Expanding the model to include other important species such as M. hapla, M. arenaria, and M. enterolobii would improve its practical value in diagnostics and surveillance. Further development could also focus on automating nematode counting within a sample, assigning individuals to trophic groups, and using image-based predictions to assess soil health and disease risk.
Although our study included an interpretability analysis using integrated gradients to visualise the image regions used for classification, ML models remain partially opaque. A deeper understanding of which features the model relies on would help build trust and encourage adoption by taxonomists and field diagnosticians.
Overall, the AlexNet-based model developed in this study is accurate and promising for practical use in nematode diagnostics, particularly within the framework of precision agriculture and sustainable pest management. Understanding the underlying logic of such models will further enhance their reliability. This work opens the door to interdisciplinary research across nematology, agriculture, and computer science. In the long term, automating species-level identification of RKNs could significantly ease the burden on researchers and transform how plant-parasitic nematodes are monitored and managed.
Conclusion
In this study, we developed a ML model to identify three important RKN species, Meloidogyne graminicola, M. incognita, and M. javanica, based on their perineal pattern images. The model showed high accuracy in classification and was able to perform as well as, or better than, human experts in some cases. It also correctly focused on taxonomically important features, as shown through visual interpretation of the model’s decisions.
This approach marks an important shift in nematode taxonomy. Traditionally, species identification relies on expert judgement and can vary between individuals. Our model provides a faster, more consistent, and automated method for species-level identification. Although the current model is limited to three species and is based on a relatively small image set, it offers a strong foundation for building more comprehensive identification tools in the future.
With further development, ML-based tools like this could help researchers and plant health professionals manage nematode-related crop damage more effectively. It may also support biodiversity studies and soil health monitoring, especially where access to trained taxonomists is limited.
Future work should focus on making a more robust image dataset, including more nematode species including other major RKN species like M. arenaria and M. enterolobii, and developing tools for automatic counting and trait-based analysis to support large-scale environmental monitoring and precision agriculture.
Supplementary Information
Below is the link to the electronic supplementary material.
Acknowledgements
The authors would like to thank the Department of Biotechnology (DBT) Government of India for the necessary financial support (BT/PR48395/AI/133/171/2023). The authors also acknowledge support from the Indo-French Centre for the Promotion of Advanced Research (IFCPAR/CEFIPRA) through Project No. CSRP 6702-2.
Author contributions
S.D.: Methodology, conceptualization, writing- original draft, K.G.: Methodology, formal analysis, writing- original draft, S.M.: Methodology, writing- original draft, S.Du.: Writing- review and editing, M.R.K.: Writing- review and editing, resources, project administration, U.G.: Ideation for using deep learning for the given problem, methodology designing, writing- review and editing, project administration, A.M.: Conceptualization, writing- review and editing, resources, project administration.
Data availability
The datasets used and/or analysed during the current study are available from the corresponding author upon reasonable request.
Declarations
Competing interests
The authors declare no competing interests.
Guideline statement
The authors confirm that all plant-related research and collection of plant materials in this study complied with relevant institutional, national, and international guidelines and legislation.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Sristi Das, Koyel Ghosh and Sandip Mondal contributed equally to this work.
References
- 1.Sasser, J. N. Root-knot nematodes: a global menace to crop production. (1980).
- 2.Bernard, G. C., Egnin, M. & Bonsi, C. The Impact of plant-parasitic Nematodes on Agriculture and Methods of Control. In Nematology-concepts, Diagnosis and Control (IntechOpen, 2017).
- 3.Kumar, V., Khan, M. R. & Walia, R. K. Crop loss estimations due to plant-parasitic nematodes in major crops in India. Natl. Acad. Sci. Lett.43, 409–412 (2020). [Google Scholar]
- 4.Phani, V., Khan, M. R. & Dutta, T. K. Plant-parasitic nematodes as a potential threat to protected agriculture: current status and management options. Crop Prot.144, 105573 (2021). [Google Scholar]
- 5.Jones, J. T. et al. Top 10 plant-parasitic nematodes in molecular plant pathology. Mol. Plant. Pathol.14, 946–961 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Elling, A. A. Major emerging problems with minor meloidogyne species. Phytopathology103, 1092–1102 (2013). [DOI] [PubMed] [Google Scholar]
- 7.Archidona-Yuste, A., Cantalapiedra-Navarrete, C., Castillo, P. & Palomares-Rius, J. E. Molecular phylogenetic analysis and comparative morphology reveals the diversity and distribution of needle nematodes of the genus longidorus (Dorylaimida: Longidoridae) from Spain. Contrib. Zool.88, 1–41 (2019). [Google Scholar]
- 8.Hodda, M. Phylum nematoda: trends in species descriptions, the Documentation of diversity, systematics, and the species concept. Zootaxa5114, 290–317 (2022). [DOI] [PubMed] [Google Scholar]
- 9.Bogale, M., Baniya, A. & DiGennaro, P. Nematode identification techniques and recent advances. Plants9, 1260 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Esbenshade, P. R. & Triantaphyllou, A. C. Use of enzyme phenotypes for identification of meloidogyne species. J. Nematol. 17, 6 (1985). [PMC free article] [PubMed] [Google Scholar]
- 11.Shao, H. et al. Current advances in the identification of plant nematode diseases: from lab assays to in-field diagnostics. Front. Plant. Sci.14, 1106784 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Li, M. et al. The detection of pine wilt disease: A literature review. Int. J. Mol. Sci.23, 10797 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Shabrina, N. H., Lika, R. A. & Indarti, S. Deep learning models for automatic identification of plant-parasitic nematode. Artif. Intell. Agric.7, 1–12 (2023). [Google Scholar]
- 14.Mondal, S. et al. Unveiling the drivers of nematode community structure and function across rice agroecosystems. Appl. Soil. Ecol.182, 104715 (2023). [Google Scholar]
- 15.Akintayo, A. et al. A deep learning framework to discern and count microscopic nematode eggs. Sci. Rep.8, 9145 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Hakim, A. et al. WorMachine: machine learning-based phenotypic analysis tool for worms. BMC Biol.16, 1–11 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Thevenoux, R. et al. Image based species identification of globodera quarantine nematodes using computer vision and deep learning. Comput. Electron. Agric.186, 106058 (2021). [Google Scholar]
- 18.Carta, L. K. & Li, S. PCR amplification of a long rDNA segment with one primer pair in agriculturally important nematodes. J. Nematol. 51, e2019–e2026 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Mondal, S. et al. Intraspecific variability of rice root knot nematodes across diverse agroecosystems for sustainable management. Sci. Rep.14, 30032 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Bybd, D. W. Jr, Kirkpatrick, T. & Barker, K. An improved technique for clearing and staining plant tissues for detection of nematodes. J. Nematol. 15, 142 (1983). [PMC free article] [PubMed] [Google Scholar]
- 21.Hooper, D. J. Handling, fixing, staining and mounting nematodes. (1986).
- 22.Gu, J. et al. Recent advances in convolutional neural networks. Pattern Recognit.77, 354–377 (2018). [Google Scholar]
- 23.Krizhevsky, A., Sutskever, I. & Hinton, G. E. ImageNet classification with deep convolutional neural networks. Commun. ACM. 60, 84–90 (2017). [Google Scholar]
- 24.Simonyan, K., Vedaldi, A. & Zisserman, A. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034 (2013).
- 25.Leek, E. C., Leonardis, A. & Heinke, D. Deep neural networks and image classification in biological vision. Vis. Res.197, 108058 (2022). [DOI] [PubMed] [Google Scholar]
- 26.Fleiss, J. L. Measuring nominal scale agreement among many raters. Psychol. Bull.76, 378 (1971). [Google Scholar]
- 27.McNemar, Q. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika12, 153–157 (1947). [DOI] [PubMed] [Google Scholar]
- 28.Sundararajan, M., Taly, A. & Yan, Q. Axiomatic attribution for deep networks. In International conference on machine learning 3319–3328PMLR, (2017).
- 29.Abade, A., Porto, L. F. & Ferreira, P. A. De Barros Vidal, F. NemaNet: A convolutional neural network model for identification of soybean nematodes. Biosyst Eng.213, 39–62 (2022). [Google Scholar]
- 30.de Jesus, S. B. et al. Machine learning algorithms accurately identify free-living marine nematode species. PeerJ11, e16216 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31.Qing, X. et al. NemaRec: A deep learning-based web application for nematode image identification and ecological indices calculation. Eur. J. Soil. Biol.110, 103408 (2022). [Google Scholar]
- 32.Lu, X., Wang, Y., Fung, S. & Qing, X. I-Nema: a biological image dataset for nematode recognition. arXiv preprint arXiv:2103.08335 (2021).
- 33.Singh, N. et al. Development of a deep Learning-Assisted mobile application for the identification of nematodes through microscopic images. Mod. Agric.2, e70000 (2024). [Google Scholar]
- 34.Chandra, P., Sao, R., Gautam, S. K. & Poddar, A. N. Initial population density and its effect on the pathogenic potential and population growth of the root knot nematode meloidogyne incognita in four species of cucurbits. Asian J. Plant. Pathol.4, 1–15 (2010). [Google Scholar]
- 35.Batz, P., Will, T., Thiel, S., Ziesche, T. M. & Joachim, C. From identification to forecasting: the potential of image recognition and artificial intelligence for aphid pest monitoring. Front. Plant. Sci.14, 1150748 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36.Delfani, P., Thuraga, V., Banerjee, B. & Chawade, A. Integrative approaches in modern agriculture: IoT, ML and AI for disease forecasting amidst climate change. Precis Agric.25, 2589–2613 (2024). [Google Scholar]
- 37.Villa, A. G., Salazar, A. & Vargas, F. Towards automatic wild animal monitoring: identification of animal species in camera-trap images using very deep convolutional neural networks. Ecol. Inf.41, 24–32 (2017). [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
The datasets used and/or analysed during the current study are available from the corresponding author upon reasonable request.














