Downloads · 30 days
22
19% of all-time downloads
Panavath/fashion-clip-b32
fashion-clip-b32 is a feature extraction model from Panavath. Use it when you need embeddings to search or compare text. It is set up for open_clip. The card lists the license as mit.
This model is a fine-tuned version of OpenAI's ViT-B-32 on an e-commerce fashion catalog containing 14,833 products across 23 categories for Visual Product Search, "Shop the Look", and Cross-Modal Semantic Retrieval.
Downloads · 30 days
22
19% of all-time downloads
All-time downloads
118
Public
Repo size
2.4 GB
Likes
0
Public
Click a slice to open those files.
.bin605 MB · 50%
From the Hugging Face model README
This model is a fine-tuned version of OpenAI's ViT-B-32 on an e-commerce fashion catalog containing 14,833 products across 23 categories for Visual Product Search, "Shop the Look", and Cross-Modal Semantic Retrieval.
ViT-B-32 (Vision Transformer Base, 32x32 patch size)openaiCasual Shirts, Formal Shirts, Formal Pants, Jeans, Men Cargos, Printed Hoodies, Printed T-shirts, Solid T-shirts, Blazers, Jackets, Denim Jackets, Sports Jackets, Long Pants, Short Pants, Dresses (Gaun), Sweaters, Polo Shirts, Skirts (Rok), Coats (Mantel), etc.
import torch
import open_clip
from PIL import Image
# 1. Load model and preprocessing transforms directly from Hugging Face Hub
model, _, preprocess = open_clip.create_model_and_transforms('hf-hub:Panavath/fashion-clip-b32')
tokenizer = open_clip.get_tokenizer('ViT-B-32')
model.eval()
# 2. Embed an image
image = preprocess(Image.open('path_to_clothing.jpg')).unsqueeze(0)
with torch.no_grad():
image_features = model.encode_image(image)
image_features /= image_features.norm(dim=-1, keepdim=True)
# 3. Embed a text query
text = tokenizer(['black tactical cargo pants', 'formal striped button down shirt'])
with torch.no_grad():
text_features = model.encode_text(text)
text_features /= text_features.norm(dim=-1, keepdim=True)
# 4. Compute cosine similarity
similarity = (image_features @ text_features.T).squeeze(0)
print('Similarity scores:', similarity)