Datasets:

Modalities:
Image
Text
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
Dask
License:
image
imagewidth (px)
62
453
query
stringlengths
3
73
product_id
stringlengths
13
20
position
int64
1
100
title
stringlengths
4
86
pair_id
stringlengths
22
94
score_linear
int64
1
100
score_reciprocal
float64
1
100
no_score
int64
1
1
query_id
stringlengths
1
5
Earmuffs
11950591053179551937
2
La Carrie Faux Fur Headband with Stretch Womens Winter Earwarmer Earmuff (White)
Earmuffs-11950591053179551937
99
50
1
0
Earmuffs
13060356563414168615
3
Ugg Women's Shearling Earmuffs - Black
Earmuffs-13060356563414168615
98
33.333333
1
0
Earmuffs
6741082963333937131
5
Prettylittlething Women's Cream Soft Faux Fur Ear Muffs
Earmuffs-6741082963333937131
96
20
1
0
Earmuffs
8848678524883684053
8
Prettylittlething Women's Camel Soft Faux Fur Ear Muffs
Earmuffs-8848678524883684053
93
12.5
1
0
Earmuffs
11334298244441157208
12
Michael Michael Kors Women's Embellished Faux-Fur Earmuffs - Black
Earmuffs-11334298244441157208
89
8.333333
1
0
Earmuffs
8893899700262450761
13
Dolls Kill x Spongebob Snazy Trail Earmuffs - One Size
Earmuffs-8893899700262450761
88
7.692308
1
0
Earmuffs
3527736290902828119
15
Hig Ear Warmer Unisex Classic Fleece Earmuffs Winter Accessory Outdoor
Earmuffs-3527736290902828119
86
6.666667
1
0
Earmuffs
16128992827390368025
17
GERGELLA Ear Muffs for Men Women - Winter Ear Warmers - Warm Ear Covers for Cold ...
Earmuffs-16128992827390368025
84
5.882353
1
0
Earmuffs
13881018908259734424
18
Genuine Sheepskin Earmuffs With Gift Box - Chocolate
Earmuffs-13881018908259734424
83
5.555556
1
0
Earmuffs
13158629858075515813
19
Vorkoi Ear Muffs Earmuff Fashion Unisex Women Men Windproof Winter Ear Warmer ...
Earmuffs-13158629858075515813
82
5.263158
1
0
Earmuffs
14686824626570439606
22
LCXSHYE Winter Ear Muffs Faux Fur Warm Earmuffs Cute Foldable Outdoor Ear Warmers ...
Earmuffs-14686824626570439606
79
4.545455
1
0
Earmuffs
6096354532091761868
24
180s Women's Down Ear Warmers, Black
Earmuffs-6096354532091761868
77
4.166667
1
0
Earmuffs
12341351447363567492
27
Ugg Sheepskin Tasman Earmuffs
Earmuffs-12341351447363567492
74
3.703704
1
0
Earmuffs
8045576755665707149
28
Ugg Sheepskin Earmuffs - Black
Earmuffs-8045576755665707149
73
3.571429
1
0
Earmuffs
13639425518637100023
31
Shein 1pc Ladies' Foldable Plush Ear Warmer Ear Muffs Suitable for Winter Outdoor ...
Earmuffs-13639425518637100023
70
3.225806
1
0
Earmuffs
16043810604685015659
32
Aroma Season Heated Ear Warmer Electric Earmuff, Size: One size, Brown
Earmuffs-16043810604685015659
69
3.125
1
0
Earmuffs
12369821608029814382
35
LETHMIK Womens Faux Fur Foldable Big Earmuffs Winter Outdoor Ear Warmers Beige
Earmuffs-12369821608029814382
66
2.857143
1
0
Earmuffs
4243113040618343901
37
Cozy Fur-Lined Winter Windproof Plush Earmuffs (4-Pack) - Assorted
Earmuffs-4243113040618343901
64
2.702703
1
0
Earmuffs
12703366532455766241
39
Turtle Fur Ear Muffin - Faux Fur Lined Ivory
Earmuffs-12703366532455766241
62
2.564103
1
0
Earmuffs
3421159116679639030
42
Fluffy Earmuffs | Ithaca Sheepskin White
Earmuffs-3421159116679639030
59
2.380952
1
0
Earmuffs
12692560611091776766
47
Rulala Faux Fur Headband Winter Warm Earwarmer Earmuff for Women White
Earmuffs-12692560611091776766
54
2.12766
1
0
Earmuffs
10105117206060649333
49
Embroiderycabin Sheep Earmuffs, Winter Warm Earmuffs, Women Earmuffs, Ear Warmer ...
Earmuffs-10105117206060649333
52
2.040816
1
0
Earmuffs
3048769879450526353
50
Anew Golf Women's Curly Earmuffs - Ivory
Earmuffs-3048769879450526353
51
2
1
0
Earmuffs
17554167830423323349
51
ApolloBox Cozy Warmth Earmuffs - Beige - White - Snug Comfort
Earmuffs-17554167830423323349
50
1.960784
1
0
Earmuffs
13626414849786967473
53
Loritta Winter Earmuffs for Women , Foldable Cute Soft Earmuffs, Women's, Size ...
Earmuffs-13626414849786967473
48
1.886792
1
0
Earmuffs
17898548680260509782
54
180s Behind-the-Head Earmuffs - Chesterfield Ear Warmer Men Charcoal Gray
Earmuffs-17898548680260509782
47
1.851852
1
0
Earmuffs
14161877429574399670
55
Pia Rossini Hepburn Earmuffs, Pink, Women's, Hair Accessories Earmuffs
Earmuffs-14161877429574399670
46
1.818182
1
0
Earmuffs
1539369684263056205
56
Girls - Black Fluffy Earmuffs - Size: 8-14Y+ (8/20) - H&M
Earmuffs-1539369684263056205
45
1.785714
1
0
Earmuffs
15970458072186916174
58
Shein 1pc Women's Foldable Plush Ear Muffs Ear Warmers for Winter Outdoor ...
Earmuffs-15970458072186916174
43
1.724138
1
0
Earmuffs
11925973543532142928
59
FRR Rabbit Fur Earmuffs with Velvet Band
Earmuffs-11925973543532142928
42
1.694915
1
0
Earmuffs
16219299032427246768
60
Lowtagz Women's Faux Fur Earmuffs with Pearl Accent Bow Knot, Foldable Fluffy Ear ...
Earmuffs-16219299032427246768
41
1.666667
1
0
Earmuffs
585295227075662948
66
ProjecktNomad Brown Herringbone and Faux Fur Earmuffs
Earmuffs-585295227075662948
35
1.515152
1
0
Earmuffs
16471427667898866875
67
PROHEAR 027 Am FM Radio Headphones with Digital Display, 25dB NRR, Safety Ear ...
Earmuffs-16471427667898866875
34
1.492537
1
0
Earmuffs
14230767060363120316
73
LillSport Earmuffs (Black)
Earmuffs-14230767060363120316
28
1.369863
1
0
Earmuffs
16641543743828749061
76
Ear Muffs Faux Fur Black
Earmuffs-16641543743828749061
25
1.315789
1
0
Earmuffs
7809123957683461705
78
Hyeeun Faux Fur Ear Muffs Pink One Size
Earmuffs-7809123957683461705
23
1.282051
1
0
Earmuffs
2570351137139672387
79
Vorkoi Foldable Ear Muffs for Women Cold Weather Fluffy Earmuffs Winter Warm ...
Earmuffs-2570351137139672387
22
1.265823
1
0
Earmuffs
5780736666559986230
80
180s - Lush Ear Warmer - Dusty Rose
Earmuffs-5780736666559986230
21
1.25
1
0
Earmuffs
4583946547431363017
81
Shein 1pc Women's Cute Solid Color Ear Muffs, Winter Ear Warmers for Riding, One ...
Earmuffs-4583946547431363017
20
1.234568
1
0
Earmuffs
821677802510110837
83
Vanderfields Shooting Ear Protection Earmuffs - Cancelling Safety Ear Muffs for ...
Earmuffs-821677802510110837
18
1.204819
1
0
Earmuffs
14552621729467995384
86
Western Safety Noise Canceling Electronic Ear Muffs
Earmuffs-14552621729467995384
15
1.162791
1
0
Earmuffs
101449068758048351
87
Damelio Ear Muffs | Womens | Princess Polly
Earmuffs-101449068758048351
14
1.149425
1
0
Earmuffs
2453781036945821868
88
Bad Piggies Badpiggies 6 Pairs Earbags Bandless Ear Muffs Soft Fleece Winter Ear ...
Earmuffs-2453781036945821868
13
1.136364
1
0
Earmuffs
11114457389690793410
92
prekr Winter Rabbit Velvet Earmuffs for Women - Classic Brand, Fashionable, Warm ...
Earmuffs-11114457389690793410
9
1.086957
1
0
Earmuffs
14036473914941946372
94
Winter Warm Foldable Earmuffs Trendy Color Block Plush Earmuffs Trendy Faux Fur ...
Earmuffs-14036473914941946372
7
1.06383
1
0
Earmuffs
13168373935616431677
97
AWESAFE Electronic Shooting Earmuffs Ear Hearing Protection Headphones for ...
Earmuffs-13168373935616431677
4
1.030928
1
0
Earmuffs
2911678164741255054
100
Ear Muffs Fleece Earwarmer Winter Ear Warmers Mens Womens Behind The
Earmuffs-2911678164741255054
1
1
1
0
Headwear
4276684642233198628
1
Techwear Storm Docker Hat Saita, Camel
Headwear-4276684642233198628
100
100
1
1
Headwear
780824183565062611
2
Carhartt Acrylic Watch Hat, Black
Headwear-780824183565062611
99
50
1
1
Headwear
7327449800122943761
4
Bass Pro Shops Mesh Cap - Light Blue - OSFM - Men's
Headwear-7327449800122943761
97
25
1
1
Headwear
15513345717215780054
7
Pandaize Tech Aviator Hat: Outdoor Cold-Weather Protection, Water-Resistant ...
Headwear-15513345717215780054
94
14.285714
1
1
Headwear
12796632817562111605
8
Gelante Plain Blank Baseball Caps Adjustable Back Strap Wholesale Lot 6 Pack
Headwear-12796632817562111605
93
12.5
1
1
Headwear
3267863181810727933
9
Besufy Women Girl Solid Color Warm Winter Beret French Artist Beanie Hat Ski Cap ...
Headwear-3267863181810727933
92
11.111111
1
1
Headwear
14328326876104020910
11
100% Real Sheep Shearing Fur Hat Thicken Winter Warm Baseball Cap
Headwear-14328326876104020910
90
9.090909
1
1
Headwear
9501081917512786647
12
Goorin Bros. Panthuroy Panther Patch Corduroy Trucker Hat in Whiskey
Headwear-9501081917512786647
89
8.333333
1
1
Headwear
8180979991794294035
13
Melin Hydro Odyssey Stacked Snapback Hat Navy / Classic
Headwear-8180979991794294035
88
7.692308
1
1
Headwear
8707592148285641272
14
PURFUN Winter Cozy Plush Ushanka Russian Hat Windproof Thermal Full Hood Earflap ...
Headwear-8707592148285641272
87
7.142857
1
1
Headwear
11935863590562703934
15
Yirtree Women Girl Solid Color Warm Winter Beret French Artist Beanie Hat Ski Cap ...
Headwear-11935863590562703934
86
6.666667
1
1
Headwear
817338107446175204
22
32 Degrees Unisex Waffle Sherpa-Lined Beanie Cement / One Size
Headwear-817338107446175204
79
4.545455
1
1
Headwear
4899234377105272946
23
New Era Men's Basic 59FIFTY Fitted Hat
Headwear-4899234377105272946
78
4.347826
1
1
Headwear
7301941690853903056
25
Ogvpe Leather Cap for Men,Beret HatNewsboy Hat Hunting Fishing Hat Genuine ...
Headwear-7301941690853903056
76
4
1
1
Headwear
1452451141248393208
26
Holzlrgus Soft Beanies for Women with Brim Berets for Women Bonnet Bucket Hat ...
Headwear-1452451141248393208
75
3.846154
1
1
Headwear
1792207988407807522
27
Hats Scarves & More Fleece Flower Cloche Hat for Women Cancer Headwear Chemo ...
Headwear-1792207988407807522
74
3.703704
1
1
Headwear
735914610780902567
31
Public Lands Adult Core Beanie, Men's, No size, Cream
Headwear-735914610780902567
70
3.225806
1
1
Headwear
8937612644552354208
33
Premium Wear Premium Imports Beanie Hat | Fashion Skully Cap for Men & Women with ...
Headwear-8937612644552354208
68
3.030303
1
1
Headwear
17638024535505005986
35
Varsity Headwear - Soft Front Cashmere Cap Large / Flint Grey
Headwear-17638024535505005986
66
2.857143
1
1
Headwear
3205828546348780345
36
Men's Herringbone Ivy Beret - Goodfellow & Co Light Gray L/XL
Headwear-3205828546348780345
65
2.777778
1
1
Headwear
2617626430832831876
37
Original Beanie Cap Soft Knit Beanie Hat Warm and Durable for Winter
Headwear-2617626430832831876
64
2.702703
1
1
Headwear
9752397432678938063
38
Walbest Men Summer Beret Vintage British Style Solid Color Adjustable Men Beret ...
Headwear-9752397432678938063
63
2.631579
1
1
Headwear
9308404347986798928
40
Pileus Society Logo Men's Knit Soft Headwear Warm Beanie Cap Black / One Size
Headwear-9308404347986798928
61
2.5
1
1
Headwear
7206407142812522904
41
Buy Alpine Beanie Online - Men's Alpine Beanie | Slyk Shades
Headwear-7206407142812522904
60
2.439024
1
1
Headwear
15736111962927253722
45
CAPLORD Satin Bonnet Lined Sleeping Beanie Hat Bamboo Headwear Frizzy Natural ...
Headwear-15736111962927253722
56
2.222222
1
1
Headwear
3538440574142786899
49
KANGOLS American Style Kangaroo Wool Felt Baseball Cap Hat - High Quality Real ...
Headwear-3538440574142786899
52
2.040816
1
1
Headwear
10926403348807879962
54
Haxmnou Womens Knit Cap Big Head Hat Striped Beanie Soft Knit Slouchy Wool Hats ...
Headwear-10926403348807879962
47
1.851852
1
1
Headwear
13728041998137728267
55
Stylish Fedora Hat with Removable Band - Ideal for Outdoor Activities Navy Blue ...
Headwear-13728041998137728267
46
1.818182
1
1
Headwear
3459600580643463954
56
Stylish Fedora Hats - Trendy Headwear for Every Occasion
Headwear-3459600580643463954
45
1.785714
1
1
Headwear
13926120199729053024
58
Luxury Knitted Beanie for Men and Women - Designer Wool Skull Cap Beanie with ...
Headwear-13926120199729053024
43
1.724138
1
1
Headwear
9793819018988895423
59
Tsalei Y2K Beanie Spider Beanie Double-Layer Knitted Hat Streetwear Headwear ...
Headwear-9793819018988895423
42
1.694915
1
1
Headwear
3554694934184040012
64
Stylish Flat Brim Fedora Hat with Kerchief - Perfect for Outdoors Khaki / F(56-58)
Headwear-3554694934184040012
37
1.5625
1
1
Headwear
1125364535336170582
65
Aviator Hat, Women's, Size: One size, Plaid
Headwear-1125364535336170582
36
1.538462
1
1
Headwear
13751410419774281823
67
Falari 2 Pcs Set Men Women Knitted Beanie Hat Ski Skully Cap Plain Solid Color ...
Headwear-13751410419774281823
34
1.492537
1
1
Headwear
11051157115116284050
68
Winter Outdoor Padded Adjustable Head Circumference Ski Hat Warm Ear Protected ...
Headwear-11051157115116284050
33
1.470588
1
1
Headwear
11069447016055400402
69
Sam's Rock Headwear Womens Fuzzy Fedora w/ Band - Black - Small/Medium, Women's ...
Headwear-11069447016055400402
32
1.449275
1
1
Headwear
11817723355798671884
72
TheLittleTichelLady Quilted Velour Velvet Black Snood for Women, Lined, Comfort ...
Headwear-11817723355798671884
29
1.388889
1
1
Headwear
3650951150364856806
73
Vintage Plaid Wool French Beret Cap for Women - Elegant Autumn/Winter Hat with ...
Headwear-3650951150364856806
28
1.369863
1
1
Headwear
14994117364839869317
74
TheLittleTichelLady Knitted Beret Hat for Women, Multiple Options, Cotton Lurex ...
Headwear-14994117364839869317
27
1.351351
1
1
Headwear
5615261153479895191
76
AMIEHAIRLLC Cover All Head Wrap -Slouchy Beanies Womens Headwear Sleeping Beanies ...
Headwear-5615261153479895191
25
1.315789
1
1
Headwear
8380551919709061072
77
Phaiy Trapper Hat for Men Women, Winter Hats with Ear Flaps, Full Face Windproof ...
Headwear-8380551919709061072
24
1.298701
1
1
Headwear
9971544574648211673
78
Avant Garde x Hysteric Glamour Sports Mountain Casual Hat(Bass Cap)(Headwear)Nike ...
Headwear-9971544574648211673
23
1.282051
1
1
Headwear
16592056343107745334
80
All Seasons Adjustable Size Baseball Cap Men Women - Classic Plain Hat
Headwear-16592056343107745334
21
1.25
1
1
Headwear
3896774111929304768
81
SATINIOR Unisex Trapper Hat Faux Fur Plaid Earflaps Hat with Chin Strap Winter ...
Headwear-3896774111929304768
20
1.234568
1
1
Headwear
4193925760910049939
82
Premium Adjustable Baseball Caps for Men and Women - Hat for Hikers and Bikers
Headwear-4193925760910049939
19
1.219512
1
1
Headwear
4447283968085914541
83
KUTTOR 3 Pack Winter Knitted Beanie Hats Fleece Lined Skull Cap Beanie Knit Cap ...
Headwear-4447283968085914541
18
1.204819
1
1
Headwear
5240328768853761343
84
High-Quality Luxury High Profile Baseball Caps for Men and Women - Perfect for ...
Headwear-5240328768853761343
17
1.190476
1
1
Headwear
17562995262093511933
85
SATINIOR 5 Pieces Women's Slouchy Beanie Hat Stretch Turban Hats Cancer Headwear ...
Headwear-17562995262093511933
16
1.176471
1
1
Headwear
3160150270946096832
87
Vgogfly Cuffed Beanie for Men Women Knit Skull Cap Warm Stocking Hats Guys Winter ...
Headwear-3160150270946096832
14
1.149425
1
1
Headwear
9248380297141505312
88
ROYBENS Swag Wool Knit Cuff Short Fisherman Beanie for Men Women, Winter Warm Hats
Headwear-9248380297141505312
13
1.136364
1
1
Headwear
2593991184963288918
89
Syhood 4 Pieces Men Skull Caps Soft Cotton Beanie Hats Stretchy Helmet Liner ...
Headwear-2593991184963288918
12
1.123596
1
1
Headwear
18122823158732415057
90
Zowya Winter Visor Beanie Hat for Men & Women Brim Knit Skully Hats Billed Skull ...
Headwear-18122823158732415057
11
1.111111
1
1
Headwear
827153107425860427
91
Habiter Knit Beanie Hat for Men Women Warm Cute Beanie for Winter
Headwear-827153107425860427
10
1.098901
1
1

