India loses βΉ50,000+ crore annually to crop diseases. Over 86% of Indian farmers are small or marginal β they lack access to agronomists, can't afford lab testing, and often rely on guesswork until it's too late.
The core failure: Disease identification requires expert knowledge that most farmers simply don't have. By the time symptoms are visible and an expert is consulted, 30β70% of yield is already lost.
- Rural areas have no internet connectivity for cloud-based diagnosis tools
- Existing tools output in English only β inaccessible to most farmers
- Expert consultation costs βΉ500β2000+ per visit β unaffordable at scale
- Lab results take 3β7 days β crops don't wait
FasalAI is an offline-first, Hindi-language crop disease detector that runs entirely on a smartphone with no internet connection.
A farmer takes a photo of a diseased leaf β FasalAI identifies the disease β gives Hindi treatment advice in under 100ms.
| Feature | FasalAI | Other Tools |
|---|---|---|
| Works offline | β Yes | β Requires internet |
| Hindi output | β Full treatment advice | β English only |
| Inference speed | β <100ms on CPU | |
| Model size | β 4MB (INT8) | β 100MB+ |
| Environmental context | β Temp + Humidity aware | β Image only |
| Cost to farmer | β Free | β Subscription / data cost |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FasalAI Model β
β β
β Input Image (224Γ224) β
β β β
β EfficientNet-B0 (Pretrained ImageNet) β
β [Blocks 0-4 frozen | Blocks 5-8 fine-tuned] β
β β β
β CBAM Attention Module β
β ββββββββββββββββββββββββ β
β β Channel Attention β β Weights 1280 feature channels β
β β Spatial Attention β β Weights 7Γ7 spatial regions β
β ββββββββββββββββββββββββ β
β β β β
β Avg Pool Env Branch (Temperature + Humidity) β
β (1280-dim) β Linear(2β32) β ReLU β Dropout β
β β β β
β Concat: [1280 + 32] = 1312-dim β
β β β
β Classifier: Dropout(0.4) β FC(1312β512) β ReLU β β
β Dropout(0.3) β FC(512β38) β
β β β
β Softmax β Top-1 Class + Confidence β
β β β
β hindi_output.py β Hindi Disease Advice β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- EfficientNet-B0: Best accuracy/size tradeoff. Proven on medical imaging. 5.3M parameters vs 25M for ResNet-50.
- CBAM Attention: Forces the model to focus on disease lesions, not background soil/sky. Improves accuracy by ~2-3% on leaf datasets.
- Environmental Branch: Temperature and humidity are strong predictors of certain diseases (e.g., Yellow Rust thrives below 20Β°C with >75% humidity). Even without real sensors, these inputs act as soft contextual priors.
- INT8 Quantization: Reduces model from 15MB β 4MB with <0.5% accuracy drop. Runs on mid-range Android phones.
Since real IoT sensors aren't always available:
- Default: Model uses neutral values (25Β°C, 65% humidity) β equivalent to a standard Indian kharif season day
- Demo mode: User adjusts sliders manually based on current weather
- Production path: Designed to integrate with cheap DHT11 sensors (βΉ50) or weather APIs
- Dataset augmentation: Training env features are randomly sampled per realistic Indian season ranges
PlantVillage Dataset β the gold standard for plant disease classification
| Property | Value |
|---|---|
| Total images | ~54,000 |
| Disease classes | 38 (across 14 crop types) |
| Image format | RGB JPG, 256Γ256 |
| Crops covered | Tomato, Potato, Wheat, Corn, Apple, Grape, Pepper, Cherry, Peach, Orange, Soybean, Strawberry, Blueberry, Raspberry |
| Source | Kaggle: emmarex/plantdisease |
git clone https://github.com/Chandanrohit/crops_disease_detector.git
cd fasalai
pip install -r requirements.txt# Works immediately, no training required
streamlit run demo.py
# Opens http://localhost:8501# 1. Download dataset
# Place PlantVillage in ./data/PlantVillage/
# 2. Train (GPU recommended β or use Google Colab)
python train.py
# 3. Export to ONNX
python export_onnx.py
# 4. Quantize (optional, for production)
python quantize.py
# 5. Run real inference
# Edit demo.py: set USE_MOCK = False
streamlit run demo.pyOpen notebooks/FasalAI_Colab.ipynb in Google Colab for a step-by-step guided notebook with GPU support, live training graphs, and automatic Drive checkpointing.
python inference.py --image leaf.jpg --temperature 22 --humidity 78fasalai/
βββ notebooks/
β βββ FasalAI_Colab.ipynb β Full Colab training notebook
βββ checkpoints/
β βββ crop_disease_model.onnx β FP32 inference model
