Downloads · 30 days
9
10% of all-time downloads
eligapris/agroeye
agroeye is a image classification model from eligapris. Use it when you need a label for an image. It is set up for tf-keras. The card lists the license as mit.
This model is designed to detect diseases in maize (corn) leaves using computer vision techniques.
Downloads · 30 days
9
10% of all-time downloads
All-time downloads
91
Public
Repo size
24.8 MB
Likes
0
Public
Click a slice to open those files.
.data-00000-of-0000118.3 MB · 74%
From the Hugging Face model README
This model is designed to detect diseases in maize (corn) leaves using computer vision techniques.
The agroEye is a convolutional neural network (CNN) trained to classify images of maize leaves into four categories: Healthy, Gray Leaf Spot, Blight, and Common Rust. It aims to assist farmers and agricultural professionals in quickly identifying common maize diseases, potentially leading to earlier interventions and improved crop management.
The model is intended for use as a diagnostic tool to assist in the identification of maize leaf diseases. It should be used in conjunction with expert knowledge and not as a sole means of diagnosis. The model's performance may vary depending on image quality, lighting conditions, and the presence of diseases or conditions not included in the training dataset.
Limitations:
Here's a basic example of how to use the model:
import tensorflow as tf
from PIL import Image
import numpy as np
import json
import tensorflow as tf
from huggingface_hub import snapshot_download
# Download the entire model directory
model_dir = snapshot_download(repo_id="eligapris/agroeye",
local_dir="path/to/model")
# Load the model
model = tf.saved_model.load('path/to/model')
# Now you can use the model for inference
# Load and preprocess the image
img = Image.open('/path/to/image.jpg')
img = img.resize((300, 300 * img.size[1] // img.size[0]))
img_array = np.array(img)[None]
# Make prediction
inp = tensorflow.constant(img_array, dtype='float32')
prediction = model(inp)[0].numpy()
# Load class names
with open('path/to/model/classes.json', 'r') as f:
class_names = json.load(f)
# Get the predicted class
predicted_class = list(class_names.keys())[prediction.argmax()]
print(f"Predicted class: {predicted_class}")
Here's a detailed output of model prediction:
import tensorflow as tf
from PIL import Image
import numpy as np
import json
import tensorflow as tf
from huggingface_hub import snapshot_download
# Download the entire model directory
model_dir = snapshot_download(repo_id="eligapris/agroeye",
local_dir="path/to/model")
# Load the model
model = tf.saved_model.load('path/to/model')
# Now you can use the model for inference
# Load and preprocess the image
img = Image.open('/path/to/image.jpg')
img = img.resize((300, 300 * img.size[1] // img.size[0]))
img_array = np.array(img)[None]
# Make prediction
inp = tensorflow.constant(img_array, dtype='float32')
prediction = model(inp)[0].numpy()
# Load class names and details
with open('model/classes_detailed.json', 'r') as f:
data = json.load(f)
class_names = data['classes']
class_details = data['details']
# Get the predicted class
predicted_class = list(class_names.keys())[prediction.argmax()]
predicted_class_label = class_names[predicted_class]
print(f"Predicted class: {predicted_class} (Label: {predicted_class_label})")
# Print detailed information about the predicted class
if predicted_class in class_details:
details = class_details[predicted_class]
print("\nDetailed Information:")
for key, value in details.items():
if isinstance(value, list):
print(f"{key.capitalize()}:")
for item in value:
print(f" - {item}")
else:
print(f"{key.capitalize()}: {value}")
# Print general notes
print("\nGeneral Notes:")
for note in data['general_notes']:
print(f"- {note}")
https://colab.research.google.com/drive/13-S-obR6MZDDP5kgj6ytsbFiNKzzfXbp
Grey
eligapris