尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證正在載入完整 README。 以下為已儲存的摘錄。
A Solution for Smart India Hackathon 2025 Empowering Farmers with Intelligent Disease Detection ⚠️ Note: Backend is hosted on Render free tier — first request after inactivity may take ~30-45 seconds to wake up. 📖 Overview SMART-SPRAY-X is an AI-driven initiative for Precision Agriculture, specifically targeted for the Smart India Hackathon 2025. It addresses the critical issue of indiscriminate pesticide use by farmers.檢視完整 README ↗
Empowering Farmers with Intelligent Disease Detection
A Solution for Smart India Hackathon 2026
| Service | URL |
|---|---|
| 🖥️ Frontend (React + Vite) | smartspray-x.vercel.app |
| ⚙️ Backend API (FastAPI) | plant-disease-9v9x.onrender.com |
| 📄 API Docs (Swagger) | plant-disease-9v9x.onrender.com/docs |
| 💚 Health Check | /api/v1/health |
⚠️ Note: Backend is hosted on Render free tier — first request after inactivity may take ~30-45 seconds to wake up.
SMART-SPRAY-X is an AI-driven initiative for Precision Agriculture, developed for the Smart India Hackathon 2026. It addresses the critical issue of indiscriminate pesticide use by farmers.
Unlike traditional methods where pesticides are sprayed uniformly, SMART-SPRAY-X uses intelligent disease detection to determine:
This "Spot-Spray" approach drastically reduces chemical usage, lowers costs for farmers, and protects the environment from toxic residue.
┌─────────────────────────────────────────────────────────────┐
│ User Browser │
│ (Vercel - React + Vite) │
│ https://smartspray-x.vercel.app │
└─────────────────────────┬───────────────────────────────────┘
│ REST API (HTTPS)
▼
┌─────────────────────────────────────────────────────────────┐
│ FastAPI Backend │
│ (Render - Docker Container) │
│ https://plant-disease-9v9x.onrender.com │
│ │
│ ┌─────────────────┐ ┌──────────────┐ ┌────────────────┐ │
│ │ 5-Layer Leaf │ │ MobileNetV2 │ │ Severity Index │ │
│ │ Validator │ │ (38 classes) │ │ HSV Segment. │ │
│ │ HSV + OOD + AR │ │ TF/Keras │ │ + Spot-Spray │ │
│ └─────────────────┘ └──────────────┘ └────────────────┘ │
└─────────────────────────────────────────────────────────────┘
| Feature | Details |
|---|---|
| 🌿 Multi-Class Detection | Identifies 38 different plant diseases across crops (Apple, Corn, Grape, Potato, Tomato, etc.) |
| ⚡ High Accuracy | MobileNetV2 fine-tuned on 87K+ images achieving ~96% validation accuracy |
| 🛑 5-Layer Non-Leaf Rejection | Solid background detection · Aspect ratio analysis · Foliage coverage · OOD confidence threshold · Top-2 margin check |
| 📊 Disease Severity Index | HSV symptom segmentation estimates affected leaf area on a 5-level scale (Very Low → Critical) |
| 💊 Pesticide Recommendations | Spot-spray optimization for each of the 38 disease classes |
| 📈 Interactive UI | Glassmorphism dark emerald React frontend with drag & drop upload |
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, Lucide Icons |
| Backend | FastAPI, Uvicorn, Python 3.10 |
| AI/ML | TensorFlow/Keras (MobileNetV2), NumPy |
| Deployment | Vercel (Frontend), Render + Docker (Backend) |
| Image Processing | PIL, Pure NumPy HSV |
cd "Plant Disease"
conda activate tensorflow
python start_backend.py
# → http://localhost:8000
cd frontend
npm install
npm run dev
# → http://localhost:5173
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/health | Health check + model status |
POST | /api/v1/predict | Upload leaf image → disease prediction + severity analysis |
GET | /api/v1/classes | List all 38 disease classes |
GET | /docs | Swagger API documentation |
POST /api/v1/predict returns a structured severity object alongside the existing prediction fields. Severity estimates how much of the leaf is visibly affected (not how confident the classifier is), derived from the image itself:
{
"is_valid_leaf": true,
"crop": "Apple",
"disease": "Cedar Rust",
"status": "Diseased",
"confidence_percentage": 94.0,
"recommendations": { "...": "..." },
"severity": {
"available": true,
"score": 67,
"label": "Severe",
"level": "severe",
"affected_area_percentage": 67.2,
"affected_regions": 2,
"largest_region_fraction": 0.81,
"confidence": 0.91,
"explanation": "An estimated 67.2% of the leaf area shows visible disease symptoms (necrotic/yellow tissue or pale mildew). Symptoms are spread across 2 separate regions."
}
}
How the score is computed (backend/app/services/severity_service.py):
Healthy classification discounts the measured area (healthy leaves naturally show veins/edges/senescence that color analysis can't fully separate from disease); a Diseased classification reports it directly.Severity scale (configurable via SEVERITY_THRESHOLDS):
| Score | Label | Indicator |
|---|---|---|
| 0 – 20 | Very Low | 🟢 |
| 21 – 40 | Mild | 🟡 |
| 41 – 60 | Moderate | 🟠 |
| 61 – 80 | Severe | 🔴 |
| 81 – 100 | Critical | 🔴 |
Limitations — The CNN is a classifier, not a segmenter; affected area is estimated from color, not measured by the network. Diseases with shape-based or very subtle symptoms (early leaf curl, mosaic mottling) are under-estimated. Color segmentation cannot separate true symptoms from sunburn, dirt, or lighting artifacts. When symptoms cannot be measured the module returns
"available": falserather than fabricating a score.
| Component | Detail |
|---|---|
| Base Model | MobileNetV2 (ImageNet pre-trained, fine-tuned) |
| Input | 128×128 RGB → internal Rescaling(1/127.5, offset=-1) layer |
| Feature Head | GlobalAveragePooling2D → BatchNormalization → Dense layers with Dropout |
| Output | Softmax over 38 classes |
| Optimizer | Adam |
| Model Size | ~13 MB (.keras format) |
To prevent false diagnoses (e.g., rejecting a dog photo on a green background), every uploaded image passes through 5 independent checks before the model is even consulted:
| Check | What it does | Catches |
|---|---|---|
| 1. Solid Background Detection | Color variance in green regions; rejects >70% uniform green with low variance | Green screen photos, artificial scenes |
| 2. Aspect Ratio Analysis | Bounding box of foliage; rejects objects with aspect ratio >6.0 | Elongated non-leaf objects |
| 3. Foliage Coverage | Requires ≥8% green/brown leaf-colored pixels | Documents, sky, water |
| 4. OOD Confidence | Rejects top-1 softmax <40% | Out-of-distribution inputs, non-plant images |
| 5. Top-2 Margin | Rejects when gap between top-1 and top-2 <8% | Ambiguous / confused predictions |
Upload Leaf Image
│
▼
┌─────────────────────────┐
│ 5-Layer Leaf Validator │ ← Rejects non-leaf, adversarial, ambiguous inputs
└─────────────┬───────────┘
│ ✅ Valid
▼
┌─────────────────────────┐
│ MobileNetV2 Classifier │ ← 38-class disease prediction + confidence margin
└─────────────┬───────────┘
│
▼
┌─────────────────────────┐
│ HSV Severity Engine │ ← Estimates affected leaf area → Very Low to Critical
└─────────────┬───────────┘
│
▼
┌─────────────────────────┐
│ Spot-Spray Recommender │ ← Pesticide type + dosage guidance
└─────────────────────────┘
Smart India Hackathon 2026 Participant
Developing innovative solutions for sustainable agriculture.
Made with ❤️ for SIH 2026 · SMART-SPRAY-X © 2026