The dataset contains images of real people; ensure you comply with its license. Potential gender, body‑type and cultural biases inherited from the data were not fully audited.
1from transformers import AutoTokenizer
2from timm import create_model
3import torch
4
5# Text encoder
6tok = AutoTokenizer.from_pretrained("bert-base-uncased")
7
8# Vision + Text dual encoder
9model = create_model(
10 "visionfashion_vit_bert",
11 pretrained=True,
12 checkpoint_path="visionfashion_vit_bert.pth"
13).eval().to("cuda")
14
15# Encode a batch
16text = tok(["red floral summer dress"], return_tensors="pt").to("cuda")
17img = load_preprocessed_images(batch_paths).to("cuda") # RGB, 224×224, 0-1
18
19with torch.no_grad():
20 img_emb, txt_emb = model(img, text["input_ids"], text["attention_mask"])
21
22# Cosine similarity = relevance score
23scores = torch.matmul(img_emb, txt_emb.T)
1@unpublished{topaloglu2025visionfashion,
2 author = {Tuğcan Topaloğlu},
3 title = {{VisionFashion}: Multi-Modal Style Embedding Learning with Vision Transformers and BERT for Fashion Image Analysis and Recommendation},
4 year = {2025},
5 note = {Work in progress},
6 url = {https://huggingface.co/tugcantopaloglu/visionfashion}
7}