Marqo-GS-10M

This dataset is our multimodal, fine-grained, ranking Google Shopping dataset, Marqo-GS-10M, followed by our novel training framework: Generalized Contrastive Learning (GCL). GCL aims to improve and measure the ranking performance of information retrieval models, especially for retrieving relevant products given a search query.

Blog post: https://www.marqo.ai/blog/generalized-contrastive-learning-for-multi-modal-retrieval-and-ranking

Paper: https://arxiv.org/pdf/2404.08535.pdf

GitHub: https://github.com/marqo-ai/GCL

from datasets import load_dataset

ds = load_dataset("Marqo/marqo-GS-10M")

Questions?

If you have any questions about this dataset, please join our Community and ask one of our team!

Slack Community: https://join.slack.com/t/marqo-community/shared_invite/zt-2b4nsvbd2-TDf8agPszzWH5hYKBMIgDA

Table of Content

  1. Motivation
  2. Dataset and Benchmarks
  3. Instructions to evaluate with the GCL Benchmarks
  4. GCL Training Framwork and Models
  5. Example Usage of Models

1. Motivation

Contrastive learning has gained widespread adoption for retrieval tasks due to its minimal requirement for manual annotations. However, popular contrastive frameworks typically learn from binary relevance, making them ineffective at incorporating direct fine-grained rankings.

