FastAPI served model: EigenGradCAM explainability for the Swin 101spp classifier
- Langage dominant
- Python
- Étoiles
- 2
- Forks
- 2
- Merge moyen
- 5 j 6 h
- PR mergées (30 j)
- 5
Description
## Context
This issue adds a FastAPI endpoint serving EigenGradCAM explainability for the Swin
101spp classifier, following the existing service pattern in `environments/fastapi/`.
It is the server-side counterpart to the browser CAM already shipped in nachet-mini.
## Tasks
### Service scaffold
- [ ] Scaffold `environments/fastapi/classifier/swin-101spp-/` from the 27spp template
- [ ] Switch to `SwinForImageClassification` (101spp is v1, not v2)
- [ ] Document weight provisioning (`*.safetensors` is gitignored)
- [ ] Allocate a host port (28100 taken)
### CAM
- [ ] Add `grad-cam` + `ttach` deps
- [ ] Port `reshape_transform` + `HFLogits` from the notebook
- [ ] EigenGradCAM on `swin.layernorm`
- [ ] Keep the CAM call outside `torch.no_grad()`
### API
- [ ] `POST /v2/models//infer` → predictions + per-class CAM
- [ ] Pick response format: raw 12×12 grid vs overlay PNG
- [ ] Top-K parameter
- [ ] Health endpoints (`/v2/health/ready`, `/v2/health/live`)
### Container
- [ ] Dockerfile + `compose.yaml` with GPU reservation and healthcheck
- [ ] CPU fallback for dev machines
### Validation
- [ ] Per-map cosine similarity vs notebook output
- [ ] Latency + VRAM (backward pass ~doubles memory)
- [ ] Thread-safety of CAM hooks under concurrent requests
### Docs
- [ ] Service README + `curl` example
## Open questions
1. Server would render EigenGradCAM, browser renders exact linear-head CAM — same
seed, different heatmaps across surfaces. Intended, or should they match?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.