(mobile pe camera bhi khulega)
64x64, LAB + CLAHE (same as training)
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.| Metric | A: real only | B: real + synthetic |
|---|---|---|
| Macro-F1 (38 classes) | 0.9784 ± 0.0000 | 0.9708 ± 0.0027 |
| Accuracy | 98.42% ± 0.08 | 97.78% ± 0.21 |
| Mean recall, 6 rare classes | 93.56% ± 1.68 | 94.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 class | A recall | B recall |
|---|---|---|
| Apple - Cedar apple rust | 99.2% | 100% |
| Tomato - Mosaic virus | 98.2% | 98.8% |
| Corn - Gray leaf spot | 86.6% | 87.4% |
| Apple - Black rot | 93.9% | 97.8% |
| Apple - Apple scab | 94.7% | 94.7% |
| Tomato - Leaf Mold | 88.8% | 85.3% |
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.