CoolFace
Datasetpublic

Marqo/google-shopping-general-eval-100k

Marqo Ecommerce Embedding Models In this work, we introduce the GoogleShopping-1m dataset for evaluation. This dataset comes with the release of our state-of-the-art embedding models for ecommerce products: Marqo-Ecommerce-B and Marqo-Ecommerce-L. Released Content: Marqo-Ecommerce-B and Marqo-Ecommerce-L embedding models GoogleShopping-1m and AmazonProducts-3m for evaluation Evaluation Code The benchmarking results show that the… See the full description on the dataset page: https://huggingface.co/datasets/Marqo/google-shopping-general-eval-100k.

sourceHugging Faceupdated 2y agoView on Hugging Face
6likes45downloads
Dataset Card

<div style="display: flex; align-items: center; gap: 10px;"> <a href="https://www.marqo.ai/blog/introducing-marqos-ecommerce-embedding-models"> <img src="https://img.shields.io/badge/ModelRelease-Blog-blue?logo=font-awesome&logoColor=white&style=flat&logo=pencil-alt" alt="Blog"> </a> <a href="https://github.com/marqo-ai/marqo-ecommerce-embeddings"> <img src="https://img.shields.io/badge/GitHub-Repo-black?logo=github" alt="GitHub Repo"> </a> <a href="https://www.marqo.ai/blog/how-to-build-an-ecommerce-image-search-application"> <img src="https://img.shields.io/badge/Ecommerce Search-Blog-red?logo=font-awesome&logoColor=white&style=flat&logo=pencil-alt" alt="Blog"> </a> <a href="https://join.slack.com/t/marqo-community/sharedinvite/zt-2b4nsvbd2-TDf8agPszzWH5hYKBMIgDA"> <img src="https://img.shields.io/badge/Slack-JoinMarqoCommunity-purple?logo=Slack" alt=Slack Community"> </a> </div>

Marqo Ecommerce Embedding Models

In this work, we introduce the GoogleShopping-1m dataset for evaluation. This dataset comes with the release of our state-of-the-art embedding models for ecommerce products: Marqo-Ecommerce-B and Marqo-Ecommerce-L.

Released Content: 1) Marqo-Ecommerce-B and Marqo-Ecommerce-L embedding models 2) GoogleShopping-1m and AmazonProducts-3m for evaluation 3) Evaluation Code

The benchmarking results show that the Marqo-Ecommerce models consistently outperformed all other models across various metrics. Specifically, marqo-ecommerce-L achieved an average improvement of 17.6% in MRR and 20.5% in nDCG@10 when compared with the current best open source model, ViT-SO400M-14-SigLIP across all three tasks in the marqo-ecommerce-hard dataset. When compared with the best private model, Amazon-Titan-Multimodal, we saw an average improvement of 38.9% in MRR and 45.1% in nDCG@10 across all three tasks, and 35.9% in Recall across the Text-to-Image tasks in the marqo-ecommerce-hard dataset.

<img src="https://raw.githubusercontent.com/marqo-ai/marqo-ecommerce-embeddings/main/performance.png" alt="multi split visual" width="700"/>

More benchmarking results can be found below.

Models

**Embedding Model****#Params (m)****Dimension****HuggingFace****Download .pt**
Marqo-Ecommerce-B203768Marqo/marqo-ecommerce-embeddings-Blink
Marqo-Ecommerce-L6521024Marqo/marqo-ecommerce-embeddings-Llink

Load from HuggingFace with transformers

To load the models in Transformers, see below. The models are hosted on Hugging Face and loaded using Transformers.

python
from transformers import AutoModel, AutoProcessor
import torch
from PIL import Image
import requests

model_name= 'Marqo/marqo-ecommerce-embeddings-L'
# model_name = 'Marqo/marqo-ecommerce-embeddings-B'

model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)

img = Image.open(requests.get('https://raw.githubusercontent.com/marqo-ai/marqo-ecommerce-embeddings/refs/heads/main/images/dining-chairs.png', stream=True).raw).convert("RGB")
image = [img]
text = ["dining chairs", "a laptop", "toothbrushes"]
processed = processor(text=text, images=image, padding='max_length', return_tensors="pt")
processor.image_processor.do_rescale = False
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 * image_features @ text_features.T).softmax(dim=-1)
    
print(text_probs)
# [1.0000e+00, 8.3131e-12, 5.2173e-12]

Load from HuggingFace with OpenCLIP

To load the models in OpenCLIP, see below. The models are hosted on Hugging Face and loaded using OpenCLIP. You can also find this code inside run_models.py.

