How anish-75/ndvi-anomaly-api works
This prototype accepts 12-week NDVI windows through a FastAPI service, validates them, and flags anomalies when autoencoder reconstruction error exceeds a configured threshold. It also supports online retraining and a separate offline workflow for generating synthetic series, training the autoencoder, and calibrating the threshold. The graph reflects the documented offline stages, but the referenced data files and model weights are not present in the supplied tree; their runtime details are therefore not expanded.
Main entry points: main.py API routes · inference.py Inference operations · models Model artifacts · evaluate_threshold.py Threshold evaluation
Components 11
API service
- API routes
app/main.py - Request schemas
app/schemas.py
Inference and training
- Inference operations
app/inference.py - NDVI autoencoder
app/model.py - Online retraining
app/inference.py
Offline model workflow
- Synthetic NDVI generator
training/simulate_ndvi.py - Offline trainer
training/train_autoencoder.py - Threshold evaluation
training/evaluate_threshold.py
Model artifacts
- Model artifacts
models - Threshold configuration
models/threshold.json
Other components
- API client
Connections 14
- API client → API routes: sends requests
- API routes → Request schemas: validates with
- API routes → Inference operations: loads at startup
- API routes → Inference operations: computes error
- API routes → Inference operations: retrain request
- Inference operations → NDVI autoencoder: runs model
- Inference operations → Model artifacts: loads and saves weights
- Inference operations → Threshold configuration: reads and writes
- API routes → Online retraining: dispatches retraining
- Online retraining → NDVI autoencoder: updates weights
- Synthetic NDVI generator → Offline trainer: generates training data for
- Offline trainer → Model artifacts: saves weights
- Threshold evaluation → Model artifacts: loads weights
- Threshold evaluation → Threshold configuration: writes threshold