Instructions to use Panavath/fashion-clip-b32 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- OpenCLIP
How to use Panavath/fashion-clip-b32 with OpenCLIP:
import open_clip model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:Panavath/fashion-clip-b32') tokenizer = open_clip.get_tokenizer('hf-hub:Panavath/fashion-clip-b32') - Notebooks
- Google Colab
- Kaggle
Fashion CLIP (ViT-B-32)
This model is a fine-tuned version of OpenAI's ViT-B-32 on a fashion and apparel e-commerce catalog for Visual Product Search ("Shop the Look").
Model Details
- Base Architecture:
ViT-B-32(Vision Transformer Base, 32x32 patch size) - Embedding Dimension: 512
- Image Input Size: 224x224
- Framework: OpenCLIP / PyTorch
How to Use with OpenCLIP
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(['blue denim button-down shirt', 'formal dress pants'])
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)
- Downloads last month
- -