In this paper, we curate a large-scale dataset: Marqo-GS-10M, featuring detailed relevance scores for each query-document pair to facilitate future research and evaluation.

Subsequently, we propose Generalized Contrastive Learning for Multi-Modal Retrieval and Ranking (GCL), which is designed to learn from fine-grained rankings beyond binary relevance score.

Our results show that GCL achieves a 94.5% increase in NDCG@10 for in-domain and 26.3 to 48.8% increases for cold-start evaluations, measured relative to the CLIP baseline within our curated ranked dataset.

2. Dataset and Benchmarks

Dataset Structure

multi split visual

Illustration of multi-dimensional split along both query and document dimensions resulting in 4 splits: training split with 80% of queries and 50% of documents, novel query splitwith the other 20% of queries and the same documents as the training split, novel corpus split with the same queries as the training split and unseen documents with the equal size of the training corpus, and zero-shot split with unseen queries and documents.

Dataset Structure

In this section, we show the dataset structure.

marqo-gs-dataset/
β”œβ”€β”€ marqo_gs_full_10m/
β”‚   β”œβ”€β”€ corpus_1.json
β”‚   β”œβ”€β”€ corpus_2.json
β”‚   β”œβ”€β”€ query_0_product_id_0.csv
β”‚   β”œβ”€β”€ query_0_product_id_0_gt_dev.json
β”‚   β”œβ”€β”€ query_0_product_id_0_gt_test.json
β”‚   β”œβ”€β”€ query_0_product_id_0_queries.json
β”‚   β”œβ”€β”€ query_0_product_id_1.csv
β”‚   β”œβ”€β”€ query_0_product_id_1_gt_dev.json
β”‚   β”œβ”€β”€ query_0_product_id_1_gt_test.json
β”‚   β”œβ”€β”€ query_0_product_id_1_queries.json
β”‚   β”œβ”€β”€ query_1_product_id_0.csv
β”‚   β”œβ”€β”€ query_1_product_id_0_gt_dev.json
β”‚   β”œβ”€β”€ query_1_product_id_0_gt_test.json
β”‚   β”œβ”€β”€ query_1_product_id_0_queries.json
β”‚   β”œβ”€β”€ query_1_product_id_1.csv
β”‚   β”œβ”€β”€ query_1_product_id_1_gt_dev.json
β”‚   β”œβ”€β”€ query_1_product_id_1_gt_test.json
β”‚   └── query_1_product_id_1_queries.json
β”œβ”€β”€ marqo_gs_fashion_5m/
β”œβ”€β”€ marqo_gs_wfash_1m/

