Datasets:
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .DS_Store +0 -0
- README.md +160 -0
- gallery/test/images/00001.jpg +3 -0
- gallery/test/images/00002.jpg +3 -0
- gallery/test/images/00003.jpg +3 -0
- gallery/test/images/00004.jpg +3 -0
- gallery/test/images/00005.jpg +3 -0
- gallery/test/images/00006.jpeg +3 -0
- gallery/test/images/00007.jpg +3 -0
- gallery/test/images/00008.jpg +3 -0
- gallery/test/images/00009.jpg +3 -0
- gallery/test/images/00010.webp +3 -0
- gallery/test/images/00011.webp +3 -0
- gallery/test/images/00012.jpg +3 -0
- gallery/test/images/00013.jpg +3 -0
- gallery/test/images/00014.webp +3 -0
- gallery/test/images/00015.webp +3 -0
- gallery/test/images/00016.webp +3 -0
- gallery/test/images/00017.jpg +3 -0
- gallery/test/images/00018.webp +3 -0
- gallery/test/images/00019.webp +3 -0
- gallery/test/images/00020.jpg +3 -0
- gallery/test/images/00021.png +3 -0
- gallery/test/images/00022.jpeg +3 -0
- gallery/test/images/00023.jpg +3 -0
- gallery/test/images/00024.jpg +3 -0
- gallery/test/images/00025.png +3 -0
- gallery/test/images/00026.webp +3 -0
- gallery/test/images/00027.jpg +3 -0
- gallery/test/images/00028.jpg +3 -0
- gallery/test/images/00029.jpg +3 -0
- gallery/test/images/00030.jpg +3 -0
- gallery/test/images/00031.jpg +3 -0
- gallery/test/images/00032.jpg +3 -0
- gallery/test/images/00033.jpg +3 -0
- gallery/test/images/00034.jpg +3 -0
- gallery/test/images/00035.jpg +3 -0
- gallery/test/images/00036.jpg +3 -0
- gallery/test/images/00037.png +3 -0
- gallery/test/images/00038.jpg +3 -0
- gallery/test/images/00039.jpeg +3 -0
- gallery/test/images/00040.jpg +3 -0
- gallery/test/images/00041.jpg +3 -0
- gallery/test/images/00042.webp +3 -0
- gallery/test/images/00043.jpg +3 -0
- gallery/test/images/00044.jpg +3 -0
- gallery/test/images/00045.jpg +3 -0
- gallery/test/images/00046.png +3 -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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
pretty_name: SnapBench
|
| 5 |
+
tags:
|
| 6 |
+
- multimodal
|
| 7 |
+
- image-text-retrieval
|
| 8 |
+
- retrieval
|
| 9 |
+
- robustness
|
| 10 |
+
- benchmark
|
| 11 |
+
size_categories:
|
| 12 |
+
- 10K<n<100K
|
| 13 |
+
configs:
|
| 14 |
+
- config_name: queries
|
| 15 |
+
data_dir: queries
|
| 16 |
+
default: true
|
| 17 |
+
- config_name: gallery
|
| 18 |
+
data_dir: gallery
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
Source repository: <https://github.com/zrchen03/SnapBench>
|
| 22 |
+
|
| 23 |
+
# SnapBench: Benchmarking Snap-and-Ask Multimodal Retrieval for Mobile Interactions
|
| 24 |
+
|
| 25 |
+
SnapBench is a benchmark for **snap-and-ask** mobile interactions: a user captures a photo and asks a short English question. Each query pairs an image with text; the gallery contains image–caption pairs to retrieve from. The benchmark includes a clean split plus text and image perturbations to simulate real-world query degradation.
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Queries | 1,145 (image + text) |
|
| 30 |
+
| Gallery | 9,085 items (image + caption) |
|
| 31 |
+
| Conditions | 54 (1 clean + 8 text + 45 image perturbations) |
|
| 32 |
+
|
| 33 |
+
This repository ships the clean benchmark in the standard Hugging Face `ImageFolder` format. It includes the clean query and gallery images, retrieval annotations, and perturbation metadata. It does not include evaluation code.
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## What Is Included
|
| 38 |
+
|
| 39 |
+
| Component | Location | Status |
|
| 40 |
+
|---|---|---|
|
| 41 |
+
| Query metadata | `queries/test/metadata.jsonl` | included |
|
| 42 |
+
| Query images | `queries/test/images/` (1,145) | included |
|
| 43 |
+
| Gallery metadata | `gallery/test/metadata.jsonl` (9,085 items) | included |
|
| 44 |
+
| Gallery images | `gallery/test/images/` (9,059 unique images) | included |
|
| 45 |
+
| Text perturbations | `queries/test/metadata.jsonl` → `text_perturbations` | included |
|
| 46 |
+
| Image perturbation specifications | `queries/test/metadata.jsonl` → `image_perturbations` | included |
|
| 47 |
+
| Image perturbation files | 15 types × 3 severity levels × 1,145 queries | **generate locally from the source repository** |
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## Setup
|
| 52 |
+
|
| 53 |
+
Install Hugging Face Datasets:
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
pip install datasets
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Load the two dataset configurations from the Hub:
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
from datasets import load_dataset
|
| 63 |
+
|
| 64 |
+
queries = load_dataset("yefd/SnapBench", "queries", split="test")
|
| 65 |
+
gallery = load_dataset("yefd/SnapBench", "gallery", split="test")
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
To load a local copy of this repository:
|
| 69 |
+
|
| 70 |
+
```python
|
| 71 |
+
from datasets import load_dataset
|
| 72 |
+
|
| 73 |
+
queries = load_dataset(".", "queries", split="test")
|
| 74 |
+
gallery = load_dataset(".", "gallery", split="test")
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
The `file_name` field in each `metadata.jsonl` file is automatically exposed as an `image` column by the Hugging Face `ImageFolder` builder.
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
## Build the Full Benchmark
|
| 82 |
+
|
| 83 |
+
This Hugging Face version already includes the clean benchmark (queries, gallery, and text perturbations). The image perturbation specifications are stored in the `image_perturbations` field of every query. Use the scripts in the source repository to generate all image-perturbed query images locally.
|
| 84 |
+
|
| 85 |
+
### Step 1. Generate image perturbations
|
| 86 |
+
|
| 87 |
+
Clone and set up the source repository:
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
git lfs install
|
| 91 |
+
git clone https://github.com/zrchen03/SnapBench.git SnapBench_raw
|
| 92 |
+
cd SnapBench_raw
|
| 93 |
+
git lfs pull
|
| 94 |
+
pip install -r requirements.txt
|
| 95 |
+
export BENCH_IMAGES_DIR=$(pwd)/bench_images
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Generate 15 perturbation types × 3 severity levels (sev1 / sev2 / sev3) × 1,145 queries = **51,675 images**:
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
python benchmark/gen_image_perturbations.py
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
Output:
|
| 105 |
+
|
| 106 |
+
```
|
| 107 |
+
bench_images/perturbed/{type}/sev{1,2,3}/{query_id}.jpg
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
Preview the workload without writing files:
|
| 111 |
+
|
| 112 |
+
```bash
|
| 113 |
+
python benchmark/gen_image_perturbations.py --dry-run
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
To export the generated images as an additional Hugging Face configuration:
|
| 117 |
+
|
| 118 |
+
```bash
|
| 119 |
+
python benchmark/export_hf_dataset.py --include-perturbed --overwrite
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
### Step 2. (Optional) Regenerate text perturbations
|
| 123 |
+
|
| 124 |
+
Text perturbations are already stored in `queries/test/metadata.jsonl`. Only rerun this in the source repository if you need to rebuild them:
|
| 125 |
+
|
| 126 |
+
```bash
|
| 127 |
+
python benchmark/gen_text_perturbations.py \
|
| 128 |
+
--gpu 0 --chunk-in chunk_0.json --chunk-out result_0.json
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
---
|
| 132 |
+
|
| 133 |
+
## Data Layout
|
| 134 |
+
|
| 135 |
+
```
|
| 136 |
+
SnapBench/
|
| 137 |
+
├── README.md
|
| 138 |
+
├── queries/
|
| 139 |
+
│ └── test/
|
| 140 |
+
│ ├── metadata.jsonl
|
| 141 |
+
│ └── images/ # 1,145 query images
|
| 142 |
+
└── gallery/
|
| 143 |
+
└── test/
|
| 144 |
+
├── metadata.jsonl
|
| 145 |
+
└── images/ # 9,059 unique gallery images
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
The dataset exposes two configurations, both with a `test` split:
|
| 149 |
+
|
| 150 |
+
- `queries`: clean query images and text, positive and hard-negative gallery IDs, and all text/image perturbation metadata.
|
| 151 |
+
- `gallery`: image–caption retrieval candidates. It has 9,085 items backed by 9,059 unique image files because some images have more than one caption.
|
| 152 |
+
|
| 153 |
+
Important fields:
|
| 154 |
+
|
| 155 |
+
- Query image: `queries/test/metadata.jsonl` → `file_name` (loaded as `image`)
|
| 156 |
+
- Query text: `text`
|
| 157 |
+
- Positive gallery items: `positive_gallery_ids`
|
| 158 |
+
- Hard negatives: `hard_negative_gallery_ids`
|
| 159 |
+
- Gallery image: `gallery/test/metadata.jsonl` → `file_name` (loaded as `image`)
|
| 160 |
+
- Gallery caption: `caption`
|
gallery/test/images/00001.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00002.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00003.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00004.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00005.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00006.jpeg
ADDED
|
Git LFS Details
|
gallery/test/images/00007.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00008.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00009.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00010.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00011.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00012.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00013.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00014.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00015.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00016.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00017.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00018.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00019.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00020.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00021.png
ADDED
|
Git LFS Details
|
gallery/test/images/00022.jpeg
ADDED
|
Git LFS Details
|
gallery/test/images/00023.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00024.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00025.png
ADDED
|
Git LFS Details
|
gallery/test/images/00026.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00027.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00028.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00029.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00030.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00031.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00032.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00033.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00034.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00035.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00036.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00037.png
ADDED
|
Git LFS Details
|
gallery/test/images/00038.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00039.jpeg
ADDED
|
Git LFS Details
|
gallery/test/images/00040.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00041.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00042.webp
ADDED
|
Git LFS Details
|
gallery/test/images/00043.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00044.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00045.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00046.png
ADDED
|
Git LFS Details
|
gallery/test/images/00047.jpg
ADDED
|
Git LFS Details
|
gallery/test/images/00048.jpg
ADDED
|
Git LFS Details
|