How prithiga06/sugarcane-crop-detection works
Sugarcane AI Guard is a mobile-first web system for sugarcane leaf diagnosis and farmer guidance. Farmers submit a photo through the web UI; the API validates it, classifies the condition (with a demo fallback), estimates visible severity, and returns recommendations. The UI also supports localized content, scan history, feedback, and agronomist review. Model training and evaluation are a separate supporting lifecycle. Edges reflect README statements and SOURCE INDEX references; unsampled modules are included where documented, but their internal calls are not inferred.
Main entry points: inference.py Disease Inference · api.js REST Client · main.py FastAPI Routes · uploader.js Photo Uploader
Components 24
Farmer Web UI
- App Controller
frontend/js/app.js - Photo Uploader
frontend/js/components/uploader.js - Diagnosis Results
frontend/js/components/results.js - Guidance Cards
frontend/js/components/recommendations.js - Scan History
frontend/js/components/history.js - Farmer Feedback
frontend/js/components/feedback.js - Agronomist Review
frontend/js/components/admin.js - Language UI
frontend/js/i18n.js - REST Client
frontend/js/api.js
API and Contracts
- FastAPI Routes
backend/app/main.py - API Schemas
backend/app/schemas/api_models.py - Runtime Configuration
backend/app/config.py
Diagnosis and Guidance
- Image Quality Check
backend/app/core/quality.py - Disease Inference
backend/app/ml/inference.py - Severity and Overlay
backend/app/core/severity.py - Agronomic Rules
backend/app/core/recommendations.py - Backend Translations
backend/app/core/translations.py
Model Lifecycle
- MobileNetV2 Model
backend/app/ml/model.py - Model Training
backend/app/ml/train.py - Model Evaluation
backend/app/ml/evaluate.py - Dataset Utilities
backend/app/ml/dataset_utils.py
History and Review
- SQLite Records
backend/app/database.py - Demo Record Seeding
backend/app/seed_data.py
Other components
- Farmer or Agronomist
Connections 24
- Farmer or Agronomist → Photo Uploader: submits photo
README.md - App Controller → Photo Uploader: coordinates
README.md - Photo Uploader → REST Client: sends image
README.md - REST Client → FastAPI Routes: calls REST
README.md - FastAPI Routes → Disease Inference: runs diagnosis
backend/app/main.py - Disease Inference → Image Quality Check: checks quality
backend/app/ml/inference.py - Disease Inference → MobileNetV2 Model: loads classifier
backend/app/ml/inference.py - Disease Inference → Severity and Overlay: estimates severity
backend/app/ml/inference.py - Disease Inference → Agronomic Rules: gets guidance
backend/app/ml/inference.py - FastAPI Routes → SQLite Records: stores and reads
backend/app/main.py - FastAPI Routes → Backend Translations: serves strings
backend/app/main.py - FastAPI Routes → API Schemas: validates responses
backend/app/main.py - Disease Inference → API Schemas: builds response
backend/app/ml/inference.py - FastAPI Routes → Runtime Configuration: uses settings
backend/app/main.py - Disease Inference → Runtime Configuration: reads thresholds
backend/app/ml/inference.py - Diagnosis Results → REST Client: renders response
README.md - Guidance Cards → REST Client: renders guidance
README.md - App Controller → Language UI: coordinates language
README.md - Scan History → REST Client: requests history
README.md - Farmer Feedback → REST Client: submits feedback
README.md - Agronomist Review → REST Client: requests review
README.md - Model Training → MobileNetV2 Model: trains architecture
backend/app/ml/train.py - Model Evaluation → MobileNetV2 Model: evaluates architecture
backend/app/ml/evaluate.py - Demo Record Seeding → SQLite Records: seeds records
backend/app/seed_data.py