A visual search, design fingerprinting, and similarity matching system built for footwear manufacturing and design verification teams.
┌─────────────────┐ ┌─────────────────────────┐ ┌─────────────────────────┐
│ Upload Image │─────▶│ Embedding Engine │─────▶│ Vector Store (FAISS) │
│ (Query / Admin) │ │ (Meta DINOv2 / CLIP) │ │ (IndexFlatIP Cosine) │
└─────────────────┘ └─────────────────────────┘ └────────────┬────────────┘
│
┌───────────▼────────────┐
│ Top-3 Ranked Matcher │
│ (Cosine Sim + Aggreg) │
└───────────┬────────────┘
│
┌───────────▼────────────┐
│ FastAPI & Web Studio │
│ (Side-by-Side Ratings) │
└────────────────────────┘
-
Embedding Model: Meta DINOv2 (
facebook/dinov2-small) extracting 384-dimensional$L_2$ -normalized vectors with ~100ms CPU latency. DINOv2 was chosen for its fine-grained representation of silhouette curves, upper stitching, sole patterns, and textures without requiring training from scratch. -
Vector Index: FAISS
IndexFlatIP(Exact Inner Product on normalized vectors$\equiv$ exact cosine similarity). -
Incremental Growth: Adding a new design uses
index.add()in$O(1)$ time without requiring a full catalog rebuild. - Metadata & Audit Store: SQLite database in WAL mode tracking catalog designs, multi-angle reference photos, and query audit history.
-
No Hard Auto-Reject Cutoff: Returns the Top 3 Ranked Matches (Best, Second-Best, Third-Best) with accuracy percentages and visual color coding:
- 🟢 High Match (
$\ge 85%$ ): Strong visual match to catalog design. - 🟡 Moderate Match (
$70% - 84.9%$ ): Likely design variant, family silhouette, or colorway. - 🔴 Low Similarity / Novel (
$< 70%$ ): Distinct or novel shoe design.
- 🟢 High Match (
Leave-One-Out (LOO) cross-validation on catalog reference photos:
| Metric | Result | Benchmark Target |
|---|---|---|
| Top-1 Accuracy | 97.92% | |
| Top-3 Accuracy | 100.00% | |
| Mean Reciprocal Rank (MRR) | 0.9896 | |
| Avg Query Latency | < 100 ms | |
| Avg Same-Design Cosine Similarity | 96.9% | High match zone |
| Avg Cross-Design Cosine Similarity | 67.4% | Low similarity zone |
| Separation Margin | +29.5% | Robust decision gap |
Shoe_Design_Detection/
├── dataset/ # Initial raw shoe photos
├── backend/
│ ├── config.py # System paths, model parameters, thresholds
│ ├── database.py # SQLite catalog, reference images, and query logs
│ ├── engine.py # DINOv2 feature extractor with singleton lifecycle
│ ├── vector_store.py # FAISS IndexFlatIP wrapper with atomic persistence
│ ├── matcher.py # Top-3 ranking, score computation, and multi-angle aggregation
│ ├── ingestion.py # Automatic dataset scanner and incremental indexer
│ └── main.py # FastAPI application with REST endpoints and static serving
├── frontend/
│ ├── index.html # Web Studio interface
│ ├── styles.css # Responsive vanilla CSS design system
│ └── app.js # Drag-and-drop upload, match renderer, and catalog manager
├── storage/ # SQLite DB, serialized FAISS index, and image assets
├── evaluate.py # Evaluation benchmark script
├── run_server.py # Server launcher
├── Dockerfile # Production container spec
└── docker-compose.yml # Docker compose deployment
pip install -r requirements.txtpython -m backend.ingestionpython evaluate.pypython run_server.pyOpen your browser at http://localhost:8000.
- Endpoint:
POST /api/match - Payload:
multipart/form-datawithfile: <binary image>,top_k: 3 - Response:
{
"success": true,
"query_image_path": "/uploads/query_1718000000_shoe.jpg",
"total_catalog_designs": 23,
"total_catalog_vectors": 48,
"latency_ms": 88.5,
"matches": [
{
"rank": 1,
"design_id": "SHOE-001",
"design_name": "AeroStride Pro Runner",
"category": "Sneaker",
"confidence_pct": 98.4,
"cosine_similarity": 0.984,
"match_level": "HIGH",
"match_level_label": "High Confidence Match",
"match_color": "green",
"best_matching_angle": "side",
"best_matching_image_url": "/catalog_images/SHOE-001/angle_side_1.jpg",
"all_angles": [...]
},
...
]
}- Endpoint:
POST /api/designs - Payload:
multipart/form-datadesign_id: "SHOE-024"name: "Urban Glide High-Top"category: "Sneaker"description: "Rubber cupsole with mesh upper"created_by: "Design Team"files: Multiple image files
- Endpoint:
GET /api/designs
- Endpoint:
GET /api/logs?limit=50
- Endpoint:
POST /api/evaluate
docker-compose up --buildAccess the application at http://localhost:8000.