How shiv2077/retina works
RETINA is an industrial image-inspection service. An operator or production line submits an image, optionally declaring its product; the API stores it and queues work, and the worker routes it through product identification when needed, PatchCore scoring, and conditional VLM refinement. Results and uncertain cases are surfaced for operator labeling, whose examples can inform later refinements. The README documents these stages; sampled worker and API excerpts support the orchestration and persistence links. Other research model implementations in the tree are not shown as part of this documented production workflow.
Main entry points: worker.py Job orchestrator · api.ts API client · main.py Submission and label API · page.tsx Submit image
Components 18
Operator interface
- Submit image
frontend/src/app/submit/page.tsx - View results
frontend/src/app/results/page.tsx - Label samples
frontend/src/app/label/page.tsx - Model performance
frontend/src/app/model-performance/page.tsx - API client
frontend/src/lib/api.ts
Submission and feedback API
- Submission and label API
api/main.py - Content-addressed images
api/main.py
Inference pipeline
- Job orchestrator
worker/src/retina_worker/worker.py - Product identification
worker/src/retina_worker/models/vlm_router.py - PatchCore registry
worker/src/retina_worker/models/patchcore_registry.py - PatchCore scoring
worker/src/retina_worker/worker.py - Stage 2 refiner
worker/src/retina_worker/models/vlm_router.py - Defect description
worker/src/retina_worker/models/vlm_router.py - Zero-shot fallback
worker/src/retina_worker/models/vlm_router.py
Job and label state
- Redis streams and hashes
- Redis access
worker/src/retina_worker/redis_client.py
Other components
- Operator / line
- OpenAI models
Connections 24
- Operator / line → Submit image: submits image
- Operator / line → View results: checks result
- Operator / line → Label samples: labels sample
- Submit image → API client: sends submission
- View results → API client: polls result
- Label samples → API client: fetches / submits labels
- Model performance → API client: requests metrics
- API client → Submission and label API: calls endpoints
- Submission and label API → Content-addressed images: writes / serves bytes
- Submission and label API → Redis streams and hashes: queues jobs; reads and writes state
- Job orchestrator → Redis access: consumes jobs; persists outcomes
- Redis access → Redis streams and hashes: reads / writes
- Job orchestrator → Content-addressed images: loads image bytes
- Job orchestrator → Product identification: identifies when class absent
- Job orchestrator → PatchCore registry: loads category model
- PatchCore registry → PatchCore scoring: provides model
- Job orchestrator → PatchCore scoring: scores image
- Job orchestrator → Stage 2 refiner: refines score-band cases
- Job orchestrator → Defect description: describes confirmed anomalies
- Job orchestrator → Zero-shot fallback: handles missing checkpoint
- Product identification → OpenAI models: calls model
- Stage 2 refiner → OpenAI models: calls model
- Defect description → OpenAI models: calls model
- Zero-shot fallback → OpenAI models: calls model