File size: 3,589 Bytes
5f5554c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b10648a
 
 
5f5554c
 
 
 
 
 
 
 
 
b10648a
5f5554c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
license: apache-2.0
task_categories:
  - image-classification
  - zero-shot-image-classification
language:
  - bg
  - cs
  - el
  - hr
  - hu
  - pl
  - ro
  - sk
tags:
  - e-commerce
  - duplicate-detection
  - entity-resolution
  - multimodal
size_categories:
  - 1M<n<10M
configs:
  - config_name: images
    default: true
    data_files:
      - split: train
        path: images/shard-*.parquet
  - config_name: items
    data_files:
      - split: train
        path: items_train.csv
      - split: test
        path: items_test.csv
  - config_name: splits
    data_files:
      - split: train
        path: train_split.csv
      - split: validation
        path: val_split.csv
  - config_name: groups
    data_files:
      - split: g5
        path: groups_5.csv
      - split: g6
        path: groups_6.csv
      - split: g7
        path: groups_7.csv
      - split: g8
        path: groups_8.csv
      - split: g9
        path: groups_9.csv
      - split: g10
        path: groups_10.csv
      - split: hard_5
        path: groups_hard_5.csv
      - split: category_5
        path: groups_category_5.csv
---

# GLAMI Duplication Detection

Product-duplicate detection over GLAMI e-commerce listings: ~1.3M product
images plus multilingual titles, descriptions and attributes, with labelled
groups of items that do or do not refer to the same physical product.

Released under the Apache License 2.0 — see [LICENSE](LICENSE).

> TODO: describe how the labels were produced.

## Structure

| Config | Files | Contents |
| --- | --- | --- |
| `images` | `images/shard-*.parquet` | `itemId` → image bytes, one row per product image |
| `items` | `items_train.csv`, `items_test.csv` | `itemId`, `price`, `colorTagIdsString`, `departmentIds`, `brandEditionTagId`, `title`, `description`, `geo`, and `label` on train |
| `splits` | `train_split.csv`, `val_split.csv` | train/validation partition of the training items |
| `groups` | `groups_*.csv` | `item1..itemN`, `label` — candidate groups of 5–10 items, plus `hard_` and `category_` adversarial variants |

Images are keyed by `itemId` alone and are not pre-split. Every other file
references `itemId`, so all of them join against the same image table and no
picture is stored twice.

## Usage

```python
from datasets import load_dataset

images = load_dataset("zidcenek/GLAMI-Entity-Matching-Dataset", "images", split="train")
items  = load_dataset("zidcenek/GLAMI-Entity-Matching-Dataset", "items",  split="train")
groups = load_dataset("zidcenek/GLAMI-Entity-Matching-Dataset", "groups", split="g5")

images[0]["image"]    # PIL.Image, decoded lazily
images[0]["itemId"]
```

The image config is ~TODO GB, so stream it if you do not want a full local copy:

```python
images = load_dataset(
    "zidcenek/GLAMI-Entity-Matching-Dataset", "images", split="train", streaming=True
)
```

To attach images to items, build the `itemId` → row-index map once and index into it:

```python
index = {item_id: i for i, item_id in enumerate(images["itemId"])}
row = images[index[items[0]["itemId"]]]
```

## Reproducing the image shards

```bash
pip install -U datasets Pillow "huggingface_hub[hf_xet]"

python scripts/build_image_shards.py --inspect    # check the filename -> itemId mapping
python scripts/build_image_shards.py              # glami_images.tar.gz -> images/shard-*.parquet
hf auth login
python scripts/upload_to_hub.py                   # push to the Hub over HTTP
```

Both scripts are resumable: rerun the same command after an interruption.
See the header of each for the full options.

## Citation

> TODO