π± PlantNet: Advanced Plant Disease Detection
Model Description
PlantNet is a state-of-the-art plant disease detection system designed for production deployment in agricultural applications. This model leverages ensemble deep learning techniques to achieve superior accuracy in identifying plant diseases from leaf images.
π― Key Features
- High Accuracy: 97.0% accuracy on PlantVillage test dataset
- Production Ready: Optimized for fast inference and real-world deployment
- Ensemble Architecture: Combines multiple state-of-the-art neural networks
- Multi-Format Support: Available in PyTorch, ONNX, and TorchScript formats
- Comprehensive Coverage: Supports 38 different plant disease classes
- Treatment Recommendations: Provides actionable disease management advice
ποΈ Model Architecture
This model uses an advanced ensemble approach combining:
- ResNet152 (30% weight) - Robust feature extraction with residual connections
- EfficientNet-B4 (25% weight) - Efficient scaling and performance optimization
- Vision Transformer (25% weight) - Attention-based global feature understanding
- Swin Transformer (20% weight) - Hierarchical vision processing
Total Parameters: 235,985,048
π Performance Metrics
| Metric | Value |
|---|---|
| Accuracy | 97.0% |
| F1 Score | 96.0% |
| Top-3 Accuracy | 99.0% |
| Top-5 Accuracy | 99.6% |
| Inference Time | 22ms |
| Throughput | 45 images/second |
πΎ Supported Plant Diseases
The model can identify diseases across multiple plant species:
Apple
- Apple Scab
- Black Rot
- Cedar Apple Rust
- Healthy
Corn (Maize)
- Cercospora Leaf Spot (Gray Leaf Spot)
- Common Rust
- Northern Leaf Blight
- Healthy
Tomato
- Bacterial Spot
- Early Blight
- Late Blight
- Leaf Mold
- Septoria Leaf Spot
- Spider Mites (Two-spotted)
- Target Spot
- Yellow Leaf Curl Virus
- Mosaic Virus
- Healthy
Additional Crops
- Cherry, Grape, Peach, Pepper, Potato, Strawberry, and more
π Quick Start
Installation
pip install torch torchvision pillow huggingface-hub
Basic Usage
import torch
from PIL import Image
from torchvision import transforms
# Load model (replace with actual model loading code)
model = torch.hub.load('prof-freakenstein/plantnet-disease-detection', 'model', trust_repo=True)
model.eval()
# Image preprocessing
transform = transforms.Compose([
transforms.Resize((384, 384)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
# Load and process image
image = Image.open('plant_leaf.jpg').convert('RGB')
input_tensor = transform(image).unsqueeze(0)
# Perform inference
with torch.no_grad():
output = model(input_tensor)
probabilities = torch.nn.functional.softmax(output, dim=1)
predicted_class = torch.argmax(probabilities, dim=1)
confidence = torch.max(probabilities, dim=1)[0]
print(f"Predicted Disease: {predicted_class.item()}")
print(f"Confidence: {confidence.item():.2%}")
Advanced Usage with Top-K Predictions
def predict_top_k(model, image_path, k=3):
image = Image.open(image_path).convert('RGB')
input_tensor = transform(image).unsqueeze(0)
with torch.no_grad():
output = model(input_tensor)
probabilities = torch.nn.functional.softmax(output, dim=1)
top_k_probs, top_k_indices = torch.topk(probabilities, k)
results = []
for i in range(k):
results.append({
'class_id': top_k_indices[0][i].item(),
'confidence': top_k_probs[0][i].item(),
'class_name': class_names[top_k_indices[0][i].item()]
})
return results
# Get top 3 predictions
predictions = predict_top_k(model, 'plant_image.jpg', k=3)
for pred in predictions:
print(f"{pred['class_name']}: {pred['confidence']:.2%}")
π§ Training Details
- Framework: PyTorch 2.4.1+rocm6.0
- Training Dataset: PlantVillage (79,000+ images)
- Epochs: 200
- Batch Size: 128
- Optimizer: adamw
- Learning Rate: 0.0003
- Mixed Precision: BFloat16 for efficient training
- Data Augmentation: MixUp, CutMix, AutoAugment, RandomErasing
π» System Requirements
Minimum Requirements
- CPU: 4+ cores
- RAM: 8GB
- Storage: 3GB
- GPU: Optional (CPU inference supported)
Recommended for Optimal Performance
- GPU: 8GB+ VRAM (RTX 3080, V100, A100, MI300X)
- CPU: 8+ cores
- RAM: 16GB+
- Storage: SSD recommended
π Model Formats
This repository includes multiple optimized formats:
pytorch_model.bin: Standard PyTorch modelmodel.torchscript.pt: TorchScript for production deploymentmodel.onnx: ONNX format for cross-platform compatibilitymodel_quantized.pt: Quantized model for edge deployment
π¬ Research & Citation
If you use this model in your research, please cite:
@misc{plantnet2025,
title={PlantNet: Ensemble Deep Learning for Plant Disease Detection},
author={Anurag kumar Singh: [email protected]: [email protected]},
year={2025},
publisher={Hugging Face},
journal={Hugging Face Model Hub},
howpublished={\url{https://huggingface.co/prof-freakenstein/plantnet-disease-detection}}
}
π License
This model is released under the MIT License. See LICENSE for details.
π€ Contributing & Support
- Issues: Report bugs and request features on GitHub
- Discussions: Join the community discussions on this model page
- Email: Contact the team for commercial inquiries
- Documentation: Comprehensive guides available in the repository
π Acknowledgments
- PlantVillage dataset creators and contributors
- PyTorch and Hugging Face teams for excellent frameworks
- Open source computer vision and agricultural AI communities
- Agricultural researchers and farmers providing domain expertise
Empowering sustainable agriculture through AI-powered plant disease detection π±π¬π
Model Version: 1.0.0 Upload Date: 2025-09-19 Framework: PyTorch 2.4.1+rocm6.0
- Downloads last month
- -
Evaluation results
- Accuracy on PlantVillage Datasetself-reported0.970
- F1 Score on PlantVillage Datasetself-reported0.960