🚀 Marqo-FashionSigLIP模型卡片
Marqo-FashionSigLIP利用广义对比学习(GCL),使模型不仅能基于文本描述进行训练,还能结合类别、风格、颜色、材质、关键词和细节信息,从而为时尚产品提供高度相关的搜索结果。该模型是在ViT - B - 16 - SigLIP (webli)的基础上进行微调得到的。
GitHub页面:Marqo-FashionCLIP
博客:Marqo博客
🚀 快速开始
✨ 主要特性
- 支持标签:clip、e - commerce、fashion、multimodal retrieval、siglip
- 支持的库:OpenCLIP
- 任务类型:零样本图像分类
- 许可证:Apache - 2.0
- 训练数据集:Marqo/atlas、Marqo/deepfashion - inshop、Marqo/deepfashion - multimodal、Marqo/fashion200k、Marqo/iMaterialist、Marqo/KAGL、Marqo/polyvore
- 评估指标:precision、recall、MRR
📦 安装指南
此模型可通过OpenCLIP无缝使用,示例代码如下:
import open_clip
model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:Marqo/marqo-fashionSigLIP')
tokenizer = open_clip.get_tokenizer('hf-hub:Marqo/marqo-fashionSigLIP')
import torch
from PIL import Image
image = preprocess_val(Image.open("docs/fashion-hippo.png")).unsqueeze(0)
text = tokenizer(["a hat", "a t-shirt", "shoes"])
with torch.no_grad(), torch.cuda.amp.autocast():
image_features = model.encode_image(image)
text_features = model.encode_text(text)
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
print("Label probs:", text_probs)
💻 使用示例
基础用法
import open_clip
model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:Marqo/marqo-fashionSigLIP')
tokenizer = open_clip.get_tokenizer('hf-hub:Marqo/marqo-fashionSigLIP')
import torch
from PIL import Image
image = preprocess_val(Image.open("docs/fashion-hippo.png")).unsqueeze(0)
text = tokenizer(["a hat", "a t-shirt", "shoes"])
with torch.no_grad(), torch.cuda.amp.autocast():
image_features = model.encode_image(image)
text_features = model.encode_text(text)
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
print("Label probs:", text_probs)
📚 详细文档
基准测试结果
以下是该模型在6个公开多模态时尚数据集(Atlas、[DeepFashion (In - shop)](https://huggingface.co/datasets/Marqo/deepfashion - inshop)、[DeepFashion (Multimodal)](https://huggingface.co/datasets/Marqo/deepfashion - multimodal)、Fashion200k、KAGL和Polyvore)上的平均评估结果:
文本到图像(6个数据集的平均值)
模型 |
平均召回率 |
召回率@1 |
召回率@10 |
MRR |
Marqo - FashionSigLIP |
0.231 |
0.121 |
0.340 |
0.239 |
FashionCLIP2.0 |
0.163 |
0.077 |
0.249 |
0.165 |
OpenFashionCLIP |
0.132 |
0.060 |
0.204 |
0.135 |
ViT - B - 16 - laion2b_s34b_b88k |
0.174 |
0.088 |
0.261 |
0.180 |
ViT - B - 16 - SigLIP - webli |
0.212 |
0.111 |
0.314 |
0.214 |
类别到产品(5个数据集的平均值)
模型 |
平均准确率 |
准确率@1 |
准确率@10 |
MRR |
Marqo - FashionSigLIP |
0.737 |
0.758 |
0.716 |
0.812 |
FashionCLIP2.0 |
0.684 |
0.681 |
0.686 |
0.741 |
OpenFashionCLIP |
0.646 |
0.653 |
0.639 |
0.720 |
ViT - B - 16 - laion2b_s34b_b88k |
0.662 |
0.673 |
0.652 |
0.743 |
ViT - B - 16 - SigLIP - webli |
0.688 |
0.690 |
0.685 |
0.751 |
子类别到产品(4个数据集的平均值)
模型 |
平均准确率 |
准确率@1 |
准确率@10 |
MRR |
Marqo - FashionSigLIP |
0.725 |
0.767 |
0.683 |
0.811 |
FashionCLIP2.0 |
0.657 |
0.676 |
0.638 |
0.733 |
OpenFashionCLIP |
0.598 |
0.619 |
0.578 |
0.689 |
ViT - B - 16 - laion2b_s34b_b88k |
0.638 |
0.651 |
0.624 |
0.712 |
ViT - B - 16 - SigLIP - webli |
0.643 |
0.643 |
0.643 |
0.726 |
📄 许可证
本项目采用Apache - 2.0许可证。