Inspiration
India has 146 million farming households — yet 95% have no access to affordable agricultural advice. Farmers lose 15–20% of their yield every season due to undetected crop diseases, wrong fertilizer choices, and missed government schemes. A visit to an agricultural expert costs money and time most farmers don't have. We built AI Crop Health to put a expert agronomist in every farmer's pocket — completely free, working in Hindi, Bengali, and English, even on a basic smartphone.
What it does
AI Crop Health is a complete smart farming platform with 6 core features:
Plant Disease Detection — Farmer uploads or clicks a photo of an infected leaf. Our EfficientNetB4 deep learning model (trained on 87,000 images across 38 disease classes) identifies the disease with 98%+ accuracy and gives specific treatment advice with medicine names, dosage, and prevention steps.
Crop Recommendation — Farmer enters soil nutrients (N, P, K), pH, temperature, humidity, and rainfall. Our Random Forest ML model recommends the best crop to grow with confidence scores and suitability ranking.
Fertilizer Recommendation — Based on soil type, crop type, and nutrient levels, the system recommends the exact fertilizer with top-3 alternatives and confidence levels.
AI Voice Chatbot (AgriBot) — Powered by Groq (Llama 3.3 70B). Farmer can type or speak in Hindi, Bengali, or English. The chatbot detects the language automatically and replies in the same language. It follows a step-by-step flow: crop → problem → diagnosis → solution. Works as a complete farming advisor for diseases, fertilizers, government schemes, and cropping tips.
Weather Dashboard — Real-time weather with 5-day forecast, UV index, and AI-generated farming advisories based on conditions (irrigation alerts, heat stress warnings, harvest recommendations).
Government Schemes Browser — Searchable database of PM-KISAN, PMFBY, KCC, and 20+ active schemes with eligibility, benefits, and application process.
How we built it
Backend: Django 4.2 (Python 3.12) with 6 modular apps — detection, features, blog, contact, agrolease, marketplace.
Machine Learning:
- Plant Disease: EfficientNetB4 (transfer learning, ImageNet pretrained, 38 classes, 87K images, two-phase training with label smoothing + cosine LR)
- Crop Recommendation: Random Forest Classifier (scikit-learn, 7 features, 22 crops)
- Fertilizer: Calibrated Random Forest with LabelEncoders (8 features, sklearn)
- Inference: Test-Time Augmentation (TTA) — 6 augmented versions averaged per prediction for higher real-world accuracy
AI / LLM: Groq API (Llama 3.3 70B Versatile) — chatbot with stateful conversation management, language detection, and proper system+history message structure
Voice Input: Web Speech API (browser-native) — auto-detects language (hi-IN / bn-IN / en-IN) and submits to Groq
Weather: OpenWeatherMap API (current + 5-day forecast + One Call 3.0)
Frontend: Bootstrap 5, Chart.js, AOS animations, mobile-first responsive design
Database: SQLite (development) → PostgreSQL ready
Deployment: Gunicorn + WhiteNoise, production-ready settings
Challenges we ran into
Model accuracy vs real-world photos — PlantVillage dataset is lab-controlled. Real farm photos have motion blur, bad lighting, and multiple plants in frame. We built a relaxed ImageValidator that accepts most photos and added TTA at inference to compensate for image quality variance.
Chatbot language consistency — Getting Llama 3.3 to consistently reply in Hindi when the farmer writes in Hindi (not mix languages) required careful system prompt engineering with explicit language rules and state machine tracking across the conversation.
Feature order mismatch — The fertilizer model's training CSV had column order: Temperature → Humidity → Moisture → Soil → Crop → N → K → P. The view was passing them in a different order causing silent wrong predictions. Fixed by tracing back to the training CSV.
Class indices mismatch — Our plant disease model was trained on 38 PlantVillage classes but the class_indices.json had only 35 (missing Blueberry, Raspberry, Soybean). Every prediction from index 4 onwards was wrong. Fixed by replacing with the correct 38-class file.
Groq API method — The google-genai SDK uses
client.generate_content()but the Groq SDK usesclient.chat.completions.create(). Migrating from Gemini to Groq across 3 different call sites (chatbot, crop map, vision validation) while keeping the codebase clean took careful refactoring.
Accomplishments that we're proud of
- Built a full end-to-end agricultural AI platform — not just a demo, but a production-quality Django application with proper logging, audit trails, database models, and admin panels
- Voice input in 3 languages — Hindi, Bengali, and English with automatic language detection on every message
- 98%+ model target accuracy using EfficientNetB4 with two-phase training, heavy augmentation, label smoothing, class weights, and Test-Time Augmentation
- Real farmer UX — image quality validator that helps farmers retake blurry photos instead of just rejecting them, with specific recommendations ("Move closer", "Use better lighting")
- Complete audit logging on every plant diagnosis — crop, disease, confidence, image quality score, Groq validation result — stored in database for model retraining
- AgroLease module — a land leasing marketplace connecting landowners with farmers, with role-based dashboards for owners, farmers, and admins
What we learned
- Transfer learning with EfficientNetB4 dramatically outperforms training from scratch — the ImageNet pretrained backbone already understands textures, edges, and patterns that matter for disease detection
- State machine design for chatbots is far more reliable than open-ended LLM prompting — explicitly tracking crop → intent → symptoms → diagnosis forces the conversation forward without loops
- Real farmers don't type — voice input was the single most important UX decision we made
- Two-phase training (freeze → unfreeze) is critical for fine-tuning large models without catastrophic forgetting of ImageNet features
What's next for AI Crop Health — Smart Farming Platform for India
- Offline mode — Cache disease knowledge base and crop recommendations locally so farmers with 2G or no connectivity can still get basic advice
- Mandi price integration — Real-time market prices from AGMARKNET API so farmers know the best time and place to sell their harvest
- Soil test upload — Let farmers photograph their soil test report and auto-extract N, P, K, pH values using OCR
- WhatsApp bot — Deploy AgriBot on WhatsApp so farmers don't need to download an app
- Model retraining pipeline — Use the farmer feedback collected via DiagnosisLog to retrain the model on Indian field conditions every quarter
- Regional language expansion — Tamil, Telugu, Marathi, Gujarati ```
Built With
- bootstrap-5
- chart.js
- css3
- django
- efficientnetb4
- groq
- gunicorn
- html5
- javascript
- llama-3.3-70b
- openweathermap-api
- python
- scikit-learn
- sqlite
- tensorflow
- web-speech-api
- whitenoise
Log in or sign up for Devpost to join the conversation.