π¬ ArogyaDrishti β Crop Disease Detection Model
Part of the KissanSahyog agritech platform.
ArogyaDrishti (Sanskrit: ΰ€ΰ€°ΰ₯ΰ€ΰ₯ΰ€―ΰ€¦ΰ₯ΰ€·ΰ₯ΰ€ΰ€Ώ) means "healthy vision / disease sight".
Architecture
- Backbone 1: ResNet50
- Backbone 2: DenseNet121
- Attention: SE (Squeeze-and-Excitation) Block
- Head: MLP Classifier
Model Files
| File | Description |
|---|---|
hybrid_resnet_densenet_checkpoint.pth |
Training checkpoint |
best_hybrid_resnet_densenet.pth |
Best validation accuracy weights β (use this) |
Inputs
- Leaf image (RGB, resized to 224Γ224)
Output
- Top-K disease class predictions with confidence scores
Usage
import torch
from torchvision import transforms
from PIL import Image
# Load model (define your HybridModel class first)
model = HybridModel(num_classes=38)
model.load_state_dict(torch.load("best_hybrid_resnet_densenet.pth", map_location="cpu"))
model.eval()
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
])
img = transform(Image.open("leaf.jpg")).unsqueeze(0)
with torch.no_grad():
logits = model(img)
probs = torch.softmax(logits, dim=1)[0]
top_p, top_idx = torch.topk(probs, k=3)
for i in range(len(top_p)):
print(f"Class: {top_idx[i].item()}, Confidence: {top_p[i].item():.2f}")