Case study · Individual Software Project, Charles University
Multi-Stage Image Retrieval
Search 5,000 MS-COCO photos by text, uploaded image or URL, on a laptop CPU, with a saliency map explaining each result.
- Role
- Solo project: design, code, evaluation
- Period
- Aug — Sep 2026
- Context
- NPRG045, supervised coursework
- Stack
- CLIP · DINOv2 · ChromaDB · FastAPI · React
01 — Problem
One search box, three kinds of query, on a laptop CPU.
A user may describe a photo in words, upload a similar photo, or paste a link to one. The system searches 5,000 MS-COCO photos for all three on an ordinary laptop CPU, and shows why each result matched.
02 — What I built
A two-stage pipeline: approximate search first, exact scoring second.
01 Query
Text, uploaded image or URL
02 Encode
CLIP ViT-B/32 for text, DINOv2 ViT-B/14 for images
03 Candidates
ChromaDB HNSW index finds candidates
04 Re-score
Exact similarity on the shortlist
05 Explain
Ranked results with a saliency map
FastAPI backend with 335 tests, a React front end, and a static in-browser demo anyone can open without installing anything.
03 — Results
Caption retrieval within a point of published CLIP; image queries ahead of it.
- Recall@1
- 30.4%
- Recall@10
- 65.9%
- MRR
- 0.421
| Method | Bar | Precision at 10 |
|---|---|---|
| This pipeline (DINOv2) | 80.9% | |
| CLIP only | 72.2% | |
| Random control | 3.9% |
The switch from CLIP to DINOv2 for image queries was decided by a rule written down before the comparison was run, not chosen after seeing the numbers.
04 — Decisions
- Two encoders, one rule
- CLIP for text, DINOv2 for image queries, with the switch fixed by a pre-registered rule.
- Approximate, then exact
- HNSW finds candidates fast; an exact re-scoring stage fixes the order of the shortlist.
- Explain every result
- Each match comes with a saliency map, so a user can see what in the photo drove the score.
- Make it easy to check
- 335 backend tests and a static demo that runs in the browser with nothing to install.