For each dataset such as marqo_gs_full_10m, there are 4 splits as discussed before.

  • query_0_product_id_0 represents in-domain set,
  • query_1_product_id_0 represents novel query set,
  • query_0_product_id_1 represents novel document set,
  • query_1_product_id_1 represents zero shot set, For each split, there is a ground truth csv containing triplet information, a set of validation ground truth and a set of test ground truth.

Dataset Downloads

The Marqo-GS-10M dataset is available for direct download. This dataset is pivotal for training and benchmarking in Generalized Contrastive Learning (GCL) frameworks and other multi-modal fine-grained ranking tasks.

You can use the dataset with Hugging Face's datasets:

from datasets import load_dataset

ds = load_dataset("Marqo/marqo-GS-10M")

Alternatively:

  • Full Dataset: Download - Link contains the entire Marqo-GS-10M dataset except for the images.
  • Full Images: Download - Link contains the images of the entire Marqo-GS-10M dataset.
  • Sample Images: Download - Link contains the images for woman fashion category, it corresponds to the woman fashion sub-dataset.

Dataset Visualization

Visualization of the collected triplet dataset containing search queries (top row), documents and scores, showcasing thumbnails of returned products with scores that decrease linearly according to their positions. Dataset Qualitative

3. Instructions to use the GCL Benchmarks

