Flat-lay brand encoder
encoders for grouping clothing by brand from photos
2 min readupdated
A set of models for extracting visual features (image encoders) from flat-lay clothing photos (items neatly laid out on a flat surface). They are trained so that items from the same brand cluster close together in vector space, even if the brand was never seen during training. The models are based on the SigLIP2-SO400M and Marqo-FashionSigLIP architectures, fine-tuned using ArcFace and SupCon loss functions. They are suitable for collection clustering and sample-based search (1-to-5-shot brand matching), with logos masked out during training so the model considers cut and design details rather than brand markers.
Key features
- Logo-agnostic training: original photos and photos with masked-out logos were used randomly during training.
- Two versions included: the heavy, accurate
siglip2-so400m-ft12(428M parameters) and the lightweight, fastfashionsiglip-ft6(93M parameters). - Clothing specialization: trained on a premium clothing catalog with an emphasis on frontal flat-lay shots.
- L2-normalized embeddings: outputs a 512-dimensional vector suitable for cosine similarity calculations.
What you can do
- Catalog clustering: group unknown brands or new collections by style and visual features based on examples.
- Similar item search: implement visual clothing search using vector cosine similarity (k-shot brand matching).
- Pipeline integration: integrate the model into existing open_clip pipelines for analyzing wardrobe visual characteristics.
Example
from huggingface_hub import hf_hub_download
import importlib.util, PIL.Image
spec = importlib.util.spec_from_file_location("fe", hf_hub_download("radagon213/flatlay-brand-encoder", "flatlay_encoder.py"))
fe = importlib.util.module_from_spec(spec); spec.loader.exec_module(fe)
model = fe.load("siglip2-so400m-ft12")
emb = model.embed([PIL.Image.open("garment.jpg")]) # (N, 512), L2-normalised
Read more
DetailsBenchmarks: siglip2-so400m-ft12 scores 43.0 on 5-shot acc (128-way, no logos), while fashionsiglip-ft6 scores 28.5.
Requirements: PyTorch, open_clip_torch>=3.2, safetensors, huggingface_hub, pillow.
Limitations: trained on Farfetch data (premium/luxury segment, frontal 3:4 flat-lay photos at 576x768 only).
License: non-commercial research use only.










Comments