🍃 LeafGen AI

Plant disease detection (38 classes, 14 crops) and conditional-GAN synthetic leaves for rare diseases. Supports UN SDG 2 (Zero Hunger). Everything runs in your browser; your photo is never uploaded.

Leaf photo yahan drop karo ya click karke chuno
(mobile pe camera bhi khulega)
After OpenCV preprocessing
64x64, LAB + CLAHE (same as training)

Top-3 predictions
Result yahan dikhega
Research prototype. Lab photos (plain background) pe trained hai, real khet ki photos pe reliable nahi. Sirf 14 crops jaanta hai.


Ye images AI-generated hain (real photos nahi). GAN 64x64 pe trained hai.

Real-only (A) vs Real + synthetic (B)

3 seeds, 8,146 real test images. 6 rare classes ki train images = 100 each, B mein +500 synthetic per rare class.
MetricA: real onlyB: real + synthetic
Macro-F1 (38 classes)0.9784 ± 0.00000.9708 ± 0.0027
Accuracy98.42% ± 0.0897.78% ± 0.21
Mean recall, 6 rare classes93.56% ± 1.6894.02% ± 2.08

Honest finding: synthetic images did not improve overall performance (slightly lower in all 3 seeds), and the rare-class gain is within noise. A pretrained ResNet18 already does well with 100 real images per class.

Rare classA recallB recall
Apple - Cedar apple rust99.2%100%
Tomato - Mosaic virus98.2%98.8%
Corn - Gray leaf spot86.6%87.4%
Apple - Black rot93.9%97.8%
Apple - Apple scab94.7%94.7%
Tomato - Leaf Mold88.8%85.3%
comparison chart real vs synthetic confusion matrix A confusion matrix B
Original
Denoised (bilateral filter)
Contrast enhanced (CLAHE)

How it works

1) OpenCV: resize to 64x64, LAB colour space, CLAHE contrast enhancement. 2) ResNet18 (transfer learning) classifies into 38 classes. 3) A conditional DCGAN (noise + class label) generates synthetic leaves for rare classes. 4) We tested whether adding synthetic images improves the classifier.

Limitations: PlantVillage = lab photos with plain background; one leaf appears in many photos, so random splits can inflate scores; 64x64 resolution; only 14 crops.

Dataset: PlantVillage (Hughes & Salathe, 2015). Runtime: onnxruntime-web + OpenCV.js.