Install environment

conda create -n gcl python=3.8
conda activate gcl
conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
pip install jupyterlab pandas matplotlib beir pytrec_eval braceexpand webdataset wandb notebook open_clip_torch
pip install --force-reinstall numpy==1.23.2

Evaluate using GCL benchmarks

  1. Download the Dataset, links above. We recommend try out the Sample set first.
  2. Either prepare your own model or download our finetuned model down below.
  3. Modify eval-vitb32-ckpt.sh to add image dir, eval dir and model path.
  4. Use change_image_paths.py to modify image paths in the csv.
python change_image_paths.py /dataset/csv/dir/path /image/root/path
# Example:
python change_image_paths.py /data/marqo-gs-dataset/marqo_gs_wfash_1m /data/marqo-gs-dataset/images_wfash
  1. Run the eval script:
bash ./scripts/eval-vitb32-ckpt.sh

4. GCL Training Framework and Models

Main Figure Overview of our Generalized Contrastive Learning (GCL) approach. GCL integrates ranking information alongside multiple input fields for each sample (e.g., title and image) across both left-hand-side (LHS) and right-hand-side (RHS). Ground-truth ranking scores are transformed into weights, which are used for computing contrastive losses, ensuring that pairs with higher weights incur greater penalties. Please refer to the paper for full explanation.

