AI-powered onion batch inspection: photograph a batch, and get automatic per-onion detection, a Grade 1 / Grade 2 / URS rating, a ₹/quintal price estimate, and an auditable PDF report — powered by a custom-trained YOLO model.
flowchart LR
FE["frontend/ (PWA)"] --> API["FastAPI backend"]
FL["flutter_app/"] --> API
API --> YOLO["YOLO inference"]
YOLO --> GRADE["Grading & pricing rules"]
GRADE --> STORE["SQLite history + PDF report"]
frontend/— web app / PWA, no build step.flutter_app/— Flutter app (Android, iOS, desktop, web).backend/— FastAPI server. Always runs the newest trained checkpoint (onion-grading-v*.pt), applies grading + pricing as plain, editable Python rules (not a second AI model), and stores every inspection with a downloadable PDF report.
- Single-photo or multi-photo batch inspection
- Per-onion detection with color-coded annotations — healthy / damaged / rotten / sprouted / undersized
- Grading thresholds and pricing are configurable from the Settings screen, no retraining needed
- Low-confidence detections are flagged for manual review
- Inspection history, analytics dashboard, and PDF reports per inspection
| Annotated detection | Inspection result | PDF report |
|---|---|---|
![]() |
![]() |
![]() |
- Sprouted detection is trained on very few real examples — treat it as low-confidence in practice.
- Rotten detection is based on surface-spot annotations, not whole-onion judgments.
- No cross-photo duplicate detection in batch mode yet.


