Classification of Tomato Leaf Diseases Using ResNet-18 Under Real Farm Conditions

Authors

  • Nabiha Babar Department of Computer Science,University of Agriculture Faisalabad, Pakistan, Email: nabihababar036@gmail.com Author
  • Noor-ul-ain Naveed Department of Computer Science,University of Agriculture Faisalabad, Pakistan, Email: noorulain.naveed123@gmail.com Author
  • Eman Habib Department of Computer Science,University of Agriculture Faisalabad, Pakistan, Email: emanhabib572@gmail.com Author
  • Muhammad Milhan Afzal Khan Department of Computer Science,University of Agriculture Faisalabad, Pakistan, Email: milhankhan@uaf.edu.pk Author
  • Mahnoor Khan Department of Computer Science,University of Agriculture Faisalabad, Pakistan, Email: mkhan.msds25seecs@seecs.edu.pk Author
  • Syed Daniyal Hussain Department of Computer Science,University of Agriculture Faisalabad, Pakistan, Email: daniyal786111@gmail.com Author

DOI:

https://doi.org/10.63163/jpehss.v4i1.1458

Keywords:

Tomato Leaf Disease, Deep Learning, CNN, ResNet-18, Real Farm Conditions, Image Classification

Abstract

The tomato is cultivated throughout almost all the parts of the world, and provides food to millions of people. Sadly a handful of leaf diseases are still ruining crops and no one is making any money from the small farms and there is a lack of food in much of the region. I don't know what these terms mean to an outsider, but these can annihilate all of the growers who depend on each kg of crop. Once infected, a single leaf can produce spores which infect the entire greenhouse or field in just a few days, ruining a good growing season. Inspection of each row of crops and an inspection of each plant is a time consuming process. No experienced scouts with their magnifiers and field books are able to see the first symptoms. Early signs of the disease can be a chlorotic halo, pinprick necrotic dot and a slight alteration of leaf texture. Pathogen symptoms are apparent only when symptoms first appear in the canopy, indicating that pathogens are well established in the canopy. Now the farmer has two options, spraying or not spraying the field. This results in a loss for him in both directions. In this context, the research of deep learning as a possible solution to the problem is necessary. CNN can process an image of a leaf within a fraction of a second, identify subtle differences the human eye wouldn't see in color and texture and classify the diseases with a surprising accuracy. Different architectures have been developed, including VGG, DenseNet and ResNet and with accuracy of 90% or higher. Most of these published papers use almost perfect laboratory images which are distraction free, are uniformly lit, have a white background and a centered leaf. The pictures are not representative of the situation on farms. The models are not very effective once they are put into use. There may be a glare or shadow over one leaf, the lighting may vary due to the presence of clouds or other plants may appear in the frame as stems and flowers vie for the attention of the network. These aspects may not be seen in training images in a lab setting due to the complexity of the images. The network may even label non-pathogenic soil particles as pathogenic, and may not detect any lesions, because of shadowing. As a consequence, this means extra need for chemicals or worse yet, unrecognized infections will result in outbreak of the epidemic. This research seeks to address this issue. A collection of over 2,900 images of tomato leaves were carefully selected from Kaggle and Mendeley Data to train and evaluate the ResNet-18 model. The dataset consists of clean laboratory pictures as well as messy field images. The background and lighting have not been sanitized nor normalized for the process, but they have been preprocessed in terms of the standardized resolutions and noise suppression. To simulate the variability of outdoor photography, without requiring thousands of additional field trips, data augmentation was used and included the addition of rotation, flipping, brightness jitter, adding synthetic shadows, and random crops. The model stood firmly, unmoving. On held-out test images it scored 95.63% accuracy, 95.80% precision, 95.60% recall, and 95.70% F1. Those figures indicate that even when the world around the leaf doesn't keep it tidy, a standard CNN with a realistic diet of photos can still be able to detect disease patterns. The skip connections helped the network learn the hierarchical features, while "noising" the gradient to capture color changes and edge orientations in the early layers, and creating the lesion shapes and pigmentation in the deep layers, specific to the disease in ResNet-18. Training loss also continued to decrease (0.6852 to 0.0829), and the validation accuracy continued to get better and stabilize at 96.75% to show that learning was indeed generalizing and not memorizing. A tool such as this would help farmers to be able to make a speedy diagnosis and treatment decisions before losses can be great. Leaf disease of tomato plants is an important problem in agriculture. Tomato leaf disease is an important disease of agriculture.

Downloads

Published

2026-03-25

Issue

Section

Computer Science and Information Technology