Education project

Lettuce Disease Detector

Healthy lettuce, weeds and six diseases, and an evaluation that does not hide the small classes

An image classifier built on MobileNetV2 that tells healthy lettuce, weeds and six diseases apart, meant for SmartPot, with an evaluation that shows where it fails.

What it is about

The fifth guide of Computer Vision and Artificial Intelligence asked for an image classifier. I built it on Kaggle's Lettuce Diseases dataset, because SmartPot grows lettuce in hydroponics and a model like this can warn when a leaf gets sick.

The model starts from a pretrained MobileNetV2 and trains a new head for the eight classes. The repository keeps the training history, the confusion matrix, the per-class report and the evaluation metrics.

What it does

  • MobileNetV2 with transfer learning on Kaggle's Lettuce Diseases dataset, with eight classes.
  • 97.9% accuracy on 2,337 test images, with the confusion matrix and the per-class report kept in the repository.
  • Average recall per class is 65.7%, because the six diseases have between 6 and 30 test images each and the model gets between a third and two thirds of them right.
  • A Python package with training, evaluation and prediction scripts, set up with uv and tested on its configuration and dataset.
  • It exports the model and its artifacts so it can be wired to SmartPot's crops later.

Decisions and their costs

  1. Transfer learning instead of a network from scratch

    Some diseases have few images, and a network trained from scratch had little to learn their features from.

  2. Report recall per class next to accuracy

    The 97.9% accuracy rests on the two large classes, with more than 1,100 images each.

Repositories

Every public repository of the project, with what it holds.

  • 2026

    ComputerVisionIAEngineeringSebastian-s

    Computer vision in five guides, on convolutions and color, a vision model behind an API, Sentinel-1 radar clustering, deep learning and lettuce disease detection.

    Python, Jupyter
GitHub organization: EngineeringSebastian-s

Stack

Pick a technology to see the projects that use it.