How med-el-ghazoui/plantcare-ai works
AgriScan AI is a preliminary plant-disease screening product: an image reaches the API, is validated and classified, and the caller receives a prediction or uncertainty result. Authenticated users may have analysis metadata saved; a separate endpoint returns an annotated image. The repository also contains model training and evaluation, including external field-validation tooling. The README documents the intended mobile flow, but the sampled mobile files are platform shells; field evaluation is supported by the source index and excerpts, not a full inspection of its subsystem.
Main entry points: main.py FastAPI routes · auth.py Account auth · exports.py Annotated export · field.py Field evaluation
Components 23
API and inference
- FastAPI routes
backend/app/main.py - Image validation
backend/app/image_validation.py - Model inference
backend/app/inference.py - Confidence decision
backend/app/decision.py - Annotated export
backend/app/exports.py - Image watermark
backend/app/watermark.py
Accounts and history
- Account auth
backend/app/auth.py - Credential security
backend/app/security.py - Login throttling
backend/app/throttle.py - Analysis history
backend/app/history.py - Database access
backend/app/db.py - User and analysis records
backend/app/models.py
Model development
- Dataset pipeline
ml/agriscan_ml/data.py - CNN architectures
ml/agriscan_ml/models.py - Model training
ml/scripts/train_mobilenet.py - Classification metrics
ml/agriscan_ml/metrics.py - Selective prediction
ml/agriscan_ml/selective.py - Model evaluation
ml/scripts/evaluate.py
Field validation
- Field manifest checks
ml/scripts/validate_field_manifest.py - Field evaluation
ml/agriscan_ml/field.py - External evaluation
ml/scripts/evaluate_external.py
Other components
- Image user
- Mobile shell
mobile/android/app/src/main/kotlin/ma/agriscan/agriscan_mobile/MainActivity.kt
Connections 28
- Image user → FastAPI routes: uploads image
README.md - Image user → Mobile shell: uses client
README.md - Mobile shell → FastAPI routes: sends image
README.md - FastAPI routes → Image validation: decodes image
backend/app/main.py - FastAPI routes → Model inference: runs prediction
backend/app/main.py - FastAPI routes → Confidence decision: applies threshold
backend/app/main.py - FastAPI routes → Account auth: checks credentials
backend/app/main.py - FastAPI routes → Database access: stores analysis
backend/app/main.py - FastAPI routes → Annotated export: registers routes
backend/app/main.py - Annotated export → Image validation: decodes image
backend/app/exports.py - Annotated export → Model inference: runs prediction
backend/app/exports.py - Annotated export → Confidence decision: applies threshold
backend/app/exports.py - Annotated export → Image watermark: composes output
backend/app/exports.py - Account auth → Credential security: verifies credentials
backend/app/auth.py - Account auth → Login throttling: checks login limits
backend/app/auth.py - Account auth → Database access: loads user
backend/app/auth.py - Account auth → User and analysis records: creates user
backend/app/auth.py - Analysis history → User and analysis records: queries analyses
backend/app/history.py - Analysis history → Account auth: requires identity
backend/app/history.py - Model training → Dataset pipeline: loads batches
ml/scripts/train_mobilenet.py - Model training → CNN architectures: builds classifier
ml/scripts/train_mobilenet.py - Model evaluation → Dataset pipeline: loads split
ml/scripts/evaluate.py - Model evaluation → Classification metrics: reports scores
ml/scripts/evaluate.py - External evaluation → Field manifest checks: validates manifest
ml/scripts/evaluate_external.py - External evaluation → Field evaluation: evaluates predictions
ml/scripts/evaluate_external.py - Field manifest checks → Field evaluation: checks protocol
ml/scripts/validate_field_manifest.py - Field evaluation → Classification metrics: computes metrics
ml/agriscan_ml/field.py - Field evaluation → Selective prediction: uses threshold metrics
ml/agriscan_ml/field.py