Downloads · 30 days
17
8% of all-time downloads
kero2111/Plant_Disease
Plant_Disease is a image classification model from kero2111. Use it when you need a label for an image. It is set up for keras. The card lists the license as mit.
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.
Downloads · 30 days
17
8% of all-time downloads
All-time downloads
214
Public
Repo size
659 MB
Likes
4
Public
Click a slice to open those files.
.h5659 MB · 99%
From the Hugging Face model README
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.
The model can classify the following plant species and their conditions:
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)
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%}")
The model has been trained on a comprehensive dataset of plant disease images and can accurately classify various plant diseases and healthy conditions.
This model is provided for research and educational purposes.
If you use this model in your research, please cite the original dataset and model architecture used.