Results and Model Downloads

Retrieval and ranking performance comparison of GCL versus publicly available contrastive learning methods assessed by NDCG@10, ERR, and RBP metrics on the GSFull-10M dataset for the In-Domain category. The methods are based on multi-modal approaches:

Multi-Field/Text-Image

Methods Models Size nDCG ERR RBP Downloads
CLIP ViT-L-14 1.6G 0.310 0.093 0.252 model
GCL (ours) ViT-B-32 577M 0.577 0.554 0.446 model
GCL (ours) ViT-L-14 1.6G 0.603 0.562 0.467 model
GCL (ours) ViT-B-32 577M 0.683 0.689 0.515 model
GCL (ours) ViT-L-14 1.6G 0.690 0.630 0.535 model

Text-only

Methods Models nDCG ERR RBP Downloads
BM25 - 0.071 0.028 0.052
E5 e5-large-v2 0.335 0.095 0.289
Cross Entropy xlm-roberta-base-ViT-B-32 0.332 0.099 0.288
GCL (ours) e5-large-v2 0.431 0.400 0.347 model
GCL (ours) xlm-roberta-base-ViT-B-32 0.441 0.404 0.355 model
E5 e5-large-v2 0.470 0.457 0.374 Marqo/marqo-gcl-e5-large-v2-130

