Plant Disease Classification Model

This repository contains a pre-trained InceptionResNetV2 model for plant disease classification. The model can classify 38 different plant diseases and healthy conditions across various plant species.

Model Information

  • Framework: Keras/TensorFlow
  • Architecture: InceptionResNetV2
  • Task: Image Classification
  • Number of Classes: 38
  • Input Shape: (224, 224, 3) - RGB images
  • Output: Probability distribution over 38 classes

Supported Plant Species and Conditions

The model can classify the following plant species and their conditions:

Apple

  • Apple scab
  • Black rot
  • Cedar apple rust
  • Healthy

Blueberry

  • Healthy

Cherry (including sour)

  • Powdery mildew
  • Healthy

Corn (maize)

  • Cercospora leaf spot Gray leaf spot
  • Common rust
  • Northern Leaf Blight
  • Healthy

Grape

  • Black rot
  • Esca (Black Measles)
  • Leaf blight (Isariopsis Leaf Spot)
  • Healthy

Orange

  • Haunglongbing (Citrus greening)

Peach

  • Bacterial spot
  • Healthy

Pepper, bell

  • 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 Two-spotted spider mite
  • Target Spot
  • Tomato Yellow Leaf Curl Virus
  • Tomato mosaic virus
  • Healthy

Usage

Loading the Model

import tensorflow as tf
from huggingface_hub import hf_hub_download

# Download the model from Hugging Face
model_path = hf_hub_download(
    repo_id="kero2111/Plant_Disease",
    filename="Pretrained_model.h5"
)

# Load the model
model = tf.keras.models.load_model(model_path)

Making Predictions

import numpy as np
from PIL import Image

# Load and preprocess image
def preprocess_image(image_path):
    img = Image.open(image_path)
    img = img.resize((224, 224))
    img = np.array(img) / 255.0
    img = np.expand_dims(img, axis=0)
    return img

# Make prediction
image = preprocess_image("path_to_your_image.jpg")
prediction = model.predict(image)
predicted_class = np.argmax(prediction[0])
confidence = prediction[0][predicted_class]

# Get class name
classes = [
    "Apple___Apple_scab", "Apple___Black_rot", "Apple___Cedar_apple_rust", "Apple___healthy",
    "Blueberry___healthy", "Cherry_(including_sour)___Powdery_mildew", "Cherry_(including_sour)___healthy",
    "Corn_(maize)___Cercospora_leaf_spot Gray_leaf_spot", "Corn_(maize)___Common_rust_",
    "Corn_(maize)___Northern_Leaf_Blight", "Corn_(maize)___healthy", "Grape___Black_rot",
    "Grape___Esca_(Black_Measles)", "Grape___Leaf_blight_(Isariopsis_Leaf_Spot)", "Grape___healthy",
    "Orange___Haunglongbing_(Citrus_greening)", "Peach___Bacterial_spot", "Peach___healthy",
    "Pepper,_bell___Bacterial_spot", "Pepper,_bell___healthy", "Potato___Early_blight",
    "Potato___Late_blight", "Potato___healthy", "Raspberry___healthy", "Soybean___healthy",
    "Squash___Powdery_mildew", "Strawberry___Leaf_scorch", "Strawberry___healthy",
    "Tomato___Bacterial_spot", "Tomato___Early_blight", "Tomato___Late_blight", "Tomato___Leaf_Mold",
    "Tomato___Septoria_leaf_spot", "Tomato___Spider_mites Two-spotted_spider_mite",
    "Tomato___Target_Spot", "Tomato___Tomato_Yellow_Leaf_Curl_Virus", "Tomato___Tomato_mosaic_virus",
    "Tomato___healthy"
]

print(f"Predicted: {classes[predicted_class]}")
print(f"Confidence: {confidence:.2%}")

Model Performance

The model has been trained on a comprehensive dataset of plant disease images and can accurately classify various plant diseases and healthy conditions.

Requirements

  • TensorFlow 2.x
  • NumPy
  • PIL (Pillow)
  • huggingface_hub

License

This model is provided for research and educational purposes.

Citation

If you use this model in your research, please cite the original dataset and model architecture used.

Downloads last month
2
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support