An open access repository of images on plant health to enable the development of mobile disease diagnostics
Paper • 1511.08060 • Published
How to use animeshakr/plant-disease-efficientnetv2s with Keras:
# Available backend options are: "jax", "torch", "tensorflow".
import os
os.environ["KERAS_BACKEND"] = "jax"
import keras
model = keras.saving.load_model("hf://animeshakr/plant-disease-efficientnetv2s")
Automated plant disease classification trained on the PlantVillage benchmark (38 classes, 54,306 images).
Live demo: 🤗 HuggingFace Space
GitHub: Animesh-Kr/Plant-Disease-Prediction
| Property | Value |
|---|---|
| Architecture | EfficientNetV2S |
| Input resolution | 384 × 384 |
| Number of classes | 38 |
| Dataset | PlantVillage (Hughes & Salathé, 2015) |
| Test accuracy | 99.57% |
| Macro F1 | 99.48% |
| Top-3 accuracy | 99.98% |
| Parameters | ~21M |
| Training framework | TensorFlow / Keras 3 |
| Model | Test Accuracy | Macro F1 | Weighted F1 | Top-3 Accuracy | Mean Confidence |
|---|---|---|---|---|---|
| Baseline CNN (4-block, scratch) | 91.23% | 89.32% | 91.28% | 98.74% | 78.54% |
| EfficientNetV2S (this model) | 99.57% | 99.48% | 99.57% | 99.98% | 90.55% |
Input (384×384×3)
↓
Augmentation layers
↓
EfficientNetV2S backbone (ImageNet pretrained, include_preprocessing=True)
↓ ← top 40% unfrozen during fine-tune stage
GlobalAveragePooling2D
↓
Dropout(0.3) → Dense(512, swish) → Dropout(0.3)
↓
Dense(38, softmax)
| Plant | Diseases |
|---|---|
| Apple | Apple scab, Black rot, Cedar apple rust, Healthy |
| Blueberry | Healthy |
| Cherry | Powdery mildew, Healthy |
| Corn | Cercospora leaf spot, Common rust, Northern leaf blight, Healthy |
| Grape | Black rot, Esca (Black Measles), Leaf blight, Healthy |
| Orange | Haunglongbing (Citrus greening) |
| Peach | Bacterial spot, Healthy |
| Pepper | Bacterial spot, Healthy |
| Potato | Early blight, Late blight, Healthy |
| Raspberry | Healthy |
| Soybean | Healthy |
| Squash | Powdery mildew |
| Strawberry | Leaf scorch, Healthy |
| Tomato | Bacterial spot, Early blight, Late blight, Leaf mold, Septoria leaf spot, Spider mites, Target spot, Yellow leaf curl virus, Mosaic virus, Healthy |
import tensorflow as tf
import numpy as np
import json
from PIL import Image
# Load model
interp = tf.lite.Interpreter(model_path="model_float16_quant.tflite")
interp.allocate_tensors()
ind = interp.get_input_details()[0]
outd = interp.get_output_details()[0]
# Load labels
with open("class_indices.json") as f:
class_map = json.load(f) # {"0": "Apple___Apple_scab", ...}
def predict(img_path: str, top_k: int = 5):
img = Image.open(img_path).convert("RGB").resize((384, 384))
arr = np.expand_dims(np.array(img, dtype=np.float32), axis=0)
interp.set_tensor(ind["index"], arr)
interp.invoke()
probs = interp.get_tensor(outd["index"])[0]
top = np.argsort(probs)[-top_k:][::-1]
return [(class_map[str(i)], float(probs[i])) for i in top]
results = predict("leaf.jpg")
for cls, conf in results:
print(f"{cls}: {conf*100:.1f}%")
import keras
import numpy as np
import json
from PIL import Image
model = keras.models.load_model("best_model.keras")
class_map = json.load(open("class_indices.json"))
def predict(img_path: str, top_k: int = 5):
img = Image.open(img_path).convert("RGB").resize((384, 384))
arr = np.expand_dims(np.array(img, dtype=np.float32), axis=0)
prob = model.predict(arr, verbose=0)[0]
top = np.argsort(prob)[-top_k:][::-1]
return [(class_map[str(i)], float(prob[i])) for i in top]
| File | Size | Description |
|---|---|---|
model_float16_quant.tflite |
~45 MB | TFLite float16 — for deployment |
class_indices.json |
2 KB | Label mapping {"0": "Apple___Apple_scab", ...} |
@misc{kumar2025plantdisease,
author = {Animesh Kumar},
title = {Plant Disease Detection using EfficientNetV2S},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/animeshakr/plant-disease-efficientnetv2s}
}
Developed by Animesh Kumar