5. Example Usage of Models

Quick Demo with OpenCLIP

Here is a quick example to use our model if you have installed open_clip_torch.

python demos/openclip_demo.py 

or

import torch
from PIL import Image
import open_clip
import wget

model_url = "https://marqo-gcl-public.s3.us-west-2.amazonaws.com/v1/gcl-vitb32-117-gs-full-states.pt"
wget.download(model_url, "gcl-vitb32-117-gs-full-states.pt")
model, _, preprocess = open_clip.create_model_and_transforms('ViT-B-32', pretrained='gcl-vitb32-117-gs-full-states.pt')
tokenizer = open_clip.get_tokenizer('ViT-B-32')

image = preprocess(Image.open('https://raw.githubusercontent.com/marqo-ai/GCL/main/assets/oxford_shoe.png')).unsqueeze(0)
text = tokenizer(["a dog", "Vintage Style Women's Oxfords", "a cat"])
logit_scale = 10
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 = (logit_scale * image_features @ text_features.T).softmax(dim=-1)

print("Label probs:", text_probs)

Quick Demo with Hugging Face for E5 models.

Here is a quick example to load our finetuned e5 text models from Hugging Face directly.

import torch.nn.functional as F

from torch import Tensor
from transformers import AutoTokenizer, AutoModel


def average_pool(last_hidden_states: Tensor,
                 attention_mask: Tensor) -> Tensor:
    last_hidden = last_hidden_states.masked_fill(~attention_mask[..., None].bool(), 0.0)
    return last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]


# Each input text should start with "query: " or "passage: ".
# For tasks other than retrieval, you can simply use the "query: " prefix.
input_texts = ['query: Espresso Pitcher with Handle',
               'query: Women’s designer handbag sale',
               "passage: Dianoo Espresso Steaming Pitcher, Espresso Milk Frothing Pitcher Stainless Steel",
               "passage: Coach Outlet Eliza Shoulder Bag - Black - One Size"]

tokenizer = AutoTokenizer.from_pretrained('Marqo/marqo-gcl-e5-large-v2-130')
model_new = AutoModel.from_pretrained('Marqo/marqo-gcl-e5-large-v2-130')

# Tokenize the input texts
batch_dict = tokenizer(input_texts, max_length=77, padding=True, truncation=True, return_tensors='pt')

outputs = model_new(**batch_dict)
embeddings = average_pool(outputs.last_hidden_state, batch_dict['attention_mask'])

# normalize embeddings
embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:2] @ embeddings[2:].T) * 100
print(scores.tolist())

Citation

@misc{zhu2024generalized,
      title={Generalized Contrastive Learning for Multi-Modal Retrieval and Ranking}, 
      author={Tianyu Zhu and Myong Chol Jung and Jesse Clark},
      year={2024},
      eprint={2404.08535},
      archivePrefix={arXiv},
      primaryClass={cs.IR}
}
Downloads last month
2,594
Edit dataset card

Spaces using Marqo/marqo-GS-10M 3

Collection including Marqo/marqo-GS-10M