Skip to content

Leaffliction

Leaf-disease classification over 8 apple and grape classes with a PyTorch CNN, with preprocessing and augmentation to balance the classes.

ROLE
Team of 2 · École 42 · AI projects
STACK
Python · PyTorch · OpenCV · matplotlib
RESULT
94.1 % accuracy on 152 held-out test images.
READING TIME
1 min read
1

Data

Leaf images from the École 42 subject: 8 apple and grape disease classes.

2

What I built

Team of 2

  1. About 80 % of the code by git blame.
  2. The image transformations module.
  3. The CNN, prediction, the command-line tool and plotting.
  4. Most of the training pipeline.
3

Key choices

Split grouped by source image
Augmented copies of one leaf never land on both sides of the split.
Balanced classes
Augmentation evens out the class counts before training.
A compact CNN
422,632 parameters.
4

Results

90 %100 %Validation (model selection)98.1 %Held-out test, 152 images94.1 %
Best checkpoint selected on a stratified 20 % validation split grouped by source image; tested on 152 images kept apart from training (test_images/100). Evaluation log not committed; figures from the README.

94.1 % accuracy on 152 held-out test images.

5

Limits

  • Trained on half of the training data.
  • The validation score also selected the checkpoint; the 152-image test set is the only independent number.
  • The evaluation log is not committed.
  • The Hugging Face demo sleeps when idle and takes a moment to wake up.

Questions about this project? → Email me