AgriBot - Maize Leaf Disease Diagnosis Model
Model Description
AgriBot is a machine learning model for diagnosing maize (corn) leaf diseases. The model uses MobileNetV2 as a feature extractor combined with Logistic Regression for classification, achieving 94% accuracy.
This model was developed by Crusaders during the AYITI IA 2025 Hackathon (November 28-30, 2025).
Model Details
- Architecture: MobileNetV2 (feature extraction) + Logistic Regression (classification)
- Framework: PyTorch (MobileNetV2) + scikit-learn (LogisticRegression)
- Model Type: Image Classification
- Input: RGB images of maize leaves (224x224 pixels)
- Output: Disease classification with confidence score
- Accuracy: 94%
Classes
The model can identify 5 different categories:
- Cercospora Leaf Spot (Gray Leaf Spot) - Fungal disease causing gray lesions
- Common Rust - Fungal disease with orange-brown pustules
- Northern Leaf Blight - Fungal disease causing cigar-shaped lesions
- Healthy - No disease detected
- Other - Non-maize plant or unrecognized pattern
Dataset
This model was trained on the Corn or Maize Leaf Disease Dataset from Kaggle:
Dataset Link: https://www.kaggle.com/datasets/smaranjitghose/corn-or-maize-leaf-disease-dataset
Dataset Details:
- Source: Kaggle (Smaranjit Ghose)
- Content: Images of healthy and diseased maize leaves
- Categories: Multiple disease types and healthy samples
- License: Available on Kaggle dataset page
Data Preprocessing:
- Images resized to 224x224 pixels
- Normalized using ImageNet statistics (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
- Features extracted using pretrained MobileNetV2
- Balanced dataset across all classes
We thank the dataset creator for making this valuable resource available to the community.
Usage
Installation
pip install torch torchvision scikit-learn pillow numpy joblib
Quick Start
import joblib
import torch
import numpy as np
from PIL import Image
from torchvision import models, transforms
# Load the model
model = joblib.load('agribot_models.pkl')
# Load MobileNetV2 for feature extraction
mobilenet = models.mobilenet_v2(pretrained=True)
mobilenet.classifier = torch.nn.Identity()
mobilenet.eval()
# Image preprocessing
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
# Load and preprocess image
image = Image.open('maize_leaf.jpg').convert('RGB')
img_tensor = transform(image).unsqueeze(0)
# Extract features
with torch.no_grad():
features = mobilenet(img_tensor).numpy()
# Predict
prediction = model.predict(features)[0]
probabilities = model.predict_proba(features)[0]
confidence = float(np.max(probabilities) * 100)
# Class labels
class_labels = [
"Cercospora Leaf Spot (Gray Leaf Spot)",
"Common Rust",
"Northern Leaf Blight",
"Healthy",
"Other"
]
print(f"Diagnosis: {class_labels[prediction]}")
print(f"Confidence: {confidence:.2f}%")
Performance
- Overall Accuracy: 94%
- Model Size: Lightweight (~15MB total)
- Inference Speed: Fast (suitable for mobile/edge deployment)
- Offline Capable: Works without internet connection
Intended Use
Primary Use Cases:
- Agricultural disease diagnosis for maize crops in Haiti and globally
- Educational tools for farmers and agronomists
- Mobile applications for field diagnosis
- Research and development in crop disease management
- Offline diagnosis in areas with limited internet connectivity
Limitations:
- Model is specifically trained for maize leaf diseases
- Works best with clear images of individual leaves
- Performance may vary with different lighting conditions
- Requires proper image focus and leaf visibility
- Does not diagnose multiple diseases on the same leaf
Training Details
- Base Model: MobileNetV2 (pretrained on ImageNet)
- Classifier: Logistic Regression
- Training Framework: PyTorch + scikit-learn
- Hackathon Duration: 3 days (November 28-30, 2025)
- Team: Crusaders
Team - Crusaders
This model was developed during the AYITI IA 2025 Hackathon by Crusaders team members.
Hackathon: AYITI IA 2025
Dates: November 28-30, 2025
Achievement: 94% accuracy in maize disease classification
Our Approach: Unlike most hackathon projects that focused on fine-tuning LLMs and API integrations, we took a different path:
- No API dependencies - completely self-contained
- No ChatGPT/LLM usage - custom CNN-based solution
- Offline capability - works without internet
- Context-specific - built for Haitian agricultural needs
- Practical solution - addresses real farming challenges
Web Application
A complete web application with FastAPI backend and interactive frontend is available at: GitHub Repository
The web app provides:
- Real-time image upload and diagnosis
- Visual feedback with color-coded results
- Detailed disease information and treatment recommendations
- Mobile-friendly interface
License
MIT License
Copyright (c) 2025 Crusaders
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Citation
If you use this model in your research or application, please cite:
@software{agribot_crusaders_2025,
title={AgriBot: Maize Leaf Disease Diagnosis Model},
author={Crusaders},
year={2025},
month={November},
howpublished={AYITI IA 2025 Hackathon},
url={https://huggingface.co/crusadersAI/agribot-maize-diagnosis}
}
Acknowledgments
- AYITI IA 2025 Hackathon organizers
- Smaranjit Ghose for the Kaggle dataset
- Kaggle community for dataset resources
- PyTorch and scikit-learn communities
Contact
For questions, issues, or collaboration:
- GitHub: crusaderscompagnySA
- Repository: live-hosting
- Hugging Face: crusadersAI