Idriss Lemnouni Get in touch
All projects

Computer vision / Machine learning

Bean disease classification in field photographs

Can a leaf classifier distinguish three bean conditions, and what happens when the photograph is blurred or darkened?

Solution

I compared a small CNN with MobileNetV3, calibrated its predictions and used Grad-CAM to investigate errors.

My contribution · I trained both classifiers, calibrated MobileNetV3, and reviewed test errors using Grad-CAM and image perturbations.

Tools Python · PyTorch · torchvision · FastAPI

Results

MobileNetV3 scored 0.8775 macro-F1 on 128 test images. Under blur and darkening, the score fell to 0.7705.

Grad-CAM highlighted background features in some examples, including a hand holding a leaf.

MobileNetV3 test macro-F1
0.8775 Source

Data & evaluation

Data sources

  • Makerere AI Lab and NaCRRI smartphone images from Uganda: 1,034 train, 133 validation and 128 test photos

Method

  1. Use the official partitions, screen for duplicate images, select on validation macro-F1 and calibrate the selected model’s probabilities.
  2. Train a three-block baseline and a linear head over frozen ImageNet features. Inspect test errors with Grad-CAM and a fixed blur-and-darkening check.

Limitations

Farm and plant identifiers were unavailable. These results cannot establish diagnostic accuracy on independent farms.

The tests cover a fixed image perturbation and 128 images from the official split. Performance in new capture conditions or in operational use requires independent farm-level evaluation.

Reproduce the study

Use Python 3.12 and CPU PyTorch with the locked requirements. Prepare the official Makerere splits, then follow the benchmark and evaluation steps.

Local reproduction instructions and pinned source

Skills demonstrated

  • Transfer learning
  • Probability calibration
  • Visual error analysis

Project figures