pip install open_clip_torch
python
from PIL import Image
import open_clip
import requests
import torch

# Specify model from Hugging Face Hub
model_name = 'hf-hub:Marqo/marqo-ecommerce-embeddings-L'
# model_name = 'hf-hub:Marqo/marqo-ecommerce-embeddings-B'

model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms(model_name)
tokenizer = open_clip.get_tokenizer(model_name)

# Preprocess the image and tokenize text inputs
# Load an example image from a URL
img = Image.open(requests.get('https://raw.githubusercontent.com/marqo-ai/marqo-ecommerce-embeddings/refs/heads/main/images/dining-chairs.png', stream=True).raw)
image = preprocess_val(img).unsqueeze(0)
text = tokenizer(["dining chairs", "a laptop", "toothbrushes"])

# Perform inference
with torch.no_grad(), torch.cuda.amp.autocast():
    image_features = model.encode_image(image, normalize=True)
    text_features = model.encode_text(text, normalize=True)

    # Calculate similarity probabilities
    text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)

# Display the label probabilities
print("Label probs:", text_probs)
# [1.0000e+00, 8.3131e-12, 5.2173e-12]

Evaluation

Generalised Contrastiove Learning (GCL) is used for the evaluation. The following code can also be found in scripts.

git clone https://github.com/marqo-ai/GCL

Install the packages required by GCL.

1. GoogleShopping-Text2Image Retrieval.

cd ./GCL
MODEL=hf-hub:Marqo/marqo-ecommerce-B
outdir=/MarqoModels/GE/marqo-ecommerce-B/gs-title2image
hfdataset=Marqo/google-shopping-general-eval
python  evals/eval_hf_datasets_v1.py \
      --model_name $MODEL \
      --hf-dataset $hfdataset \
      --output-dir $outdir \
      --batch-size 1024 \
      --num_workers 8 \
      --left-key "['title']" \
      --right-key "['image']" \
      --img-or-txt "[['txt'], ['img']]" \
      --left-weight "[1]" \
      --right-weight "[1]" \
      --run-queries-cpu \
      --top-q 4000 \
      --doc-id-key item_ID \
      --context-length "[[64], [0]]"

2. GoogleShopping-Category2Image Retrieval.

cd ./GCL
MODEL=hf-hub:Marqo/marqo-ecommerce-B
outdir=/MarqoModels/GE/marqo-ecommerce-B/gs-cat2image
hfdataset=Marqo/google-shopping-general-eval
python  evals/eval_hf_datasets_v1.py \
      --model_name $MODEL \
      --hf-dataset $hfdataset \
      --output-dir $outdir \
      --batch-size 1024 \
      --num_workers 8 \
      --left-key "['query']" \
      --right-key "['image']" \
      --img-or-txt "[['txt'], ['img']]" \
      --left-weight "[1]" \
      --right-weight "[1]" \
      --run-queries-cpu \
      --top-q 4000 \
      --doc-id-key item_ID \
      --context-length "[[64], [0]]"

3. AmazonProducts-Category2Image Retrieval.

cd ./GCL
MODEL=hf-hub:Marqo/marqo-ecommerce-B
outdir=/MarqoModels/GE/marqo-ecommerce-B/ap-title2image
hfdataset=Marqo/amazon-products-eval
python  evals/eval_hf_datasets_v1.py \
      --model_name $MODEL \
      --hf-dataset $hfdataset \
      --output-dir $outdir \
      --batch-size 1024 \
      --num_workers 8 \
      --left-key "['title']" \
      --right-key "['image']" \
      --img-or-txt "[['txt'], ['img']]" \
      --left-weight "[1]" \
      --right-weight "[1]" \
      --run-queries-cpu \
      --top-q 4000 \
      --doc-id-key item_ID \
      --context-length "[[64], [0]]"

Detailed Performance

Our benchmarking process was divided into two distinct regimes, each using different datasets of ecommerce product listings: marqo-ecommerce-hard and marqo-ecommerce-easy. Both datasets contained product images and text and only differed in size. The "easy" dataset is approximately 10-30 times smaller (200k vs 4M products), and designed to accommodate rate-limited models, specifically Cohere-Embeddings-v3 and GCP-Vertex (with limits of 0.66 rps and 2 rps respectively). The "hard" dataset represents the true challenge, since it contains four million ecommerce product listings and is more representative of real-world ecommerce search scenarios.

Within both these scenarios, the models were benchmarked against three different tasks:

  • —Google Shopping Text-to-Image
  • —Google Shopping Category-to-Image
  • —Amazon Products Text-to-Image

