返回模型
说明文档
Marqo-FashionSigLIP 模型卡片
Marqo Fashion Siglip 2 现已推出。 marqo-fashion-SigLip-2 在 MMR 和召回率方面相比 marqo-fashion-SigLip 实现了进一步 78% 的提升。联系 Marqo 了解更多:https://www.marqo.ai/book-demo
Marqo-FashionSigLIP 是一款多模态嵌入模型,相比 fashion clip 在 MRR 和召回率方面实现了高达 57% 的提升。
Marqo-FashionSigLIP 利用广义对比学习 (GCL),使模型不仅能够学习文本描述,还能学习类别、风格、颜色、材质、关键词和细节信息,从而为时尚产品提供高度相关的搜索结果。 该模型基于 ViT-B-16-SigLIP (webli) 进行微调。
Github 页面: Marqo-FashionCLIP
博客: Marqo 博客
使用方法
Hugging Face
可以使用 AutoModel 加载模型:
from transformers import AutoModel, AutoProcessor
model = AutoModel.from_pretrained('Marqo/marqo-fashionSigLIP', trust_remote_code=True)
processor = AutoProcessor.from_pretrained('Marqo/marqo-fashionSigLIP', trust_remote_code=True)
import torch
from PIL import Image
image = [Image.open("docs/fashion-hippo.png")]
text = ["a hat", "a t-shirt", "shoes"]
processed = processor(text=text, images=image, padding='max_length', return_tensors="pt")
with torch.no_grad():
image_features = model.get_image_features(processed['pixel_values'], normalize=True)
text_features = model.get_text_features(processed['input_ids'], normalize=True)
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
print("Label probs:", text_probs)
# [0.98379946, 0.01294010, 0.00326044]
OpenCLIP
该模型可以无缝配合 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, normalize=True)
text_features = model.encode_text(text, normalize=True)
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
print("Label probs:", text_probs)
# [0.9860219105287394, 0.00777916527489097, 0.006198924196369721]
Transformers.js
您还可以使用 Transformers.js 库在 JavaScript 中运行该模型。
首先,从 NPM 安装:
npm i @huggingface/transformers
然后,按如下方式计算嵌入:
import { SiglipTextModel, SiglipVisionModel, AutoTokenizer, AutoProcessor, RawImage, softmax, dot } from '@huggingface/transformers';
const model_id = 'Marqo/marqo-fashionSigLIP';
// Load tokenizer and text model
const tokenizer = await AutoTokenizer.from_pretrained(model_id);
const text_model = await SiglipTextModel.from_pretrained(model_id);
// Load processor and vision model
const processor = await AutoProcessor.from_pretrained(model_id);
const vision_model = await SiglipVisionModel.from_pretrained(model_id);
// Run tokenization
const texts = ['a hat', 'a t-shirt', 'shoes'];
const text_inputs = tokenizer(texts, { padding: 'max_length', truncation: true });
// Compute text embeddings
const { text_embeds } = await text_model(text_inputs);
// Read image and run processor
const image = await RawImage.read('https://raw.githubusercontent.com/marqo-ai/marqo-FashionCLIP/main/docs/fashion-hippo.png');
const image_inputs = await processor(image);
// Compute vision embeddings
const { image_embeds } = await vision_model(image_inputs);
// Compute similarity scores
const normalized_text_embeds = text_embeds.normalize().tolist();
const normalized_image_embeds = image_embeds.normalize().tolist()[0];
const text_probs = softmax(normalized_text_embeds.map((text_embed) =>
100.0 * dot(normalized_image_embeds, text_embed)
));
console.log(text_probs);
// [0.9860219105287394, 0.00777916527489097, 0.006198924196369721]
基准测试结果
以下是在 6 个公开多模态时尚数据集上的平均评估结果(Atlas、DeepFashion(店内)、DeepFashion(多模态)、Fashion200k、KAGL 和 Polyvore):
文本到图像(6 个数据集平均)
| 模型 | AvgRecall | Recall@1 | Recall@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 个数据集平均)
| 模型 | AvgP | P@1 | P@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 个数据集平均)
| 模型 | AvgP | P@1 | P@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 |
Marqo/marqo-fashionSigLIP
作者 Marqo
zero-shot-image-classification
open_clip
↓ 667.7K
♥ 69
创建时间: 2024-08-09 01:32:22+00:00
更新时间: 2026-02-18 03:34:31+00:00
在 Hugging Face 上查看文件 (29)
.gitattributes
README.md
config.json
marqo_fashionSigLIP.py
model.safetensors
onnx/text_model.onnx
ONNX
onnx/text_model_bnb4.onnx
ONNX
onnx/text_model_fp16.onnx
ONNX
onnx/text_model_int8.onnx
ONNX
onnx/text_model_q4.onnx
ONNX
onnx/text_model_q4f16.onnx
ONNX
onnx/text_model_quantized.onnx
ONNX
onnx/text_model_uint8.onnx
ONNX
onnx/vision_model.onnx
ONNX
onnx/vision_model_bnb4.onnx
ONNX
onnx/vision_model_fp16.onnx
ONNX
onnx/vision_model_int8.onnx
ONNX
onnx/vision_model_q4.onnx
ONNX
onnx/vision_model_q4f16.onnx
ONNX
onnx/vision_model_quantized.onnx
ONNX
onnx/vision_model_uint8.onnx
ONNX
open_clip_config.json
open_clip_model.safetensors
open_clip_pytorch_model.bin
preprocessor_config.json
special_tokens_map.json
spiece.model
tokenizer.json
tokenizer_config.json