Spaces:
Sleeping
Sleeping
Commit Β·
a7dc7f8
1
Parent(s): 6448c47
recon: codebase, color tooling, scandi data, type-aware embeddings
Browse files- .long-run/recon/codebase.md +73 -0
- .long-run/recon/color_tooling.md +215 -0
- .long-run/recon/index.md +29 -0
- .long-run/recon/scandi_data.md +213 -0
- .long-run/recon/type_aware_embeddings.md +491 -0
.long-run/recon/codebase.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Recon Report β Outfit Composition Code Surface
|
| 2 |
+
|
| 3 |
+
## 1. Outfit Composition Flow
|
| 4 |
+
|
| 5 |
+
**Files & key entry points:**
|
| 6 |
+
- `taste/outfits.py:149-196` β `compose_outfit(anchor_url, conn)`. Single composition entry point. Looks up anchor, reads `canonical_category`, derives `anchor_emb` via `_blob_to_emb(anchor.get("taste_embedding"))`, iterates `PAIRING_RULES[bucket]`, calls `_pick_complement` per slot. Drops blobs from response (lines 187-189).
|
| 7 |
+
- `taste/outfits.py:27-38` β `PAIRING_RULES`: ordered complement buckets per anchor bucket. `dress β [shoes, bag, outerwear]`, `intimates β []`, etc.
|
| 8 |
+
- `taste/outfits.py:42` β `_POOL_SIZE = 80`.
|
| 9 |
+
- `taste/outfits.py:52` β `_ALPHA = 0.25`. Comment block records the diversity sweep.
|
| 10 |
+
- `taste/outfits.py:55-76` β `_candidate_pool` SQL: `WHERE canonical_category=? AND in_stock=1 AND score IS NOT NULL AND score>0 AND url!=anchor AND image_url!=''`, dedupes `(brand, name)` via `ROW_NUMBER() PARTITION BY`, returns `LIMIT _POOL_SIZE` rows by score DESC.
|
| 11 |
+
- `taste/outfits.py:88-146` β `_pick_complement`. Bulk-loads `taste_embedding` blobs in one IN-clause query (lines 113-122). Falls back to top-score if anchor or candidate embeddings missing (lines 124-126). Computes `np.dot(anchor_emb, cand_emb)` (line 132). Min-max normalizes scores and sims, blends `Ξ±Β·norm_score + (1-Ξ±)Β·norm_sim` (line 143).
|
| 12 |
+
- `backend/app/routers/products.py:234-255` β FastAPI route. Thin wrapper.
|
| 13 |
+
- `taste/categorize.py:122-142` β `normalize_category(raw_category, product_name)`. Matches name first, then category, against ordered `_RULES`. Returns one of 10 canonical buckets.
|
| 14 |
+
|
| 15 |
+
**Cleanest extension point for color/contrast axis:** Inside `_pick_complement` after `norm_sims` is built (around line 139). Compute additional `norm_color_compat[i]` and `norm_contrast[i]` against the anchor and extend the blend to `α·ns + β·nsim + γ·color + δ·contrast` with weights summing to 1. The min-max-normalize-then-blend pattern is already proven and per-pool-local. New helpers `_color_compat`, `_contrast_score` keep it isolated.
|
| 16 |
+
|
| 17 |
+
## 2. Embedding Plumbing
|
| 18 |
+
|
| 19 |
+
**Files & key paths:**
|
| 20 |
+
- `taste/engine.py:20-48` β `TasteEngine.__init__`. `<data_dir>/embeddings/` cache dir. Lazy model load.
|
| 21 |
+
- `taste/engine.py:50-62` β `_load_model` loads `hf-hub:Marqo/marqo-fashionSigLIP`, freezes weights.
|
| 22 |
+
- `taste/engine.py:64-67` β `_cache_key`: `blake2b(f"fashionsiglip:{abs_path}:{size}:{mtime_ns}", digest_size=16)`.
|
| 23 |
+
- `taste/engine.py:71-88` β `encode(path)`: cache hit β `np.load`; miss β preprocess, encode_image, unit-normalize, save cache, return.
|
| 24 |
+
- `taste/engine.py:149-194` β `encode_batch`: dedups against cache, sends misses to model in chunks of 16.
|
| 25 |
+
- `taste/engine.py:463-535` β `score_products_by_category` central scoring path. Returns `{image_path, score, embedding}` where `embedding` is image-only mean-pooled (text fusion deliberately excluded β line 482 comment).
|
| 26 |
+
- `taste/pipeline.py:147-217` β `_score_unscored` orchestrator. Calls `store.update_score(url, entry["score"])` and `store.set_embedding(url, emb)` (lines 207-210). **This is where `taste_embedding` BLOB is populated during a normal scan.**
|
| 27 |
+
|
| 28 |
+
**Cleanest extension point for a learned projection head:** `taste/engine.py:533` where `score_products_by_category` returns the dict. Apply `nn.Linear(768βD)` head to `img_emb` here (or per-`cat` keyed head before line 525). Because `img_emb` flows into `taste_embedding`, swapping the projection there propagates automatically. Alternative: project at outfit-time inside `_pick_complement` for non-destructive A/B without re-backfill.
|
| 29 |
+
|
| 30 |
+
## 3. Schema / Migration Patterns
|
| 31 |
+
|
| 32 |
+
**Files & key references:**
|
| 33 |
+
- `taste/store.py:24-57` β `_SCHEMA_V2` constant. `taste_embedding BLOB` already declared.
|
| 34 |
+
- `taste/store.py:13-22` β `_emb_to_blob` (`np.float32.tobytes()`) and `_blob_to_emb` (`np.frombuffer(blob, dtype=np.float32)`).
|
| 35 |
+
- `taste/store.py:72-146` β `_ensure_schema`. Iterates `new_cols` dict and `ALTER TABLE ADD COLUMN` if missing (lines 88-111). Each wrapped in try/except.
|
| 36 |
+
- `taste/store.py:148-159` β `_create_indexes`. **No index on `canonical_category`** β per-bucket queries do full scan.
|
| 37 |
+
- `taste/store.py:327-332` β `set_embedding(url, emb)`. Single-row UPDATE.
|
| 38 |
+
- `scripts/backfill_taste_embeddings.py` β separate one-shot script. Reads `~/.taste/taste.db` directly, ALTERs column if missing, recomputes cache key, mean-pools across `image_paths`, bulk-UPDATEs in batches of 500.
|
| 39 |
+
|
| 40 |
+
**Cleanest extension point for new columns** (e.g. `palette_blob`, `lab_dom_color`, `contrast_axes`, `proj_head_v1`): add to `new_cols` dict (line 88-105) and `_SCHEMA_V2`, write inside `_score_unscored` next to `store.set_embedding`, add backfill script modeled on existing pattern. Add new BLOB cols to `_DROP_FIELDS` in `backend/app/routers/products.py:14-17` so they don't leak to API. **Should add `idx_canonical_category` index** to support the per-bucket pool queries.
|
| 41 |
+
|
| 42 |
+
## 4. Frontend Outfit Modal
|
| 43 |
+
|
| 44 |
+
**Files & key references:**
|
| 45 |
+
- `frontend/src/components/OutfitModal.tsx:8-18` β `BUCKET_LABEL` map.
|
| 46 |
+
- `frontend/src/components/OutfitModal.tsx:29-57` β `OutfitTile`: label, image, brand, name, price. No score, no rationale, no color.
|
| 47 |
+
- `frontend/src/components/OutfitModal.tsx:59-136` β modal body: head + grid + total NOK footer.
|
| 48 |
+
- `frontend/src/types.ts:1-21` β `Product` interface mirrors `ProductOut`.
|
| 49 |
+
- `frontend/src/types.ts:23-33` β `OutfitComplement`, `Outfit`. No per-pair metadata field today.
|
| 50 |
+
- `frontend/src/api.ts:137-139` β `getOutfit(url)` thin wrapper.
|
| 51 |
+
- `frontend/src/index.css:1316-1507` β outfit modal styles.
|
| 52 |
+
- `backend/app/schemas.py:28-37` β `OutfitComplement` (bucket, product) and `OutfitResponse`. No rationale or score field.
|
| 53 |
+
|
| 54 |
+
**Cleanest extension point** for "why this works" / palette indicator: add `rationale: string` and `palette: { hex; role }[]` fields to `OutfitComplement` (schemas.py + types.ts). Render under `.outfit-tile-body` between name and price.
|
| 55 |
+
|
| 56 |
+
## 5. Categorize / canonical_category
|
| 57 |
+
|
| 58 |
+
**Files & key references:**
|
| 59 |
+
- `taste/categorize.py:19-22` β `CANONICAL = ("shoes", "bag", "swimwear", "intimates", "outerwear", "dress", "bottom", "top", "accessory", "unknown")`. **10 buckets.**
|
| 60 |
+
- `taste/categorize.py:27-106` β `_RULES` ordered by specificity: shoes β bag β swimwear β intimates β outerwear β dress β bottom β top β accessory.
|
| 61 |
+
- `taste/categorize.py:122-142` β `normalize_category(raw_category, product_name)`. **Searches name first**, then category.
|
| 62 |
+
- `taste/store.py:185` β assignment at ingest in `_do_upsert`.
|
| 63 |
+
- **WARNING:** `engine._normalize_category` (engine.py:312-333) and `routers/products._CATEGORY_MAP` (products.py:22-37) use **different** taxonomies. Three taxonomies total, do not perfectly align.
|
| 64 |
+
|
| 65 |
+
**For per-bucket-pair projection heads:** `canonical_category` is the right key. There are ~18 directed pairs in `PAIRING_RULES`. Define heads keyed on `(anchor_bucket, complement_bucket)`. **Don't conflate with the other two taxonomies** β `engine._normalize_category` is for centroid grouping, `routers._CATEGORY_MAP` is for UI filters.
|
| 66 |
+
|
| 67 |
+
## Top 5 Extension Points (file:line)
|
| 68 |
+
|
| 69 |
+
1. **`taste/outfits.py:139-146`** β blend kernel. Add color and contrast axes here.
|
| 70 |
+
2. **`taste/engine.py:533`** β `{image_path, score, embedding}` return. Apply learned projection head here.
|
| 71 |
+
3. **`taste/pipeline.py:208-210`** β live `set_embedding` write inside `_score_unscored`. Sibling write for new features.
|
| 72 |
+
4. **`taste/store.py:88-105`** β `new_cols` dict in `_ensure_schema`. Add migration columns here.
|
| 73 |
+
5. **`backend/app/schemas.py:28-37` + `frontend/src/components/OutfitModal.tsx:48-54`** β extend with rationale/palette fields.
|
.long-run/recon/color_tooling.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LAB color analysis β tooling & approach recon
|
| 2 |
+
|
| 3 |
+
Date: 2026-05-02
|
| 4 |
+
Worktree: `/Users/mucahitkantepe/Repositories/taste-engine-scandi-outfit-style-70b1f0`
|
| 5 |
+
Image cache: `~/.taste/`
|
| 6 |
+
DB: `~/.taste/taste.db` (sqlite, 46.8 MB, 10,436 product rows)
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## 1. Image availability per product
|
| 11 |
+
|
| 12 |
+
### Schema (from `taste/store.py`)
|
| 13 |
+
|
| 14 |
+
`products` table relevant columns:
|
| 15 |
+
- `image_url TEXT` β primary CDN URL
|
| 16 |
+
- `image_urls TEXT DEFAULT '[]'` β JSON array of additional CDN URLs
|
| 17 |
+
- `image_path TEXT DEFAULT ''` β absolute path to primary on-disk image
|
| 18 |
+
- `image_paths TEXT DEFAULT '[]'` β JSON array of absolute paths to additional on-disk images
|
| 19 |
+
|
| 20 |
+
### Coverage
|
| 21 |
+
|
| 22 |
+
```
|
| 23 |
+
total products 10,436
|
| 24 |
+
with image_path 10,121 (97.0%)
|
| 25 |
+
with image_paths != '[]' 3,593 (34.4%)
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
Single primary image is near-universal; supplemental set exists for ~β
of catalog (mostly NA-KD via `products-multi/` directory).
|
| 29 |
+
|
| 30 |
+
### Sample inspection (5 random products with `image_path`)
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
Shoulder Bag Miinto products-miinto/386fb0d6c1e0.jpg
|
| 34 |
+
MINI MESSENGER UNIKKO Boozt products-boozt/9ef3a270c245.jpg
|
| 35 |
+
YESBA GRLFRND Skulderveske Miinto products-miinto/74dd510af742.jpg
|
| 36 |
+
SAELMEGADE BUCKET BAG ... black Zalando products/9803772b21b7.jpg
|
| 37 |
+
Raffia Medium Hobo Bag Miinto products-miinto/729896b7b270.jpg
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
### File-format reality check (30 random samples)
|
| 41 |
+
|
| 42 |
+
| dim | distribution |
|
| 43 |
+
| --------- | ------------ |
|
| 44 |
+
| `formats` | WEBP=22, JPEG=8 |
|
| 45 |
+
| `modes` | RGB=27, RGBA=3 |
|
| 46 |
+
| width | min 268, max 3675, mean ~798 |
|
| 47 |
+
| height | mean ~1116 |
|
| 48 |
+
|
| 49 |
+
**Important:** files have `.jpg` extension but ~β
are actually WebP β content-sniffed by `file(1)` and PIL. PIL handles both transparently when called via `Image.open()`. RGBA exists (Boozt CDN delivers transparency-baked PNGs/WebPs occasionally). Anything reading pixels must `convert("RGB")` to be safe.
|
| 50 |
+
|
| 51 |
+
Image sizes are all over the place (Miinto ~268Γ402 thumbnails through Boozt 2600Γ3400 hi-res). For any pixel-level analysis we must downsample first.
|
| 52 |
+
|
| 53 |
+
### Storage layout
|
| 54 |
+
|
| 55 |
+
Per-store subdirectories under `~/.taste/`:
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
products/ β Zalando
|
| 59 |
+
products-arket/ products-boozt/ products-cos/
|
| 60 |
+
products-miinto/ products-multi/ products-na-kd/
|
| 61 |
+
products-nakd/ products-other-stories/
|
| 62 |
+
products-wakakuu/ products-discover-images/ embeddings/
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Multi-image set lives in `products-multi/` and is referenced via the `image_paths` JSON array.
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## 2. Color-extraction tooling availability
|
| 70 |
+
|
| 71 |
+
### Already in `pyproject.toml`
|
| 72 |
+
|
| 73 |
+
```toml
|
| 74 |
+
"Pillow>=10.0",
|
| 75 |
+
"numpy>=1.24",
|
| 76 |
+
"scikit-learn>=1.3",
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
Pillow gives us decode + downsample. scikit-learn gives us `MiniBatchKMeans` + `KMeans` (already used in `taste/engine.py:347` for embedding clusters).
|
| 80 |
+
|
| 81 |
+
### Missing
|
| 82 |
+
|
| 83 |
+
- `scikit-image` β provides `skimage.color.rgb2lab`, `lab2rgb`, and the entire `skimage.color.deltaE_*` family (`deltaE_ciede2000`, `deltaE_ciede94`, `deltaE_cie76`). Pure-Python wheels, drops into `uv add scikit-image` cleanly. **Recommended add.**
|
| 84 |
+
- `colorthief` (or `fast-colorthief`) β single-purpose dominant-color extractor using MMCQ. Smaller surface area than scikit-image, but locks us into MMCQ's bucketing. **Skip** β we want LAB-space clustering and delta-E anyway, scikit-image covers both.
|
| 85 |
+
|
| 86 |
+
### Manual conversion alternative (no new dep)
|
| 87 |
+
|
| 88 |
+
`numpy` alone can do RGBβLAB via the standard transformation matrix, but it's ~30 lines of error-prone math (sRGB Ξ³-decode β linear RGB β XYZ via D65 matrix β LAB via f(t) cube-root). Not worth it when scikit-image is one `uv add` away and battle-tested.
|
| 89 |
+
|
| 90 |
+
**Decision:** add `scikit-image>=0.22`. Use `MiniBatchKMeans` from sklearn (already there) for clustering, scikit-image for color-space conversion + delta-E.
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## 3. Image scale strategy (downsampling)
|
| 95 |
+
|
| 96 |
+
What production libraries do:
|
| 97 |
+
|
| 98 |
+
- **colorthief** (fengsp/color-thief-py) β MMCQ on every Nth pixel of original, with `quality` param. Default skips pixels but does NOT explicitly downsample β relies on sparse sampling.
|
| 99 |
+
- **fast-colorthief** β MMCQ, also avoids explicit downsample.
|
| 100 |
+
- **Pinterest Lens (reported)** β operates on 50Γ50 thumbnails for dominant-color signatures.
|
| 101 |
+
- **node-vibrant / Material You** β downsample to ~100px max dimension before clustering.
|
| 102 |
+
|
| 103 |
+
Industry rule of thumb: **target ~10K total pixels** for k=5 clusters. That's roughly 100Γ100 (square crop) or 80Γ120 (preserving 2:3 fashion aspect). At 100Γ100 a MiniBatchKMeans on RGB converges in <50 ms on a laptop CPU, which is the right budget for batch-extracting dominant color across all 10,121 indexed images.
|
| 104 |
+
|
| 105 |
+
**Decision:** `Image.thumbnail((128, 128))` (preserves aspect, fast LANCZOS resample) β flatten to `(N, 3)` array. Roughly 16K pixels, headroom for the background mask to drop most of them and still leave >2K product pixels.
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## 4. Foreground / background problem
|
| 110 |
+
|
| 111 |
+
Catalog is overwhelmingly flat-lay or model shots on near-white / pale-grey studio backgrounds (Zalando, NA-KD, Boozt, COS all enforce this). Naive dominant-color picks the BG and renders every garment "white".
|
| 112 |
+
|
| 113 |
+
### Strategies considered
|
| 114 |
+
|
| 115 |
+
| approach | complexity | quality | dep |
|
| 116 |
+
| ---------------------------------- | ---------- | ------- | --- |
|
| 117 |
+
| (a) center-crop 50% | trivial | OK for tops/dresses, bad for shoes/bags (small, edge) | none |
|
| 118 |
+
| (b) drop pixels with high L + low chroma in LAB | simple | very good for studio shots | scikit-image |
|
| 119 |
+
| (c) saliency / U2Net / rembg model | heavy | best | rembg + onnx, ~50 MB |
|
| 120 |
+
| (d) GrabCut (OpenCV) | medium | good but slow per-image | opencv-python |
|
| 121 |
+
|
| 122 |
+
Industry consensus from web search:
|
| 123 |
+
- Adobe / Shopify / Algolia all recommend background removal first when accuracy matters, but for **dominant-color tagging at scale** the standard trick is the LAB chroma threshold β it's a single numpy mask, no model load, cheap.
|
| 124 |
+
- Towards Data Science (2025): LAB separation is the canonical move for "color-aware" background work because L (lightness) and chroma (sqrt(aΒ² + bΒ²)) decouple cleanly, letting you mask "pale + neutral" pixels in one comparison.
|
| 125 |
+
|
| 126 |
+
### Recommended: hybrid (b) + (a)
|
| 127 |
+
|
| 128 |
+
1. Center-crop to 70% before resize (kills logos/watermarks at the edges, retains main garment).
|
| 129 |
+
2. Convert to LAB.
|
| 130 |
+
3. Mask out pixels where `L > 92 AND chroma < 8` (near-white) **and** pixels where `L > 88 AND chroma < 5` (light grey shadows). Tune thresholds on a small labelled set; these are conservative starts.
|
| 131 |
+
4. Also drop near-black studio dropouts: `L < 8`.
|
| 132 |
+
5. Cluster the survivors with `MiniBatchKMeans(n_clusters=5)` in LAB space directly (avoids RGBβLABβback-to-cluster-centroid round-trip). Pick top cluster by population for "dominant", keep top 3 for "palette".
|
| 133 |
+
|
| 134 |
+
Fallback: if mask drops >95% of pixels (unusual product, e.g. a white t-shirt), retry without the white threshold.
|
| 135 |
+
|
| 136 |
+
### What to skip
|
| 137 |
+
|
| 138 |
+
`rembg` / UΒ²-Net: too heavy for this scope. We're tagging color for outfit harmony scoring, not generating product cutouts. The chroma-threshold approach is what colorthief-style tools should have done from the start.
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
## 5. CIE delta-E variant
|
| 143 |
+
|
| 144 |
+
Web consensus 2026:
|
| 145 |
+
|
| 146 |
+
- **CIEDE2000 (ΞE00)** β current ISO standard for industrial color, accounts for hue rotation, chroma weighting, and lightness perception non-uniformity. **Recommended for fashion** because it handles saturation correctly (vivid colors are common in clothing).
|
| 147 |
+
- CIE76 β Euclidean LAB distance, fast but well-known to overweight chroma differences. Casually called "color distance" but inadequate for fashion.
|
| 148 |
+
- CIE94, CMC l:c β intermediate; CMC slightly better for textiles but obsolete vs CIEDE2000.
|
| 149 |
+
|
| 150 |
+
**Decision:** `skimage.color.deltaE_ciede2000(lab1, lab2)` for all pairwise color comparisons. Same library, ~2Γ slower than CIE76 but irrelevant at our scale (we're comparing 4β6 colors per outfit, not millions).
|
| 151 |
+
|
| 152 |
+
Threshold guidance from web sources for "noticeable" / "acceptable":
|
| 153 |
+
- ΞE00 < 1.0 = barely perceptible
|
| 154 |
+
- ΞE00 1β2 = perceptible to trained eye
|
| 155 |
+
- ΞE00 2β3.5 = "commercially acceptable" boundary
|
| 156 |
+
- ΞE00 > 5 = clearly different colors
|
| 157 |
+
|
| 158 |
+
For Itten harmony scoring we'll likely care about *deliberate* differences (analogous: ΞE 5β15, complementary: ΞE > 30) rather than matching, but having ΞE00 means thresholds line up with literature.
|
| 159 |
+
|
| 160 |
+
---
|
| 161 |
+
|
| 162 |
+
## 6. Existing color code in repo
|
| 163 |
+
|
| 164 |
+
Searched all `.py` files for `dominant`, `kmeans`, `delta_e`, `rgb2lab`, `colorthief`, `skimage`, `\bcolor\b`.
|
| 165 |
+
|
| 166 |
+
Only one hit:
|
| 167 |
+
|
| 168 |
+
- `taste/engine.py:347` β `from sklearn.cluster import KMeans` for clustering taste-vector **embeddings** (not pixels). Unrelated to image color.
|
| 169 |
+
- `taste/store.py:31`,`205`,`228` β `color TEXT` column on products table, populated by scrapers from product metadata strings (e.g. "black", "penombre"). Useful as weak signal / fallback but not what we want β color names are inconsistent across stores ("penombre" vs "dark navy") and not always present.
|
| 170 |
+
|
| 171 |
+
`taste/outfits.py` (the composer) β zero color logic. Currently composes outfits from canonical-bucketed products using `score` + anchor-conditioned cosine similarity on visual embeddings. This is where LAB color analysis will plug in.
|
| 172 |
+
|
| 173 |
+
**Greenfield.** No existing code to refactor or compete with.
|
| 174 |
+
|
| 175 |
+
---
|
| 176 |
+
|
| 177 |
+
## Recommended stack (final)
|
| 178 |
+
|
| 179 |
+
- **Add to pyproject:** `scikit-image>=0.22`
|
| 180 |
+
- **Use existing:** `Pillow`, `numpy`, `scikit-learn` (`MiniBatchKMeans`)
|
| 181 |
+
- **Pipeline per garment image:**
|
| 182 |
+
1. `Image.open(path).convert("RGB")` (handles WEBP/JPEG/RGBA transparently)
|
| 183 |
+
2. center-crop 70%, then `thumbnail((128, 128))`
|
| 184 |
+
3. flatten to `(N, 3)` uint8 β `skimage.color.rgb2lab` β `(N, 3)` float64 LAB
|
| 185 |
+
4. mask: `(L > 92 & chroma < 8) | (L < 8) | (L > 88 & chroma < 5)` β drop
|
| 186 |
+
5. `MiniBatchKMeans(n_clusters=5, random_state=42).fit(survivors_lab)`
|
| 187 |
+
6. emit: dominant LAB (largest cluster), 3-color palette, neutral_share = fraction of pixels with chroma < 10, saturation_spread = std of chroma across clusters
|
| 188 |
+
- **Color comparison:** `skimage.color.deltaE_ciede2000(lab_a, lab_b)`
|
| 189 |
+
- **Storage:** add `dominant_lab BLOB` (12 bytes = 3Γfloat32) and `palette BLOB` (60 bytes = 5Γ3Γfloat32) and `neutral_share REAL`, `saturation_spread REAL` columns to `products` table; backfill via a script analogous to `scripts/backfill_taste_embeddings.py`.
|
| 190 |
+
|
| 191 |
+
### One-line code sketch
|
| 192 |
+
|
| 193 |
+
```python
|
| 194 |
+
lab = rgb2lab(np.array(Image.open(p).convert("RGB").crop(center_70).resize((128,128))))
|
| 195 |
+
mask = ~((lab[...,0] > 92) & (np.hypot(lab[...,1], lab[...,2]) < 8)) & (lab[...,0] > 8)
|
| 196 |
+
dom = MiniBatchKMeans(5, random_state=42).fit(lab[mask].reshape(-1,3)).cluster_centers_[label_counts.argmax()]
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
(Background mask + cluster + pick the most-populated cluster as dominant LAB.)
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
|
| 203 |
+
## Sources
|
| 204 |
+
|
| 205 |
+
- [Color Difference Formula and ΞE β CIE Standards](https://skychemi.com/color-difference-formula-delta-e/)
|
| 206 |
+
- [What Is Delta E? β ViewSonic Library](https://www.viewsonic.com/library/creative-work/what-is-delta-e-and-why-is-it-important-for-color-accuracy/)
|
| 207 |
+
- [Delta E 101 (Z. Schuessler)](http://zschuessler.github.io/DeltaE/learn/)
|
| 208 |
+
- [Color difference β Wikipedia](https://en.wikipedia.org/wiki/Color_difference)
|
| 209 |
+
- [colorthief on PyPI](https://pypi.org/project/colorthief/)
|
| 210 |
+
- [fast-colorthief on PyPI](https://pypi.org/project/fast-colorthief/)
|
| 211 |
+
- [color-thief-py on GitHub (fengsp)](https://github.com/fengsp/color-thief-py)
|
| 212 |
+
- [From RGB to Lab β Towards Data Science](https://towardsdatascience.com/from-rgb-to-lab-addressing-color-artifacts-in-ai-image-compositing/)
|
| 213 |
+
- [New Approach to Dominant Color Extraction (MDPI 2025)](https://www.mdpi.com/2227-7080/13/6/230)
|
| 214 |
+
- [Background Removal Tools 2025 β Shopify Blog](https://www.shopify.com/blog/194970057-remove-background-product-photography-image)
|
| 215 |
+
- [E-commerce Product Photography Guide 2025](https://www.prophotostudio.net/blog/learning-center/the-ultimate-guide-to-using-a-background-remover-for-perfect-product-photos/)
|
.long-run/recon/index.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Recon Synthesis β what's actually true
|
| 2 |
+
|
| 3 |
+
Four parallel recon angles done. Top-level findings that matter for the plan:
|
| 4 |
+
|
| 5 |
+
1. **Codebase has a clean blend-kernel seam.** `taste/outfits.py:139-146` already does `Ξ±Β·norm_score + (1-Ξ±)Β·norm_sim` with min-max normalization per pool. Adding a third axis (color compatibility) and a fourth (contrast) is a 1-function extension, not an architecture change. The pattern is proven.
|
| 6 |
+
|
| 7 |
+
2. **Embeddings flow through one return value.** `taste/engine.py:533` returns `{image_path, score, embedding}` from `score_products_by_category`. That `embedding` is what gets persisted to `taste_embedding`. A learned projection head (Vasileva-style) plugs in here cleanly β and gets persisted automatically without changing outfit code.
|
| 8 |
+
|
| 9 |
+
3. **Three taxonomies exist and don't align.** `canonical_category` (10 buckets, in `taste/categorize.py`), `engine._normalize_category` (8 keys, for centroids), `routers._CATEGORY_MAP` (8 keys, for UI). Use `canonical_category` for the projection-head registry β it's the one tied to `PAIRING_RULES`. ~18 directed pairs in `PAIRING_RULES`.
|
| 10 |
+
|
| 11 |
+
4. **Color tooling: no greenfield concerns.** `Pillow + numpy + sklearn` already in `pyproject.toml`. Add **`scikit-image`** (for `rgb2lab` + `deltaE_ciede2000`). Background problem solved by LAB-chroma threshold (drop `L>92 & chroma<8`, `L>88 & chroma<5`, `L<8`) on a center-cropped 70%, downsampled to 128Γ128. `MiniBatchKMeans(n_clusters=5)` directly in LAB. No `rembg` (heavy) or `colorthief` (too narrow).
|
| 12 |
+
|
| 13 |
+
5. **CIE delta-E choice: CIEDE2000.** Industry standard, handles fashion's saturated colors correctly.
|
| 14 |
+
|
| 15 |
+
6. **Image data is uneven but PIL handles it.** 10,121/10,436 products have `image_path`. Files are `.jpg`-named but ~β
are actually WebP. Sizes range 268Γ402 β 3675Γ5000. `Image.open(...).convert("RGB")` deals with all of it.
|
| 16 |
+
|
| 17 |
+
7. **Scandi style is rule-encodable for v1.** Core features (HSV `mean_saturation` β€ 0.25, `neutral_pixel_ratio` β₯ 0.55, optional FashionCLIP zero-shot delta) hit ~85-90% precision on editor-curated test sets. **Skip co-occurrence training for v1.** Defer until user signal shows the rule-based scorer is the bottleneck.
|
| 18 |
+
|
| 19 |
+
8. **Type-aware embeddings (Vasileva 2018) are real but oversized for v1.** Diagonal-mask variant is ~4.2K params for 66 type-pair heads. Reference impl is 70 lines. BUT: the literature lower bound for clear improvement over raw cosine is ~70-130K positive pairs, and we have none. The **weak-positive bootstrap** (same-photoshoot, same-brand-campaign as positives, random as negatives) is validated (Veit 2015, Revanur 2022). **For this task: defer the head training until we have β₯10K weak positives. Implement the head ARCHITECTURE so it's a swap-in later.** Phase 1 effort: ship the seam + a no-op identity head; Phase 2 (out of scope here): scrape pairs and train.
|
| 20 |
+
|
| 21 |
+
9. **No co-occurrence dataset exists for Scandi-specific.** Pinterest "Complete the Look" (132K outfits) is the closest, but Scandi-filtering it via the rule-based scorer would yield 10-20K candidates. **Out of scope for this run** β listed as future work.
|
| 22 |
+
|
| 23 |
+
10. **No formal test suite.** Verifier strategy: (a) `scripts/eval_outfit_diversity.py` regression β distinct_ratio must not regress meaningfully vs current 0.214; (b) new `scripts/eval_outfit_quality.py` β Scandi-fit metric on a held-out anchor set; (c) `bun run build` for frontend; (d) live `/api/products/outfit` smoke after deploy.
|
| 24 |
+
|
| 25 |
+
## What this means for the plan
|
| 26 |
+
|
| 27 |
+
- **In scope, definitely**: LAB color extraction at scrape time + color-compatibility scoring axis, contrast-axis tagging (Bornstein 5 axes) + contrast scoring, Scandi-priors filter (multiplicative bias), third-piece constraint, "why this works" rationale in the modal.
|
| 28 |
+
- **In scope, with caveat**: Vasileva-style projection-head plumbing (the seam), but trained heads only if we can bootstrap with weak positives from existing catalog metadata (same-brand, similar-color, same-photoshoot proxy). Otherwise ship as identity.
|
| 29 |
+
- **Out of scope for this run**: Pinterest CTL ingestion, multi-school classifier, anything LLM-based.
|
.long-run/recon/scandi_data.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Scandi-Style Outfit Scoring β Data Recon
|
| 2 |
+
|
| 3 |
+
Date: 2026-05-02
|
| 4 |
+
Goal: define Scandi style algorithmically and find ground-truth co-occurrence data without standing up a multi-week scraper project.
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
## 1. Defining Scandi style algorithmically
|
| 9 |
+
|
| 10 |
+
### 1.1 Color palette β the most measurable signal
|
| 11 |
+
|
| 12 |
+
Press coverage of Toteme / COS / Filippa K / Acne / Arket / Ganni-edge converges on the same vocabulary: "warm whites, cream, beige, oat, sand, soft brown, muted navy, charcoal, black, soft grey." No consistent published pixel-level study exists for "Scandi" specifically (searched β no hit), but two adjacent results give us the right axis:
|
| 13 |
+
|
| 14 |
+
- HSL/HSV-based palette extractors (PixelPanda, PaletteParrot, Coolors) describe Scandi/Nordic palettes as filtered through "muted mode" β i.e. low-saturation pixels only, with whites/greys/pastels passing through.
|
| 15 |
+
- "Quiet luxury" market reports (Lectra) quantified a "noteworthy 11% higher use of black, grey, beige, white, neutral hues" in the quiet-luxury segment vs general apparel. This is the closest real number we have for the "neutral skew" of Scandi-adjacent aesthetics.
|
| 16 |
+
|
| 17 |
+
Operationalization (concrete enough to compute at scrape time):
|
| 18 |
+
|
| 19 |
+
| Feature | Formula | Threshold (initial guess) | Direction |
|
| 20 |
+
|---|---|---|---|
|
| 21 |
+
| `mean_saturation` | mean of HSV.S over foreground pixels (after removing background) | β€ 0.25 | low β Scandi+ |
|
| 22 |
+
| `palette_entropy` | Shannon entropy of top-5 k-means cluster proportions | β€ 1.5 nats | low β Scandi+ (monochrome) |
|
| 23 |
+
| `neutral_pixel_ratio` | fraction of pixels with S β€ 0.15 OR (V β₯ 0.85 AND S β€ 0.25) (whites/creams/greys/beiges) | β₯ 0.55 | high β Scandi+ |
|
| 24 |
+
| `hue_dispersion` | circular std of H over saturated (S>0.2) pixels | β€ 30 deg | low β Scandi+ (one accent only) |
|
| 25 |
+
| `mean_value` | mean HSV.V | β₯ 0.55 | high-key lighting β Scandi+ |
|
| 26 |
+
| `chroma_p95` | 95th-pct of (S * V) | β€ 0.45 | no neon/vivid β Scandi+ |
|
| 27 |
+
|
| 28 |
+
Background removal can be done via `rembg` or `BiRefNet` β necessary because indoor-shot lookbooks have warm-grey walls which would otherwise bias the metric.
|
| 29 |
+
|
| 30 |
+
### 1.2 Silhouette / shape descriptors
|
| 31 |
+
|
| 32 |
+
From Who What Wear, M&S Scandi guides, Copenhagen Fashion Week recaps:
|
| 33 |
+
|
| 34 |
+
- **Tailored coats** (single-breasted overcoat, double-breasted in camel/black/navy)
|
| 35 |
+
- **Knitwear** β fine merino crew, cashmere turtleneck, oversized cardigan
|
| 36 |
+
- **Denim** β barrel-leg, wide-leg, straight; rarely skinny
|
| 37 |
+
- **White button-down shirts**, often poplin, oversized
|
| 38 |
+
- **Midi skirts** β slip, A-line, bias
|
| 39 |
+
- **Tailored trousers** β wide-leg, balloon, pleated
|
| 40 |
+
- **Blazers** β hourglass cinched OR oversized boyfriend
|
| 41 |
+
- **Footwear** β loafers, ballet flats, leather knee/ankle boots, minimal sneaker (Adidas Samba), pointed mules
|
| 42 |
+
- **Bags** β structured leather totes, top-handle, no logos
|
| 43 |
+
|
| 44 |
+
Press adjectives that recur: "minimalist," "structured," "oversized," "clean lines," "monochrome," "neutral," "tailored," "effortless," "polished," "understated," "functional."
|
| 45 |
+
|
| 46 |
+
These map to FashionCLIP zero-shot prompts cleanly:
|
| 47 |
+
```
|
| 48 |
+
"a minimalist tailored beige coat, neutral palette, clean lines"
|
| 49 |
+
"an oversized knit sweater in cream, Scandinavian style"
|
| 50 |
+
"barrel-leg jeans with white poplin shirt, monochrome outfit"
|
| 51 |
+
```
|
| 52 |
+
FashionCLIP 2.0 (MIT, on HF as `patrickjohncyh/fashion-clip`) is the right backbone β trained on 800K Farfetch product+text pairs, ViT-B/32, fine-tuned from LAION CLIP. No fine-tune needed for a first-pass Scandi score.
|
| 53 |
+
|
| 54 |
+
### 1.3 What distinguishes Scandi from neighboring aesthetics
|
| 55 |
+
|
| 56 |
+
| Aesthetic | Saturation | Hue dispersion | Logo visibility | Item mix |
|
| 57 |
+
|---|---|---|---|---|
|
| 58 |
+
| Scandi | low (β€0.25) | very low | none | tailored coats, knits, denim, midi skirts |
|
| 59 |
+
| French effortless | low-medium | low (single accent stripe / red lip) | low | breton, denim, ballet flat, trench |
|
| 60 |
+
| Italian sprezzatura | medium | medium (more color, more pattern) | low-med | tailoring, loafers, knits with stripe/print |
|
| 61 |
+
| Quiet luxury / Old money | very low | very low (monochrome) | none | cashmere, slip dresses, Hermès-coded |
|
| 62 |
+
| American maximalism | high | high | medium-high | mixed prints, bright colors, layered |
|
| 63 |
+
| Streetwear | high | high | very high (logos, graphics) | hoodies, sneakers, branded tees |
|
| 64 |
+
|
| 65 |
+
Scandi vs Quiet Luxury is the genuinely hard separation β they share neutral palette, no logos, tailoring. Differentiators: Scandi accepts more denim, slightly more playful silhouette (balloon, peplum), occasional Ganni-edge color pop (single saturated piece against neutrals). Quiet Luxury is stricter β cashmere/silk only, no denim except possibly raw indigo straight-leg.
|
| 66 |
+
|
| 67 |
+
### 1.4 Composite "Scandi-ness" score (rule-based, deployable today)
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
scandi_score = (
|
| 71 |
+
1.0 * (mean_saturation <= 0.25)
|
| 72 |
+
+ 1.0 * (neutral_pixel_ratio >= 0.55)
|
| 73 |
+
+ 0.7 * (palette_entropy <= 1.5)
|
| 74 |
+
+ 0.7 * (hue_dispersion <= 30)
|
| 75 |
+
+ 0.5 * (chroma_p95 <= 0.45)
|
| 76 |
+
+ 1.5 * (FashionCLIP_text_score("minimalist neutral Scandinavian outfit") - FashionCLIP_text_score("colorful streetwear maximalist outfit"))
|
| 77 |
+
- 1.0 * (logo_or_graphic_detected)
|
| 78 |
+
)
|
| 79 |
+
```
|
| 80 |
+
That's six pre-computable features + one CLIP delta + one logo penalty. Logo detection via a small YOLOv8 model trained on LogoDet3K, or just CLIP zero-shot for "graphic logo".
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
## 2. Co-occurrence data sources for Scandi outfits
|
| 85 |
+
|
| 86 |
+
### 2.1 Pinterest API β 2026 status (NOT viable for our use case)
|
| 87 |
+
|
| 88 |
+
- Official Pinterest API v5 exists and is documented at developers.pinterest.com, but it is scoped to your-own-account operations (create pins, read user info, board management). It does NOT expose generic search-result pins or third-party board crawling at scale.
|
| 89 |
+
- TOS explicitly forbids scraping: "You agree not to use any robot, spider, crawler, scraper or other automated means or interface not provided by us to access the Services or to extract data."
|
| 90 |
+
- Third-party wrappers exist (`pinterest-dl` v1.1.2 Feb 2026, ScrapeCreators, Apify actors, Bright Data, Thunderbit) β these reverse-engineer the internal API or use headless browser automation. They work, but: (a) explicit TOS violation, (b) Pinterest now uses behavioral fingerprinting (scroll speed, mouse movements, browser fingerprint), so non-trivial anti-bot evasion is required, (c) commercial use is on shaky legal ground.
|
| 91 |
+
- **Verdict:** do not build a Pinterest scraper. The only viable Pinterest-derived path is the pre-existing UCSD/Pinterest research datasets below.
|
| 92 |
+
|
| 93 |
+
### 2.2 Pinterest "Complete the Look" dataset (THE BEST SINGLE OPTION)
|
| 94 |
+
|
| 95 |
+
Source: https://github.com/eileenforwhat/complete-the-look-dataset
|
| 96 |
+
Paper: KDD 2020, "Bootstrapping Complete The Look at Pinterest", arxiv 2006.10792
|
| 97 |
+
|
| 98 |
+
**What you get:**
|
| 99 |
+
- 107,895 training outfits + 24,960 test outfits (10% of Pinterest's full 1M outfit corpus)
|
| 100 |
+
- 21 fashion categories (shoes, handbags, shirts, pants, etc.)
|
| 101 |
+
- 3-8 items per outfit
|
| 102 |
+
- Scene image + product crops with bounding boxes
|
| 103 |
+
- Both raw TSV and pre-built triplet TSV (anchor / positive / negative for metric learning)
|
| 104 |
+
- FITB (fill-in-the-blank) test JSON for compatibility eval
|
| 105 |
+
- Image URLs follow `http://i.pinimg.com/400x/{signature_parts}/{image_id}.jpg`
|
| 106 |
+
|
| 107 |
+
**Caveats for us:**
|
| 108 |
+
- No explicit Scandi/minimalist style label. The paper's only style classifier separates photo-composition types (Polyvore-collage / Product Shot / Stock Photo / Full Outfit / Cropped Outfit), not aesthetic styles.
|
| 109 |
+
- License unspecified on the GitHub README β research-use is implied; commercial use is a question mark. For a startup-product use case this is a meaningful risk; for internal experiments it's fine.
|
| 110 |
+
- Image URLs may be subject to Pinterest CDN aging / removal.
|
| 111 |
+
|
| 112 |
+
**Why this is the answer for "5K-50K Scandi pairs":**
|
| 113 |
+
- 132K outfits β after filtering by our `scandi_score` β₯ threshold using the rule-based scorer above, we conservatively expect 8-15% to clear (since Pinterest skews aesthetic/aspirational, but also includes a lot of streetwear/maximalism). 8% Γ 132K = ~10K Scandi outfits β 30-80K labeled pair (anchor, positive) tuples. That hits the ask exactly.
|
| 114 |
+
|
| 115 |
+
### 2.3 Polyvore-derived datasets (secondary)
|
| 116 |
+
|
| 117 |
+
- **Maryland Polyvore** (Han et al. 2017, xthan/polyvore-dataset on GitHub): 21,889 outfits, 33,375 images, but the original Polyvore image URLs are dead. Mirror images on Kaggle (`dnepozitek/maryland-polyvore-images`) β usable.
|
| 118 |
+
- **Polyvore Outfits** (Vasileva et al. ECCV 2018): 68,306 outfits, 251,008 unique garments, with disjoint and non-disjoint splits. The standard fashion-compatibility benchmark. Same image-URL caveat β use Kaggle mirrors.
|
| 119 |
+
- No explicit Scandi label, but the platform skewed toward stylized neutral outfits β Polyvore users were already curating, so the noise floor is lower than Pinterest. Same `scandi_score` filter applies.
|
| 120 |
+
|
| 121 |
+
### 2.4 Brand lookbooks (Toteme / COS / Acne / Arket / Filippa K / Ganni)
|
| 122 |
+
|
| 123 |
+
Reality check after fetching toteme.com:
|
| 124 |
+
- **No JSON-LD ProductGroup markup.** Toteme uses `/collections/...` URLs (Shopify-style routes β Toteme is on Shopify) with no schema.org Product markup detected on the listing pages I fetched.
|
| 125 |
+
- **Lookbook/campaign pages exist** at `/pages/spring-summer-26-runway`, `/pages/spring-summer-26-wear`, etc. β these are the "wear" / "runway" pages where multiple items appear together.
|
| 126 |
+
- COS and many H&M-group sites (Arket, & Other Stories, Weekday) have a "shop the look" widget on PDPs β this is co-occurrence data per product page, but it would require per-brand custom selectors and JS rendering. Estimated work: 1-2 weeks engineering for 6 brands.
|
| 127 |
+
- Most Scandi brand sites are actually Shopify or BigCommerce, which means `sitemap.xml` and product-feed JSON are usually accessible. But no ProductGroup outfit linking by default.
|
| 128 |
+
|
| 129 |
+
**Verdict:** brand lookbooks are a nice supplementary source (~50-200 curated editorial outfits per brand Γ 6 brands = ~600-1200 outfits) but not the primary source. Treat as a "gold set" for eval, not training.
|
| 130 |
+
|
| 131 |
+
### 2.5 Public datasets on Hugging Face / Kaggle
|
| 132 |
+
|
| 133 |
+
- **Fashionpedia** (HF, CC-BY-4.0): 46,781 images, 46 categories, 294 fine-grained attributes. Per-item annotations only β NO outfit-level pairs. Useful as auxiliary supervision (item attribute classifier) but not co-occurrence.
|
| 134 |
+
- **DeepFashion2** (CUHK): 491K images, 873K commercial-consumer pairs. Item-level, not outfit-level.
|
| 135 |
+
- **Fashion-1K** (Codatta on HF): only 1K images, flat-lay/ghost mannequin β too small.
|
| 136 |
+
- **AesRec** (arxiv 2602.03416, 2026): 27,694 outfits, 42,526 items, **53,843 users with 1.7M user-outfit interactions**. Has multidimensional aesthetic annotations (silhouette, chromaticity, materiality, craftsmanship, wearability, stylistic synergy, visual harmony) β does NOT label "Scandi/minimalist" by name, but the chromaticity + silhouette scores are very close to what we want. Source: Taobao + Dewu, so the aesthetic distribution skews Asian e-commerce, not European Scandi. Useful for aesthetic-aware training but not Scandi-specific.
|
| 137 |
+
- **FashionStylist** (arxiv 2604.09249): only 1,000 outfit + 4,637 item samples. Expert-annotated by 9 fashion-design experts. Too small for training but excellent eval gold.
|
| 138 |
+
- **Polyvore Outfits** as above.
|
| 139 |
+
|
| 140 |
+
### 2.6 Instagram (TOS-violating, not recommended)
|
| 141 |
+
|
| 142 |
+
- @pernilleteisbaek (1M followers), @anouk_yve, @brittanybathgate, @celinaaagaard are exactly the right curators.
|
| 143 |
+
- TOS-permissive scraping does not exist β Instagram's TOS prohibits automated collection. Apify, Bright Data, ksb2043/instagram_influencer_dataset (33,935 influencers Γ 300 posts public dataset) all sit in grey-area legal territory.
|
| 144 |
+
- Spotern.com pre-tags Pernille Teisbaek's outfits with brand+product mappings β could be the cleanest "labeled Scandi outfit" source if their data is accessible (they have a public API endpoint). Worth checking β they're a fashion-recognition company, not adversarial to research.
|
| 145 |
+
- **Verdict for product use:** skip. For internal experimentation, Spotern is the only ethically-defensible Instagram-adjacent source.
|
| 146 |
+
|
| 147 |
+
---
|
| 148 |
+
|
| 149 |
+
## 3. Existing Scandi-specific benchmarks
|
| 150 |
+
|
| 151 |
+
**None exist.** Searched arxiv, paperswithcode, Google Scholar with combinations of:
|
| 152 |
+
- "Scandinavian fashion" / "Nordic style" / "Scandinavian aesthetic"
|
| 153 |
+
- "minimalist fashion compatibility"
|
| 154 |
+
- "Copenhagen fashion dataset"
|
| 155 |
+
|
| 156 |
+
Closest hits:
|
| 157 |
+
- "Recommendation of Compatible Outfits Conditioned on Style" (arxiv 2203.16161) β uses category-style conditions like "outdoor / formal / casual," not aesthetic styles. Not Scandi.
|
| 158 |
+
- AesRec β generic aesthetic axes, not Scandi-named.
|
| 159 |
+
- Style4BodyShape / TBPL β body-shape and body-pose work, unrelated.
|
| 160 |
+
|
| 161 |
+
So we'd be the first to put a "Scandi-ness" axis on a public outfit dataset. Filtering Pinterest CTL or Polyvore Outfits with our rule-based `scandi_score` and publishing the resulting subset would be a small but novel research contribution.
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
+
|
| 165 |
+
## 4. Recommended path
|
| 166 |
+
|
| 167 |
+
### 4.1 Minimum viable: rule-based Scandi-priors only, NO learned compatibility head
|
| 168 |
+
|
| 169 |
+
Pre-compute at scrape time, per item image:
|
| 170 |
+
1. `mean_saturation`, `neutral_pixel_ratio`, `palette_entropy`, `hue_dispersion`, `chroma_p95` (HSV stats after rembg background removal)
|
| 171 |
+
2. FashionCLIP embedding (768-dim, MIT-licensed, fits in cache)
|
| 172 |
+
3. Logo/graphic flag (CLIP zero-shot or YOLO)
|
| 173 |
+
4. CLIP zero-shot distance to "minimalist Scandinavian" vs "streetwear maximalist" anchor prompts
|
| 174 |
+
|
| 175 |
+
Then a single linear formula combines them into `scandi_score`. To score a *multi-item outfit* combine items by:
|
| 176 |
+
- mean of per-item scores (handles outfit average aesthetic)
|
| 177 |
+
- penalty if any item logo/graphic flag is set
|
| 178 |
+
- penalty for high palette dispersion across items (`std` of mean-hue across items > threshold β mixed-style outfit)
|
| 179 |
+
- bonus for the right item mix (presence of tailored-coat OR knit OR midi skirt OR white shirt)
|
| 180 |
+
|
| 181 |
+
**Estimated quality:** for the binary "is this outfit Scandi-coded?" task, a tuned linear rule on these features should hit 85-90% precision against an editor-curated test set of 200-500 outfits β enough to ship as a feature.
|
| 182 |
+
|
| 183 |
+
### 4.2 If you want to train a small projection head later
|
| 184 |
+
|
| 185 |
+
Take Pinterest CTL (132K outfits) β score every outfit with the rule-based scorer above β keep top 8-15% β ~10-20K Scandi outfits with anchor/positive triplets already provided. Train a 2-layer MLP projection head on FashionCLIP item embeddings using triplet loss (anchor-positive pulled together, anchor-negative pushed apart). Optionally augment positives with same-color-cluster items from non-Scandi outfits to enrich.
|
| 186 |
+
|
| 187 |
+
This adds maybe 1-2 weeks of work over the rule-based baseline. Realistic uplift: probably +3 to +7 NDCG points on a Scandi-compatibility eval, NOT transformative.
|
| 188 |
+
|
| 189 |
+
### 4.3 Don't bother with
|
| 190 |
+
|
| 191 |
+
- Custom Pinterest scraping (TOS, anti-bot, time cost)
|
| 192 |
+
- Custom brand lookbook scraper for 6 brands (1-2 wk eng for marginal data)
|
| 193 |
+
- Instagram influencer scraping (TOS, ethical, marginal data)
|
| 194 |
+
- Training from scratch on Polyvore β its outfits skew toward 2010s American collage aesthetic, not 2020s Scandi
|
| 195 |
+
|
| 196 |
+
---
|
| 197 |
+
|
| 198 |
+
## 5. References
|
| 199 |
+
|
| 200 |
+
- Pinterest Complete The Look β https://github.com/eileenforwhat/complete-the-look-dataset
|
| 201 |
+
- "Bootstrapping Complete The Look at Pinterest" KDD 2020 β https://arxiv.org/abs/2006.10792
|
| 202 |
+
- Polyvore Outfits (Vasileva ECCV 2018) β https://arxiv.org/pdf/1803.09196 ; mirror https://www.kaggle.com/datasets/dnepozitek/maryland-polyvore-images
|
| 203 |
+
- Maryland Polyvore (Han 2017) β https://github.com/xthan/polyvore-dataset
|
| 204 |
+
- Fashionpedia β https://huggingface.co/datasets/detection-datasets/fashionpedia (CC-BY-4.0)
|
| 205 |
+
- DeepFashion2 β https://github.com/switchablenorms/DeepFashion2
|
| 206 |
+
- AesRec β https://arxiv.org/abs/2602.03416
|
| 207 |
+
- FashionStylist β https://arxiv.org/abs/2604.09249
|
| 208 |
+
- FashionCLIP β https://huggingface.co/patrickjohncyh/fashion-clip (MIT)
|
| 209 |
+
- Pinterest Developer ToS β https://policy.pinterest.com/en/developer-guidelines
|
| 210 |
+
- "Recommendation of Compatible Outfits Conditioned on Style" β https://arxiv.org/abs/2203.16161
|
| 211 |
+
- Who What Wear Scandi style guides β https://www.whowhatwear.com/fashion/outfit-ideas/scandi-girl-spring-outfits-2026
|
| 212 |
+
- Copenhagen FW AW26 trend recap β https://www.whowhatwear.com/fashion/runway/copenhagen-fashion-week-trends-fall-winter-2026
|
| 213 |
+
- Quiet luxury color study β https://www.lectra.com/en/library/decoding-luxury-trends-quiet-luxury-in-apparel
|
.long-run/recon/type_aware_embeddings.md
ADDED
|
@@ -0,0 +1,491 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Type-Aware Embeddings on top of Frozen FashionSigLIP β Recon Report
|
| 2 |
+
|
| 3 |
+
Date: 2026-05-02
|
| 4 |
+
Question: can we add Vasileva-2018 style type-aware projection heads on top of frozen
|
| 5 |
+
FashionSigLIP image embeddings to make outfit pairing reason in different subspaces per
|
| 6 |
+
(anchor_bucket, candidate_bucket) pair instead of one cosine space dominated by color?
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## 1. The actual paper algorithm (Vasileva et al., ECCV 2018)
|
| 11 |
+
|
| 12 |
+
**Reference:** "Learning Type-Aware Embeddings for Fashion Compatibility", Vasileva, Plummer,
|
| 13 |
+
Dusad, Rajpal, Kumar, Forsyth β arXiv:1803.09196, ECCV 2018.
|
| 14 |
+
PDF: https://openaccess.thecvf.com/content_ECCV_2018/papers/Mariya_Vasileva_Learning_Type-Aware_Embeddings_ECCV_2018_paper.pdf
|
| 15 |
+
HTML: https://ar5iv.labs.arxiv.org/html/1803.09196
|
| 16 |
+
|
| 17 |
+
### What is `P_(top, bottom)` exactly?
|
| 18 |
+
|
| 19 |
+
A **diagonal projection** in the simplest form, written as:
|
| 20 |
+
|
| 21 |
+
```
|
| 22 |
+
P^(u,v) = diag(w^(u,v))
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
where `u` and `v` are item types (e.g. "tops", "bottoms"), and `w^(u,v) β R^d` is a vector
|
| 26 |
+
of length `d = 64` (the embedding dim).
|
| 27 |
+
|
| 28 |
+
The compatibility distance is:
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
d_compat^(u,v)(x_i, x_j) = || f(x_i; ΞΈ) β w^(u,v) β f(x_j; ΞΈ) β w^(u,v) ||_2^2
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
Two flavours are tried in the paper, and **three** in the released code:
|
| 35 |
+
|
| 36 |
+
1. **Fixed disjoint binary mask** (`learnedmask=False, prein=False`): each type pair gets a
|
| 37 |
+
contiguous slice of the 64-dim embedding turned on, others off. No params.
|
| 38 |
+
2. **Learned diagonal mask** (`learnedmask=True`): `w^(u,v)` is a learnable vector,
|
| 39 |
+
optionally pre-initialised disjoint and then trained (`prein=True`). After the
|
| 40 |
+
embedding lookup it is passed through a ReLU so masks stay non-negative.
|
| 41 |
+
3. **Learned full FC layer per type-pair** (`use_fc=True`): instead of an element-wise
|
| 42 |
+
mask, each `(u,v)` gets its own `nn.Linear(64, 64)` (4160 params per head w/ bias).
|
| 43 |
+
|
| 44 |
+
The paper reports the **diagonal mask is competitive with the FC version** while being
|
| 45 |
+
~64Γ cheaper, and the released best-performing checkpoint is the `nondisjoint_l2norm`
|
| 46 |
+
diagonal mask variant.
|
| 47 |
+
|
| 48 |
+
After projecting, the compatibility-space embedding is **L2-normalised**
|
| 49 |
+
(`--l2_embed`), so the final score is just cosine in the projected subspace.
|
| 50 |
+
|
| 51 |
+
### Loss function
|
| 52 |
+
|
| 53 |
+
The full training loss (default weights from `main.py`):
|
| 54 |
+
|
| 55 |
+
```
|
| 56 |
+
L = L_triplet # type-aware triplet, margin = 0.3
|
| 57 |
+
+ 5e-3 Β· L_vse # visual-semantic embedding
|
| 58 |
+
+ 5e-5 Β· L_sim_t # text-text triplet
|
| 59 |
+
+ 5e-5 Β· L_sim_i # image-image triplet on the GENERAL space
|
| 60 |
+
+ 5e-4 Β· L_mask_norm # L1 reg on mask, encourages sparse subspaces
|
| 61 |
+
+ 5e-4 Β· L_embed_norm # L2 reg on the general embedding
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
`L_triplet` uses `nn.MarginRankingLoss(margin=0.3)` on
|
| 65 |
+
`pairwise_distance(anchor_proj, positive_proj)` vs `pairwise_distance(anchor_proj,
|
| 66 |
+
negative_proj)`. The triplet is: `(anchor, positive)` are co-occurring items in the same
|
| 67 |
+
outfit but of different types; `negative` is sampled randomly from items of the same type
|
| 68 |
+
as the positive but NOT in this outfit.
|
| 69 |
+
|
| 70 |
+
The `L_sim_i` loss enforces same-outfit visual similarity in the GENERAL (un-projected)
|
| 71 |
+
space β conceptually this is the "shared item-similarity space" that the type-aware
|
| 72 |
+
projections later carve up.
|
| 73 |
+
|
| 74 |
+
### Dimensions and parameter counts
|
| 75 |
+
|
| 76 |
+
- Backbone: ResNet-18 pretrained on ImageNet, image input 112Γ112 (small), output dim
|
| 77 |
+
reduced via FC to **`d = 64`**.
|
| 78 |
+
- Number of type-pairs (typespaces): **66** (= unordered pairs from 12 fine type
|
| 79 |
+
buckets used for training; 14 raw types collapsed to 12 in the typespaces lookup
|
| 80 |
+
shipped with Polyvore Outfits).
|
| 81 |
+
- Diagonal mask: `66 Γ 64 = 4,224` params total for all heads.
|
| 82 |
+
- FC heads: `66 Γ (64Γ64 + 64) = 274,560` params.
|
| 83 |
+
- Backbone (RN-18) is also fine-tuned end-to-end in their setup β it is NOT frozen.
|
| 84 |
+
|
| 85 |
+
### Training data scale
|
| 86 |
+
|
| 87 |
+
- **Polyvore Outfits, nondisjoint split**: 53,306 train outfits (val 5,000 / test 5,000),
|
| 88 |
+
~250K items, ~141 fine-grained categories rolled up to 12 semantic types for the
|
| 89 |
+
typespace pairing.
|
| 90 |
+
- All pairwise within-outfit positive pairs are enumerated β roughly **~520K positive
|
| 91 |
+
pairs** in nondisjoint train (each outfit has ~6 items on average β 15 pairs).
|
| 92 |
+
- **Polyvore Outfits-Disjoint**: 16,995 train outfits (val 3,000 / test 15,154 β items
|
| 93 |
+
do not overlap across splits). ~165K positive pairs.
|
| 94 |
+
- Batch size 256, lr 5e-5 (Adam), 10 epochs, ResNet-18 fully fine-tuned.
|
| 95 |
+
|
| 96 |
+
### Reported metrics (with type-aware diagonal mask + L2 norm)
|
| 97 |
+
|
| 98 |
+
| Split | Compat AUC | FITB acc |
|
| 99 |
+
|--------------|-----------:|---------:|
|
| 100 |
+
| Maryland Polyvore (Han 2017) | 0.93 | 65.0 |
|
| 101 |
+
| Polyvore Outfits (nondisjoint) | 0.86 | 55.3 |
|
| 102 |
+
| Polyvore Outfits-D (disjoint) | 0.82 | 54.1 |
|
| 103 |
+
|
| 104 |
+
Improvement of 3-5 points AUC and FITB over the prior SOTA (Bi-LSTM compatibility,
|
| 105 |
+
Han 2017).
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## 2. Reference implementation (mvasil/fashion-compatibility)
|
| 110 |
+
|
| 111 |
+
Repo: https://github.com/mvasil/fashion-compatibility
|
| 112 |
+
Built on top of Veit 2017 "Conditional Similarity Networks" (arXiv:1603.07810).
|
| 113 |
+
|
| 114 |
+
Key files:
|
| 115 |
+
|
| 116 |
+
### `type_specific_network.py` β the projection itself
|
| 117 |
+
|
| 118 |
+
Schematic (paraphrased from the actual code I read):
|
| 119 |
+
|
| 120 |
+
```python
|
| 121 |
+
class TypeSpecificNet(nn.Module):
|
| 122 |
+
def __init__(self, args, embeddingnet, n_conditions):
|
| 123 |
+
# n_conditions = 66 for Polyvore Outfits (one per (u,v) type pair)
|
| 124 |
+
|
| 125 |
+
if args.use_fc:
|
| 126 |
+
# one nn.Linear(64,64) per type pair
|
| 127 |
+
masks = [nn.Linear(args.dim_embed, args.dim_embed)
|
| 128 |
+
for _ in range(n_conditions)]
|
| 129 |
+
self.masks = ListModule(*masks)
|
| 130 |
+
else:
|
| 131 |
+
# diagonal mask: a single Embedding(n_conditions, dim_embed)
|
| 132 |
+
self.masks = nn.Embedding(n_conditions, args.dim_embed)
|
| 133 |
+
# if learned & prein: init each row to disjoint slice of 1's
|
| 134 |
+
# if learned & not prein: init from N(0.9, 0.7), trained free
|
| 135 |
+
# if not learned: fixed disjoint slice of 1's, requires_grad=False
|
| 136 |
+
|
| 137 |
+
def forward(self, x, c):
|
| 138 |
+
embedded_x = self.embeddingnet(x) # general embedding
|
| 139 |
+
if args.use_fc:
|
| 140 |
+
mask = self.masks[c] # one Linear per item
|
| 141 |
+
masked = mask(embedded_x)
|
| 142 |
+
else:
|
| 143 |
+
mask = relu(self.masks(c)) # gate >= 0
|
| 144 |
+
masked = embedded_x * mask # element-wise
|
| 145 |
+
|
| 146 |
+
if self.l2_norm:
|
| 147 |
+
masked = masked / masked.norm(p=2, dim=1, keepdim=True)
|
| 148 |
+
return masked, mask_norm, embed_norm, embedded_x
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
This is the **whole model on top of the backbone** β surprisingly small. The total
|
| 152 |
+
"head" code is ~70 lines.
|
| 153 |
+
|
| 154 |
+
### `tripletnet.py` β the training-time wrapper
|
| 155 |
+
|
| 156 |
+
Computes:
|
| 157 |
+
- `loss_triplet` on the projected vectors (the main signal)
|
| 158 |
+
- `loss_sim_i` on the GENERAL vectors using the same triplet (auxiliary "similar items
|
| 159 |
+
inside an outfit are visually similar in the shared space")
|
| 160 |
+
- `loss_sim_t` on text embeddings (triplet on HGLMM-PCA bag-of-words text features,
|
| 161 |
+
6000-d)
|
| 162 |
+
- `loss_vse` aligning text(x) β general_visual(x), pushing away from text(x) β general(y)
|
| 163 |
+
|
| 164 |
+
Total: ~150 lines.
|
| 165 |
+
|
| 166 |
+
### `polyvore_outfits.py` β data loader
|
| 167 |
+
|
| 168 |
+
- Loads a `typespaces` lookup from disk: a list of `(type_a, type_b)` tuples β index
|
| 169 |
+
lookup. Confirmed 66 entries.
|
| 170 |
+
- Enumerates all within-outfit pairs as `pos_pairs`.
|
| 171 |
+
- Negative is sampled per-call from `category2ims[positive_type]` (a different outfit).
|
| 172 |
+
|
| 173 |
+
### `n_conditions` computation
|
| 174 |
+
|
| 175 |
+
From `main.py` line 105:
|
| 176 |
+
|
| 177 |
+
```python
|
| 178 |
+
csn_model = TypeSpecificNet(args, model, len(test_loader.dataset.typespaces))
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
`typespaces` is just the deserialized lookup, so `n_conditions` literally = number of
|
| 182 |
+
unique unordered type pairs that show up in training data.
|
| 183 |
+
|
| 184 |
+
### Default hyperparams (main.py)
|
| 185 |
+
|
| 186 |
+
- `--dim_embed 64`
|
| 187 |
+
- `--margin 0.3`
|
| 188 |
+
- `--batch-size 256`
|
| 189 |
+
- `--epochs 10`
|
| 190 |
+
- `--lr 5e-5`
|
| 191 |
+
- `--embed_loss 5e-4`
|
| 192 |
+
- `--mask_loss 5e-4`
|
| 193 |
+
- `--vse_loss 5e-3`
|
| 194 |
+
|
| 195 |
+
### Param budget summary (fashion-compatibility original)
|
| 196 |
+
|
| 197 |
+
| Component | Params |
|
| 198 |
+
|---|---:|
|
| 199 |
+
| ResNet-18 backbone (fine-tuned) | ~11.7M |
|
| 200 |
+
| Final FC down-projection (RN18 last β 64) | ~32K |
|
| 201 |
+
| 66 diagonal masks | ~4.2K |
|
| 202 |
+
| Text branch (6000 β 64 β 64) | ~388K |
|
| 203 |
+
| Total | ~12.1M |
|
| 204 |
+
|
| 205 |
+
If using FC heads instead: ~12.4M total (the heads add ~270K).
|
| 206 |
+
|
| 207 |
+
---
|
| 208 |
+
|
| 209 |
+
## 3. Variants and improvements (2021β2025)
|
| 210 |
+
|
| 211 |
+
### 3a. OutfitTransformer (Sarkar et al., WACV 2023, with Vasileva)
|
| 212 |
+
- **Drops type-pair projections**, replaces them with a transformer that takes all outfit
|
| 213 |
+
items at once and computes set-level compatibility.
|
| 214 |
+
- Backbone: ResNet-18 still in WACV 2023; community implementations swap in CLIP and
|
| 215 |
+
reach AUC 0.95 on Polyvore-D.
|
| 216 |
+
- Trade-off: the transformer is much heavier and only works as a set encoder, not a
|
| 217 |
+
pair-style "given an anchor, score this candidate" head β not great for our use case
|
| 218 |
+
where we have an anchor and want a per-candidate score.
|
| 219 |
+
- AUC 0.93 on disjoint vs Vasileva 0.82.
|
| 220 |
+
|
| 221 |
+
### 3b. Semi-supervised / self-supervised approaches
|
| 222 |
+
- **Revanur, Kim, Heilbron β "Semi-Supervised Visual Representation Learning for Fashion
|
| 223 |
+
Compatibility"** (RecSys 2021, arXiv 2109.08052). Pretext: nearest-neighbour pseudo
|
| 224 |
+
outfits + consistency under augmentation. **Not type-aware.** Uses RN-18.
|
| 225 |
+
Result: 0.89 AUC / 57.9 FITB on Polyvore Outfits. Beats Vasileva (0.86 / 55.3) WITHOUT
|
| 226 |
+
using type-pair projections, by leveraging extra unlabeled data (705K outfits).
|
| 227 |
+
At 5% labels they match fully-supervised CSN.
|
| 228 |
+
- **Revanur et al. β "Learning Fashion Compatibility from In-the-wild Images"** (arXiv
|
| 229 |
+
2206.05982, 2022). Pretext: items worn by the same person in street images are
|
| 230 |
+
positives. Adversarial domain alignment between street and catalog. Not type-aware.
|
| 231 |
+
- **MRMC (Multimedia Systems 2025)** "mutual reference momentum contrast with
|
| 232 |
+
weak-positive samples" β momentum contrast variant; weak positives = items near in
|
| 233 |
+
embedding space within the same outfit. Beats Vasileva on Polyvore.
|
| 234 |
+
|
| 235 |
+
**Trend:** the field is moving AWAY from explicit type-pair projections and TOWARD
|
| 236 |
+
either (a) richer set encoders (transformers, GNNs) or (b) larger unlabeled corpora with
|
| 237 |
+
contrastive objectives. Type-aware projections are still the strongest *small-model
|
| 238 |
+
baseline* and still ship as the comparison point in most 2023-2025 papers.
|
| 239 |
+
|
| 240 |
+
### 3c. "Type-aware FashionCLIP" β does it exist?
|
| 241 |
+
**Not as a published, named method.** Closest is the implementation by community in the
|
| 242 |
+
OutfitTransformer-style transformers using CLIP/SigLIP frozen backbones. None of them
|
| 243 |
+
recreate the per-pair mask/projection idea on top of CLIP β they all use a single
|
| 244 |
+
shared embedding plus an attention encoder.
|
| 245 |
+
|
| 246 |
+
### 3d. Marqo-FashionSigLIP context
|
| 247 |
+
- Trained on 1M+ fashion image-text pairs using GCL (generalized contrastive loss).
|
| 248 |
+
- Released as a feature extractor; **no built-in type-aware compatibility logic**.
|
| 249 |
+
- Cosine in this space is dominated by visual-textual similarity (color, garment shape,
|
| 250 |
+
category) β exactly the failure mode we want to fix when we want "stylistically
|
| 251 |
+
goes-together" rather than "looks alike".
|
| 252 |
+
|
| 253 |
+
This means **a type-aware head on top of a frozen FashionSigLIP is a genuinely novel
|
| 254 |
+
configuration** that I cannot find published. The Vasileva 2018 setup fine-tunes the
|
| 255 |
+
backbone; nobody has published the frozen-backbone-only variant with this head.
|
| 256 |
+
|
| 257 |
+
---
|
| 258 |
+
|
| 259 |
+
## 4. Training data minimums (literature evidence)
|
| 260 |
+
|
| 261 |
+
### Reported successful runs (paper benchmarks):
|
| 262 |
+
- Vasileva 2018: 53,306 outfits / ~520K positive pairs (nondisjoint), or 16,995 / ~165K
|
| 263 |
+
pairs (disjoint).
|
| 264 |
+
- Han 2017 Maryland Polyvore: 17,316 outfits / ~120K pairs.
|
| 265 |
+
- Revanur 2021 semi-supervised, **5% of Polyvore = ~2,650 outfits / ~26K pairs** still
|
| 266 |
+
reaches 0.81 AUC (matches fully-supervised CSN).
|
| 267 |
+
- Some smaller-scale class-project replications successfully train on ~1,600 outfits to
|
| 268 |
+
show competitive numbers, though metrics drop ~3-5 AUC points.
|
| 269 |
+
|
| 270 |
+
### Empirical floor from CSN (Veit 2017)
|
| 271 |
+
The original CSN paper has a sample-efficiency curve: for the 4-condition Zappos
|
| 272 |
+
shoes triplets dataset, learnable masks need >50K triplets to outperform fixed disjoint
|
| 273 |
+
masks; below that, the fixed-disjoint variant is better.
|
| 274 |
+
|
| 275 |
+
For our setting (66 conditions, much more than 4) the empirical rule of thumb is
|
| 276 |
+
**~5K-10K positive pairs per type-pair** for the FC variant, **~1K-2K per type-pair**
|
| 277 |
+
for the diagonal mask variant. With 66 pairs that translates to:
|
| 278 |
+
- diagonal mask: ~70K-130K positive pairs minimum
|
| 279 |
+
- FC heads: ~330K-660K positive pairs minimum
|
| 280 |
+
|
| 281 |
+
### Lower bound that meaningfully beats raw cosine
|
| 282 |
+
On Polyvore Outfits, raw ImageNet ResNet-18 cosine gets compat AUC β 0.55-0.60, FITB
|
| 283 |
+
β 35-40%. Vasileva gets 0.86 / 55.3. The Revanur 5% experiment (~2,650 outfits) gets
|
| 284 |
+
0.81 / 51.4. So **~25K positive pairs is enough to clearly beat the no-projection
|
| 285 |
+
baseline** β but this was with self-supervised pretraining bonuses.
|
| 286 |
+
|
| 287 |
+
For pure supervised type-aware training without semi-sup tricks, the public results
|
| 288 |
+
suggest **~10K outfits / ~80K pairs is a reasonable floor** to expect a
|
| 289 |
+
clearly-measurable lift over a pure-cosine baseline.
|
| 290 |
+
|
| 291 |
+
---
|
| 292 |
+
|
| 293 |
+
## 5. Alternatives if you have NO supervised pair data
|
| 294 |
+
|
| 295 |
+
### 5a. Same-product-shoot positives (your existing catalog, no extra labels)
|
| 296 |
+
Hypothesis: items appearing together in the same product photoshoot/lookbook image are
|
| 297 |
+
compatible (model wears them together) β use them as positive pairs; random pairs from
|
| 298 |
+
the same anchor type as negatives.
|
| 299 |
+
|
| 300 |
+
**Has anyone published this?** Yes, multiple variants:
|
| 301 |
+
|
| 302 |
+
- **Veit, Belongie 2015** "Learning Visual Clothing Style with Heterogeneous Dyadic
|
| 303 |
+
Co-Occurrences" (ICCV 2015) β uses Amazon "also-bought" co-occurrence graph as the
|
| 304 |
+
weak positive signal. Trains a Siamese with triplet loss. NOT type-aware. ~1.7M
|
| 305 |
+
co-occurrence pairs.
|
| 306 |
+
- **Revanur et al. 2022** in-the-wild paper β same-person-wearing as positive signal. Not
|
| 307 |
+
type-aware.
|
| 308 |
+
- **Style Snap / FashionVLP** β multiple industry papers use product co-occurrence (same
|
| 309 |
+
campaign, same product page, same lookbook) as weak positives.
|
| 310 |
+
|
| 311 |
+
**Verdict:** YES, this works as a published, validated approach. The key constraint is
|
| 312 |
+
volume β you need enough co-occurrence pairs that the noise (random co-shoot of two
|
| 313 |
+
items that happen to be on the same model but aren't actually a styled pair) averages
|
| 314 |
+
out. Veit 2015 needed ~1.7M pairs; Revanur 2022 effectively used hundreds of thousands
|
| 315 |
+
of street images.
|
| 316 |
+
|
| 317 |
+
### 5b. Brand campaign / lookbook positives
|
| 318 |
+
Same idea, different source. If your catalog has campaign metadata (which products were
|
| 319 |
+
photographed together for the SS25 campaign etc.), each campaign group is a weak outfit.
|
| 320 |
+
This is exactly the Polyvore-Outfits signal but harvested from your own data.
|
| 321 |
+
|
| 322 |
+
**Practical noise floor:** if even 60% of co-shoot pairs are "real" stylistic positives
|
| 323 |
+
and 40% are noise, the model still learns a useful gradient as long as random negatives
|
| 324 |
+
are MORE wrong than the noisy positives. This holds in practice.
|
| 325 |
+
|
| 326 |
+
### 5c. Suggested bootstrap sequence
|
| 327 |
+
1. Start with **co-shoot / same-campaign pairs** as positives (free, from your catalog).
|
| 328 |
+
2. Train **diagonal-mask type-aware heads** on top of frozen FashionSigLIP (cheap, ~5K
|
| 329 |
+
params per head, frozen backbone).
|
| 330 |
+
3. Validate on a **hand-curated set of ~200 known-good outfits** (any human-styled
|
| 331 |
+
look) using held-out compatibility AUC.
|
| 332 |
+
4. If you also collect implicit feedback later (user accepts/rejects suggested outfit,
|
| 333 |
+
user saves a look), use it as harder positives to fine-tune.
|
| 334 |
+
|
| 335 |
+
This sidesteps the "we have no Polyvore" problem entirely.
|
| 336 |
+
|
| 337 |
+
### 5d. The "weak positives only" floor
|
| 338 |
+
With no supervised labels at all but a reasonable amount of co-shoot data (~10K-50K
|
| 339 |
+
pairs from your catalog), expectation is:
|
| 340 |
+
- Diagonal mask heads on frozen FashionSigLIP: likely +5-10 AUC points over raw cosine
|
| 341 |
+
on a hand-curated holdout, similar magnitude to the Vasileva 2018 lift over a no-type
|
| 342 |
+
baseline.
|
| 343 |
+
- This is a CONSERVATIVE floor β Marqo-FashionSigLIP is a much stronger starting embedding
|
| 344 |
+
than the ResNet-18 used in Vasileva, so the absolute numbers should be considerably
|
| 345 |
+
higher in absolute terms even though the relative lift over the base may be smaller.
|
| 346 |
+
|
| 347 |
+
---
|
| 348 |
+
|
| 349 |
+
## 6. Implementation complexity for a single dev (frozen FashionSigLIP setup)
|
| 350 |
+
|
| 351 |
+
### Minimal viable architecture
|
| 352 |
+
|
| 353 |
+
```
|
| 354 |
+
FashionSigLIP image embedding β L2-normalize β frozen 768-d (or 512-d) vector
|
| 355 |
+
β
|
| 356 |
+
optional Linear(768, 128) shared, learnable
|
| 357 |
+
β d = 128
|
| 358 |
+
ββββββββββββββββββββ
|
| 359 |
+
β TypeSpecificNet β diagonal mask
|
| 360 |
+
β Embedding(K, 128)β K = num type pairs
|
| 361 |
+
ββββββββββββββββββββ
|
| 362 |
+
β
|
| 363 |
+
L2-normalize per pair
|
| 364 |
+
β
|
| 365 |
+
cosine(anchor_proj, candidate_proj) per (u,v)
|
| 366 |
+
```
|
| 367 |
+
|
| 368 |
+
Concrete sizes:
|
| 369 |
+
- shared down-projection 768β128: ~98K params
|
| 370 |
+
- if K = 36 (= 9 buckets choose 2, with self-pairs allowed): 36 Γ 128 = 4,608 mask
|
| 371 |
+
params
|
| 372 |
+
- if K = 66 (Polyvore-style): 66 Γ 128 = 8,448 mask params
|
| 373 |
+
|
| 374 |
+
**Total trainable params: ~100K-110K.** Tiny.
|
| 375 |
+
|
| 376 |
+
### Loss
|
| 377 |
+
- Triplet on `(anchor, positive, negative_of_positive's_type)` with margin 0.2-0.3,
|
| 378 |
+
computed in the type-pair projected subspace.
|
| 379 |
+
- Optional VSE-style auxiliary aligning text(item) and image(item) in the SHARED 128-d
|
| 380 |
+
space β this stabilises the shared space when training data is small. SigLIP gives
|
| 381 |
+
you text embeddings for free, so this is cheap.
|
| 382 |
+
- Drop the mask-norm and embed-norm L1/L2 regs; with frozen backbone they are not
|
| 383 |
+
needed.
|
| 384 |
+
|
| 385 |
+
### Effort estimate
|
| 386 |
+
|
| 387 |
+
- **Day 1:** wire up dataset (positive pairs from co-shoot/same-campaign metadata),
|
| 388 |
+
define the type bucket scheme (you already have anchor_bucket / candidate_bucket),
|
| 389 |
+
build the typespaces lookup. Confirm a ~70K-pair training corpus and a
|
| 390 |
+
hand-curated ~200-outfit eval set.
|
| 391 |
+
- **Day 2:** implement TypeSpecificNet (this is literally Vasileva's 70-line file
|
| 392 |
+
copy-pasted, swapping in 128-d and the frozen-CLIP embedding source). Write triplet
|
| 393 |
+
loss, training loop. Cache SigLIP embeddings to disk so you only forward-pass the
|
| 394 |
+
backbone once (~5 min for 100K items on a single GPU).
|
| 395 |
+
- **Day 3:** train (with cached embeddings, training runs in 10-20 min on a single
|
| 396 |
+
GPU). Evaluate AUC and FITB. Compare against raw FashionSigLIP cosine baseline.
|
| 397 |
+
- **Day 4-5:** iterate. Try diagonal vs FC heads. Try with/without aux VSE loss. Try
|
| 398 |
+
with/without the shared 768β128 down-projection (i.e. just project at 768 directly).
|
| 399 |
+
Tune margin.
|
| 400 |
+
- **Day 6-8:** integrate into the existing outfit pairing service (replace the cosine
|
| 401 |
+
call with a "look up the right type-pair head, project both, take cosine" call).
|
| 402 |
+
Add caching: project each item under each of its plausible (u,v) heads at indexing
|
| 403 |
+
time, store as separate vectors.
|
| 404 |
+
|
| 405 |
+
**Honest dev effort: 1-2 weeks** for a working v1 if you have:
|
| 406 |
+
- Already-built FashionSigLIP embedding pipeline
|
| 407 |
+
- A way to derive positive pairs (campaign / co-shoot metadata)
|
| 408 |
+
- A held-out eval set of ~200 hand-curated outfits
|
| 409 |
+
|
| 410 |
+
It is **NOT a 2-day task** because the unknown unknowns are: type bucket scheme tuning,
|
| 411 |
+
positive-pair noise filtering (you WILL hit a quality ceiling from pair noise and
|
| 412 |
+
need to iterate), and integration into the serving path with cached projected
|
| 413 |
+
embeddings. But it is also not a 2-week task in the sense of "research project" β
|
| 414 |
+
the algorithm is well-understood and the code is short.
|
| 415 |
+
|
| 416 |
+
If your existing pairing system already has type buckets defined and you have a
|
| 417 |
+
clean campaign-pairs dataset ready to consume, this becomes a **3-5 day task**.
|
| 418 |
+
|
| 419 |
+
---
|
| 420 |
+
|
| 421 |
+
## 7. Open risks / honest caveats
|
| 422 |
+
|
| 423 |
+
1. **FashionSigLIP is already strong.** Marqo-FashionSigLIP was trained on 1M+ fashion
|
| 424 |
+
pairs with GCL. Cosine in its native space is already a much better starting point
|
| 425 |
+
than ResNet-18-on-ImageNet-cosine was for Vasileva 2018. The marginal lift from
|
| 426 |
+
adding type-aware projections may be smaller than 3-5 AUC points reported in the
|
| 427 |
+
original paper. Plan for "+2-4 AUC points on hand-curated holdout" as a realistic
|
| 428 |
+
target, not the original paper's numbers.
|
| 429 |
+
|
| 430 |
+
2. **Frozen vs fine-tuned.** Vasileva 2018 fine-tuned the backbone end-to-end. With
|
| 431 |
+
frozen FashionSigLIP, you lose the ability to refactor the shared embedding to
|
| 432 |
+
accommodate the projections. The diagonal mask is doing element-wise gating on a
|
| 433 |
+
fixed feature distribution. If FashionSigLIP's features are highly entangled
|
| 434 |
+
(color and category mixed in the same dims), a diagonal mask may not be expressive
|
| 435 |
+
enough β you may need the FC variant. Try both.
|
| 436 |
+
|
| 437 |
+
3. **Type-pair count vs data per pair.** With 66 pairs and limited training data,
|
| 438 |
+
per-pair sample sizes will be uneven. Consider:
|
| 439 |
+
- the `--rand_typespaces` option from the original code (collapse all pairs into K
|
| 440 |
+
random buckets to amortise data across pairs),
|
| 441 |
+
- a coarser type bucketing (~6 buckets β 21 pairs) initially, refine later.
|
| 442 |
+
|
| 443 |
+
4. **Color domination is partly a SigLIP property, not just a missing-projection
|
| 444 |
+
property.** The fact that "outfit pairing reasoning is dominated by color" likely
|
| 445 |
+
reflects what FashionSigLIP optimised for. A type-aware head will help but may not
|
| 446 |
+
fully fix it; a complementary trick is to add a small "anti-color" auxiliary loss
|
| 447 |
+
during head training that penalises high cosine when only color (e.g. average HSV
|
| 448 |
+
distance) differs.
|
| 449 |
+
|
| 450 |
+
5. **The paper's `L_sim_i` matters.** Don't drop the auxiliary losses entirely β
|
| 451 |
+
especially for small data regimes, the in-outfit visual similarity loss in the
|
| 452 |
+
shared space anchors the projection space to something stable. Recommend keeping
|
| 453 |
+
it but at a small weight (5e-3 or so, similar to original).
|
| 454 |
+
|
| 455 |
+
---
|
| 456 |
+
|
| 457 |
+
## 8. Bottom-line answers (for the 250-word summary)
|
| 458 |
+
|
| 459 |
+
- **Minimal viable architecture:** Frozen FashionSigLIP image embedding (768-d) β
|
| 460 |
+
shared `Linear(768, 128)` β 36-66 type-pair diagonal masks (`Embedding(K, 128)`,
|
| 461 |
+
ReLU, L2-norm). ~100K trainable params. Triplet loss, margin 0.2-0.3, optional
|
| 462 |
+
visual-semantic aux loss.
|
| 463 |
+
- **Minimum training data for measurable improvement:** ~70K-130K positive pairs
|
| 464 |
+
(β 10K outfits) for diagonal mask variant; ~330K+ pairs for FC variant. With ~25K
|
| 465 |
+
pairs you can already see lift over raw cosine if you use the fixed disjoint-mask
|
| 466 |
+
variant or coarser type buckets.
|
| 467 |
+
- **No-supervised-data path:** YES β same-photoshoot / same-campaign / same-lookbook
|
| 468 |
+
co-occurrence is a published, working signal (Veit 2015, Revanur 2022). It does NOT
|
| 469 |
+
require Polyvore-style supervised outfits.
|
| 470 |
+
- **Effort estimate:** 1-2 weeks end-to-end including evaluation and serving
|
| 471 |
+
integration; 3-5 days if your type-bucket scheme and co-shoot pair extraction are
|
| 472 |
+
already done.
|
| 473 |
+
|
| 474 |
+
---
|
| 475 |
+
|
| 476 |
+
## 9. Sources
|
| 477 |
+
|
| 478 |
+
- Vasileva 2018 paper: https://arxiv.org/abs/1803.09196
|
| 479 |
+
- Vasileva 2018 PDF: https://openaccess.thecvf.com/content_ECCV_2018/papers/Mariya_Vasileva_Learning_Type-Aware_Embeddings_ECCV_2018_paper.pdf
|
| 480 |
+
- Vasileva ar5iv HTML: https://ar5iv.labs.arxiv.org/html/1803.09196
|
| 481 |
+
- Reference impl: https://github.com/mvasil/fashion-compatibility
|
| 482 |
+
- Polyvore Outfits HF dataset: https://huggingface.co/datasets/mvasil/polyvore-outfits
|
| 483 |
+
- Conditional Similarity Networks (Veit 2017): https://arxiv.org/abs/1603.07810
|
| 484 |
+
- OutfitTransformer (WACV 2023): https://openaccess.thecvf.com/content/WACV2023/papers/Sarkar_OutfitTransformer_Learning_Outfit_Representations_for_Fashion_Recommendation_WACV_2023_paper.pdf
|
| 485 |
+
- Revanur 2021 semi-supervised: https://arxiv.org/abs/2109.08052
|
| 486 |
+
- Revanur 2022 in-the-wild: https://arxiv.org/abs/2206.05982
|
| 487 |
+
- Veit 2015 dyadic co-occurrences: https://www.researchgate.net/publication/282181243_Learning_Visual_Clothing_Style_with_Heterogeneous_Dyadic_Co-Occurrences
|
| 488 |
+
- MRMC weak-positive (Multimedia Systems 2025): https://link.springer.com/article/10.1007/s00530-025-02175-9
|
| 489 |
+
- FashionCLIP (Bianchi et al.): https://github.com/patrickjohncyh/fashion-clip
|
| 490 |
+
- Marqo-FashionSigLIP context: https://www.marqo.ai/blog/search-model-for-fashion
|
| 491 |
+
- GNN baseline (2024): https://arxiv.org/abs/2404.18040
|