Marqo-Ecommerce-Hard

Marqo-Ecommerce-Hard looks into the comprehensive evaluation conducted using the full 4 million dataset, highlighting the robust performance of our models in a real-world context.

GoogleShopping-Text2Image Retrieval.

**Embedding Model****mAP****R@10****MRR****nDCG@10**
Marqo-Ecommerce-L0.6820.8780.6830.726
Marqo-Ecommerce-B0.6230.8320.6240.668
ViT-SO400M-14-SigLip0.5730.7630.5740.613
ViT-L-16-SigLip0.5400.7220.5400.577
ViT-B-16-SigLip0.4760.6600.4770.513
Amazon-Titan-MultiModal0.4750.6480.4750.509
Jina-V1-CLIP0.2850.4020.2850.306

GoogleShopping-Category2Image Retrieval.

**Embedding Model****mAP****P@10****MRR****nDCG@10**
Marqo-Ecommerce-L0.4630.6520.8220.666
Marqo-Ecommerce-B0.4230.6290.8100.644
ViT-SO400M-14-SigLip0.3520.5160.7070.529
ViT-L-16-SigLip0.3240.4970.6870.509
ViT-B-16-SigLip0.2770.4580.6600.473
Amazon-Titan-MultiModal0.2460.4290.6420.446
Jina-V1-CLIP0.1230.2750.5040.294

AmazonProducts-Text2Image Retrieval.

**Embedding Model****mAP****R@10****MRR****nDCG@10**
Marqo-Ecommerce-L0.6580.8540.6630.703
Marqo-Ecommerce-B0.5920.7950.5970.637
ViT-SO400M-14-SigLip0.5600.7420.5640.599
ViT-L-16-SigLip0.5440.7150.5480.580
ViT-B-16-SigLip0.4800.6500.4840.515
Amazon-Titan-MultiModal0.4560.6270.4570.491
Jina-V1-CLIP0.2650.3780.2660.285

Marqo-Ecommerce-Easy

This dataset is about 10-30 times smaller than the Marqo-Ecommerce-Hard, and designed to accommodate rate-limited models, specifically Cohere-Embeddings-v3 and GCP-Vertex.

GoogleShopping-Text2Image Retrieval.

**Embedding Model****mAP****R@10****MRR****nDCG@10**
Marqo-Ecommerce-L0.8790.9710.8790.901
Marqo-Ecommerce-B0.8420.9610.8420.871
ViT-SO400M-14-SigLip0.7920.9350.7920.825
GCP-Vertex0.7400.9100.7400.779
ViT-L-16-SigLip0.7540.9070.7540.789
ViT-B-16-SigLip0.7010.8700.7010.739
Amazon-Titan-MultiModal0.6940.8680.6930.733
Jina-V1-CLIP0.4800.6380.4800.511
Cohere-embedding-v30.3580.5150.3580.389

GoogleShopping-Category2Image Retrieval.

**Embedding Model****mAP****P@10****MRR****nDCG@10**
Marqo-Ecommerce-L0.5150.3580.7640.590
Marqo-Ecommerce-B0.4790.3360.7440.558
ViT-SO400M-14-SigLip0.4230.3020.6440.487
GCP-Vertex0.4170.2980.6360.481
ViT-L-16-SigLip0.3920.2810.6270.458
ViT-B-16-SigLip0.3470.2520.5940.414
Amazon-Titan-MultiModal0.3080.2310.5580.377
Jina-V1-CLIP0.1750.1220.3690.229
Cohere-embedding-v30.1360.1100.3150.178

AmazonProducts-Text2Image Retrieval.

**Embedding Model****mAP****R@10****MRR****nDCG@10**
Marqo-Ecommerce-L0.920.9780.9280.940
Marqo-Ecommerce-B0.8970.9670.8970.914
ViT-SO400M-14-SigLip0.8600.9540.8600.882
ViT-L-16-SigLip0.8420.9400.8420.865
GCP-Vertex0.8080.9330.8080.837
ViT-B-16-SigLip0.7970.9170.7970.825
Amazon-Titan-MultiModal0.7620.8890.7630.791
Jina-V1-CLIP0.5300.6990.5300.565
Cohere-embedding-v30.4330.5970.4330.465

Citation

@software{zhu2024marqoecommembed_2024,
        author = {Tianyu Zhu and and Jesse Clark},
        month = oct,
        title = {{Marqo Ecommerce Embeddings - Foundation Model for Product Embeddings}},
        url = {https://github.com/marqo-ai/marqo-ecommerce-embeddings/},
        version = {1.0.0},
        year = {2024}
        }