Plant disease classification in real-field photographs is notoriously difficult. Unlike the tidy laboratory datasets where a single leaf sits against a plain background, images taken in orchards and fields contain overlapping foliage, cluttered backgrounds, variable lighting, and sometimes several diseases on the same leaf. A new study published in Frontiers in Artificial Intelligence tackles this problem by restructuring the entire classification pipeline around individual disease instances rather than whole images, and reports substantially higher accuracy on a challenging pear leaf dataset.
The research team, led by Hira Batool of the National University of Computer and Emerging Sciences in Islamabad together with collaborators in Saudi Arabia and Oman, worked with the DiaMOS Plant dataset, a collection of RGB images captured with smartphone and DSLR cameras in uncontrolled outdoor conditions during the growing season. From the original dataset they selected only leaf images, yielding 3,006 images across four categories: curl, healthy, slug damage, and spot. The distribution is heavily imbalanced, with 2,025 slug damage images and 884 spot images but only 43 healthy and 54 curl images.
A key limitation of the original annotations was that each image carried a single dominant label, even when multiple symptomatic regions were visible. After localization, this produced 9,761 localized patches: 8,020 in a development pool and 1,741 in a locked test set, with the development pool and test set containing 2,555 and 451 source images respectively.
The pipeline itself unfolds in three stages. First, a lightweight YOLOv8n detector, trained with coarse labels that treat all disease as one foreground class, identifies where diseased or healthy leaf regions are located. This decoupling is deliberate: rather than forcing the detector to distinguish visually similar diseases from box-level features, it only finds relevant regions, leaving fine-grained discrimination to a later classifier. Predicted boxes are matched to ground-truth annotations using an intersection-over-union threshold of 0.3, chosen because lesions are small and irregular and a stricter criterion would discard many correctly localized regions.
Second, the cropped patches, resized to 256 by 256 pixels and fed to the classifier at 224 by 224, pass through a hybrid CNN-Transformer architecture. A ResNet-18 branch pretrained on ImageNet captures fine-grained local details such as lesion boundaries, spot texture, and color variations, while a transformer branch with four encoder layers and eight attention heads models broader contextual dependencies across 196 image tokens. A cross-attention fusion module, with CNN features as queries and transformer tokens as keys and values, merges the two representations into a shared 256-dimensional embedding.
The third stage addresses inter-class visual similarity, a problem well documented in the literature: cassava mosaic disease and brown streak disease have been confused because of similar lesions, and wheat models have struggled to separate yellow rust from septoria because both produce elongated chlorotic spots. The new framework computes a prototype, or mean embedding, for each class at the end of every training epoch, updated with an exponential moving average. Cosine similarities between prototypes identify the two most confusable class pairs, and a Similarity-Weighted Contrastive Loss applies proportionally stronger separation pressure to those difficult boundaries. A decorrelation regularization term reduces redundancy among embedding dimensions, while cross-entropy loss with inverse-frequency class weights handles the class imbalance.
Evaluation followed a strict source-image-level partitioning protocol: all patches from the same field image stayed within a single data partition, the detector saw only development pool images, and the locked test set was used solely for final evaluation. On that locked hold-out test set, the proposed framework achieved 97.49 plus or minus 0.73 percent accuracy and 94.82 plus or minus 0.81 percent macro F1-score across five fold models, significantly outperforming seven reimplemented baseline methods trained under the identical protocol, optimizer, epoch budget, and augmentation scheme. The strongest baseline reached 89.93 percent accuracy and 87.08 percent macro F1, and Welch t-tests confirmed the differences exceeded fold-to-fold variation for both metrics.
An ablation study revealed the most striking insight: architecture and loss functions alone were not enough. A ResNet-18 model on whole images scored 0.882 accuracy, a ViT model 0.867, and combining them with cross-entropy loss actually lowered accuracy to 0.860. Adding the similarity-weighted contrastive loss to whole-image input reduced performance further to 0.823, showing that metric-learning objectives become unstable when embeddings mix disease evidence, healthy tissue, and background clutter. Only when the classifier received localized instance-level patches did the full framework reach 0.980 accuracy and 0.939 macro F1 with the ensemble, demonstrating that reformulating the task as instance-level learning, not added components, drove the gains.
Per-class analysis showed the framework raising F1-scores for healthy, slug damage, and spot to between 0.97 and 0.99, with spot improving from a baseline range of 0.78 to 0.81 up to 0.98. The curl class remained the weakest at 0.82, below the 0.88 achieved by CNN-only and hybrid baselines, but the authors caution this estimate rests on only 25 test patches, giving a 95 percent confidence interval of roughly 0.61 to 0.91 on recall, so the difference falls within what this sample size can resolve. The authors also note limitations: the method has only been tested on the DiaMOS pear leaf dataset, classification quality depends on localization quality, and the manual re-annotations vary in consistency. Future work will target validation on additional crops, larger multi-class datasets, and more robust localization.
Subject of Research: An instance-level localization and similarity-aware contrastive learning framework for classifying plant diseases in real-field leaf images.
Article Title: Instance-level localization and similarity-aware contrastive learning for robust plant disease classification
Article References: Batool, H., Murad, M., Khan, S. D., Munshi, A., Alotaibi, M., & Masud, M. I. (2026). Instance-level localization and similarity-aware contrastive learning for robust plant disease classification. Frontiers in Artificial Intelligence, 9, Article 1913825. https://doi.org/10.3389/frai.2026.1913825
Image Credits: AI Generated
DOI: 10.3389/frai.2026.1913825
Keywords: plant disease classification, deep learning, YOLOv8n, CNN-Transformer, contrastive learning, DiaMOS Plant dataset, computer vision, agriculture, instance-level localization, pear leaf disease, macro F1-score, Instance-level
News Source: Alan Morgan. (October 29, 2026). Research report: Instance-level localization and similarity-aware contrastive learning for robust plant disease classification. Scienmag.



