SorrowTea Claude Sonnet 4.6 commited on
Commit
3fe86bc
·
1 Parent(s): 8142e3e

Restructure as HF Dataset repository

Browse files

- Remove Gradio app.py, requirements.txt, scripts
- Add comprehensive README.md (Dataset Card)
- Add .gitattributes
- Keep test query JSON files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (5) hide show
  1. .gitattributes +1 -0
  2. README.md +179 -0
  3. app.py +0 -257
  4. requirements.txt +0 -1
  5. scripts/package_images.py +0 -44
.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ *.json text eol=lf
README.md ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-retrieval
4
+ - benchmark
5
+ - photobench
6
+ - vision-language
7
+ license: mit
8
+ size_categories:
9
+ - n<1K
10
+ task_categories:
11
+ - image-retrieval
12
+ language:
13
+ - en
14
+ - zh
15
+ ---
16
+
17
+ # PhotoBench-Full
18
+
19
+ PhotoBench-Full provides the **complete raw image collection** and **test queries** for open-ended image retrieval research.
20
+
21
+ > **Leaderboard:** [PhotoBench-Full Leaderboard](https://huggingface.co/spaces/SorrowTea/PhotoBench-Full-LearderBoard)
22
+
23
+ ---
24
+
25
+ ## Dataset Description
26
+
27
+ PhotoBench is an image retrieval benchmark with open-ended natural language queries.
28
+ Unlike the protected version, PhotoBench-Full gives you unrestricted access to the raw images, allowing you to use your own embedding models, caption generators, or agent-based retrieval workflows.
29
+
30
+ This dataset contains:
31
+
32
+ - **Test queries** for 3 albums (English + Chinese)
33
+ - **Raw images** for all 3 albums (available upon request; not included in this repository due to size)
34
+
35
+ | Album | Images | Test Queries | Avg. GT per Query |
36
+ |-------|--------|--------------|-------------------|
37
+ | 1 | ~1,070 | 100 | ~4.5 |
38
+ | 2 | ~1,470 | 100 | ~4.5 |
39
+ | 3 | ~1,050 | 100 | ~4.5 |
40
+
41
+ ---
42
+
43
+ ## Data Format
44
+
45
+ ### Test Queries (`albumN_test.json`)
46
+
47
+ Each file is a JSON array of query objects:
48
+
49
+ ```json
50
+ [
51
+ {
52
+ "query_cn": "摆满的书桌",
53
+ "query_en": "cluttered desk"
54
+ },
55
+ {
56
+ "query_cn": "紫毛衣女孩",
57
+ "query_en": "girl in purple sweater"
58
+ }
59
+ ]
60
+ ```
61
+
62
+ | Field | Type | Description |
63
+ |------------|--------|------------------------------------------|
64
+ | `query_cn` | string | Query text in Chinese |
65
+ | `query_en` | string | Query text in English (primary language) |
66
+
67
+ ### Raw Images
68
+
69
+ The raw images (`album1/`, `album2/`, `album3/`) contain the full-resolution original photos.
70
+
71
+ **Total size:** ~11 GB
72
+ **Format:** JPEG
73
+ **Naming:** Original camera filenames (e.g., `IMG_1234.JPG`, `FullSizeRender.JPG`)
74
+
75
+ > Raw images are not hosted in this repository due to size constraints. Please contact the authors or use the download instructions below.
76
+
77
+ ---
78
+
79
+ ## How to Use
80
+
81
+ ### 1. Download Test Queries
82
+
83
+ The test query JSON files are available directly in this repository:
84
+
85
+ ```bash
86
+ # Via huggingface_hub CLI
87
+ huggingface-cli download SorrowTea/PhotoBench-Full-HF --repo-type dataset --local-dir ./photobench-full
88
+ ```
89
+
90
+ Or browse and download individual files from the **Files** tab above.
91
+
92
+ ### 2. Download Raw Images
93
+
94
+ Raw images are distributed separately. Contact the authors for access, or prepare the images according to the album structure:
95
+
96
+ ```
97
+ raw_albums/
98
+ ├── album1/
99
+ │ ├── IMG_0001.JPG
100
+ │ ├── IMG_0002.JPG
101
+ │ └── ...
102
+ ├── album2/
103
+ └── album3/
104
+ ```
105
+
106
+ ### 3. Build Your Retrieval System
107
+
108
+ With the raw images and test queries, you can:
109
+
110
+ - Extract image embeddings with any vision encoder (CLIP, SigLIP, etc.)
111
+ - Generate captions with any VLM (GPT-4V, Qwen-VL, etc.)
112
+ - Design multi-step agent workflows
113
+ - Evaluate with your own metrics
114
+
115
+ ### 4. Submit to Leaderboard
116
+
117
+ Prepare your predictions in the submission format and upload to the [PhotoBench-Full Leaderboard](https://huggingface.co/spaces/SorrowTea/PhotoBench-Full-LearderBoard).
118
+
119
+ **Submission format:**
120
+
121
+ ```json
122
+ [
123
+ {
124
+ "album_id": "1",
125
+ "query_en": "cluttered desk",
126
+ "pred": ["IMG_1234.JPG", "IMG_5678.JPG", "IMG_9012.JPG"]
127
+ }
128
+ ]
129
+ ```
130
+
131
+ Requirements:
132
+ - `album_id`: "1", "2", or "3"
133
+ - `query_en`: Must match the test query exactly
134
+ - `pred`: Ordered list of predicted image filenames
135
+
136
+ ---
137
+
138
+ ## Evaluation
139
+
140
+ The leaderboard computes the following metrics:
141
+
142
+ | Metric | Description |
143
+ |------------|----------------------------------------------------|
144
+ | Recall@k | Proportion of ground-truth images in top-k |
145
+ | NDCG@k | Normalized Discounted Cumulative Gain at rank k |
146
+
147
+ Supported k values: **1, 5, 10, 20, 50, 100**
148
+
149
+ Results are averaged per album, then averaged across albums for the final score.
150
+
151
+ Only **full submissions** (all 3 albums, all queries) are eligible for public leaderboard ranking.
152
+
153
+ ---
154
+
155
+ ## Citation
156
+
157
+ If you use PhotoBench-Full in your research, please cite:
158
+
159
+ ```bibtex
160
+ @misc{photobench2026,
161
+ title={PhotoBench},
162
+ year={2026},
163
+ eprint={2603.01493},
164
+ archivePrefix={arXiv},
165
+ primaryClass={cs.CV}
166
+ }
167
+ ```
168
+
169
+ ---
170
+
171
+ ## License
172
+
173
+ This dataset is released under the MIT License.
174
+
175
+ ---
176
+
177
+ ## Contact
178
+
179
+ For questions or data access requests, please open an issue on this repository or contact the authors.
app.py DELETED
@@ -1,257 +0,0 @@
1
- import json
2
- from pathlib import Path
3
-
4
- import gradio as gr
5
-
6
- DATA_DIR = Path(__file__).parent / "data"
7
- TEST_DIR = DATA_DIR / "test"
8
- IMAGES_DIR = DATA_DIR / "images"
9
- PERSISTENT_IMAGES = Path("/data/images")
10
-
11
- LEADERBOARD_URL = "https://huggingface.co/spaces/SorrowTea/PhotoBench-Full-LearderBoard"
12
-
13
- TITLE = """
14
- <div style="text-align:center; padding: 48px 20px; background: linear-gradient(160deg, #faf8f5 0%, #f5f0eb 100%); border-radius: 20px; margin-bottom: 32px; border: 1px solid #e8e0d8;">
15
- <h1 style="color:#1a1a1a; font-size:3em; font-weight:600; letter-spacing:-1px; margin:0; font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;">
16
- PhotoBench-Full
17
- </h1>
18
- <p style="color:#F37021; font-size:1.1em; font-weight:500; letter-spacing:2px; margin:12px 0 0 0;">
19
- DATASET DOWNLOAD
20
- </p>
21
- <div style="width:60px; height:3px; background:#F37021; margin:20px auto; border-radius:2px;"></div>
22
- <p style="color:#666; font-size:0.95em; margin-top:12px;">
23
- Open-ended Image Retrieval Benchmark — Raw Images & Test Queries
24
- </p>
25
- </div>
26
- """
27
-
28
- INTRO = """
29
- <div style="text-align:center; max-width:720px; margin:0 auto 40px; color:#444; line-height:1.8;">
30
-
31
- PhotoBench-Full provides the <strong>complete raw image collection</strong> and <strong>test queries</strong> for unrestricted image retrieval research.
32
-
33
- <p style="margin-top:16px;">
34
- After downloading the data, you can develop your own retrieval approach and submit results to the
35
- <a href="{url}" target="_blank" style="color:#F37021; font-weight:600; text-decoration:none;">PhotoBench-Full Leaderboard ↗</a>.
36
- </p>
37
-
38
- </div>
39
- """.format(url=LEADERBOARD_URL)
40
-
41
- custom_css = """
42
- /* Apple-inspired modern clean theme */
43
- body {
44
- background: #faf8f5 !important;
45
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
46
- font-size: 17px !important;
47
- }
48
-
49
- /* Primary buttons */
50
- .gr-button-primary {
51
- background: #F37021 !important;
52
- border: none !important;
53
- border-radius: 10px !important;
54
- color: #fff !important;
55
- font-weight: 600 !important;
56
- font-size: 0.95em !important;
57
- padding: 12px 28px !important;
58
- transition: all 0.25s ease !important;
59
- }
60
-
61
- .gr-button-primary:hover {
62
- background: #e5631a !important;
63
- transform: translateY(-1px) !important;
64
- box-shadow: 0 6px 20px rgba(243,112,33,0.25) !important;
65
- }
66
-
67
- /* Markdown */
68
- .markdown-text {
69
- max-width: 780px;
70
- margin: 0 auto;
71
- color: #333;
72
- line-height: 1.8;
73
- font-size: 1.05em;
74
- }
75
-
76
- /* Download cards */
77
- .download-card {
78
- background: #fff;
79
- border-radius: 14px;
80
- border: 1px solid #e8e0d8;
81
- padding: 24px;
82
- margin-bottom: 16px;
83
- box-shadow: 0 2px 16px rgba(0,0,0,0.04);
84
- }
85
-
86
- .download-card h3 {
87
- margin-top: 0;
88
- color: #1a1a1a;
89
- font-weight: 600;
90
- font-size: 1.1em;
91
- }
92
-
93
- .download-card p {
94
- color: #666;
95
- font-size: 0.95em;
96
- margin: 8px 0 16px;
97
- }
98
-
99
- /* Form containers */
100
- .gr-form .gr-box {
101
- border-radius: 14px !important;
102
- background: #fff !important;
103
- border: 1px solid #e8e0d8 !important;
104
- padding: 24px !important;
105
- }
106
-
107
- /* Labels */
108
- .gr-input-label, .gr-dropdown-label {
109
- font-weight: 500 !important;
110
- color: #444 !important;
111
- font-size: 0.9em !important;
112
- margin-bottom: 6px !important;
113
- }
114
- """
115
-
116
-
117
- def get_test_files():
118
- """Return list of available test JSON files."""
119
- files = []
120
- if TEST_DIR.exists():
121
- for f in sorted(TEST_DIR.glob("album*_test.json")):
122
- files.append(str(f))
123
- return files
124
-
125
-
126
- def get_image_archives():
127
- """Return list of available image zip archives."""
128
- archives = []
129
- for d in [IMAGES_DIR, PERSISTENT_IMAGES]:
130
- if d.exists():
131
- for f in sorted(d.glob("album*.zip")):
132
- archives.append(str(f))
133
- return archives
134
-
135
-
136
- def load_test_preview(filepath):
137
- """Load first few entries of a test JSON for preview."""
138
- try:
139
- with open(filepath, "r", encoding="utf-8") as f:
140
- data = json.load(f)
141
- return data[:5]
142
- except Exception as e:
143
- return {"error": str(e)}
144
-
145
-
146
- # Build UI
147
- with gr.Blocks(css=custom_css, title="PhotoBench-Full Download") as demo:
148
- gr.HTML(TITLE)
149
- gr.Markdown(INTRO, elem_classes="markdown-text")
150
-
151
- # ---- Test Queries Section ----
152
- gr.Markdown("""
153
- ### Test Queries
154
-
155
- Each album contains English and Chinese test queries. Download the JSON files to build your retrieval system.
156
- """)
157
-
158
- test_files = get_test_files()
159
- if test_files:
160
- for tf in test_files:
161
- name = Path(tf).name
162
- album_id = name.replace("album", "").replace("_test.json", "")
163
- with gr.Row():
164
- with gr.Column(scale=1):
165
- pass
166
- with gr.Column(scale=3):
167
- with gr.Row():
168
- with gr.Column():
169
- gr.Markdown(f"""
170
- <div class="download-card">
171
- <h3>Album {album_id}</h3>
172
- <p>Test queries ({name}) — contains query_en and query_cn for each test case.</p>
173
- </div>
174
- """)
175
- with gr.Column():
176
- gr.File(value=tf, label=f"Download {name}", interactive=False)
177
- with gr.Column(scale=1):
178
- pass
179
- else:
180
- gr.Markdown("*Test query files not found. Please ensure data/test/album*_test.json exist.*")
181
-
182
- # ---- Images Section ----
183
- gr.Markdown("""
184
- ### Raw Images
185
-
186
- The raw image collections for all 3 albums. These are the original photos used in the benchmark.
187
- """)
188
-
189
- image_archives = get_image_archives()
190
- if image_archives:
191
- for af in image_archives:
192
- name = Path(af).name
193
- album_id = name.replace("album", "").replace(".zip", "")
194
- with gr.Row():
195
- with gr.Column(scale=1):
196
- pass
197
- with gr.Column(scale=3):
198
- with gr.Row():
199
- with gr.Column():
200
- size_mb = Path(af).stat().st_size / (1024 * 1024)
201
- gr.Markdown(f"""
202
- <div class="download-card">
203
- <h3>Album {album_id} Images</h3>
204
- <p>Raw image collection ({name}) — {size_mb:.1f} MB</p>
205
- </div>
206
- """)
207
- with gr.Column():
208
- gr.File(value=af, label=f"Download {name}", interactive=False)
209
- with gr.Column(scale=1):
210
- pass
211
- else:
212
- gr.Markdown("""
213
- <div style="text-align:center; padding: 32px; background:#fff; border-radius:14px; border:1px solid #e8e0d8; max-width:720px; margin:0 auto;">
214
- <p style="color:#666; font-size:1em; line-height:1.8;">
215
- Raw image archives are not yet available on this Space.<br>
216
- Total size: ~11 GB (Album 1: ~5.1 GB, Album 2: ~3.4 GB, Album 3: ~2.4 GB).<br>
217
- Please contact the authors for access or check back later.
218
- </p>
219
- </div>
220
- """)
221
-
222
- # ---- Data Format Reference ----
223
- gr.Markdown("""
224
- ### Data Format
225
-
226
- **Test Query JSON** (`albumN_test.json`):
227
- ```json
228
- [
229
- {
230
- "query_cn": "摆满的书桌",
231
- "query_en": "cluttered desk"
232
- }
233
- ]
234
- ```
235
-
236
- **Submission Format** for the Leaderboard:
237
- ```json
238
- [
239
- {
240
- "album_id": "1",
241
- "query_en": "cluttered desk",
242
- "pred": ["IMG_1234.jpg", "IMG_5678.jpg", ...]
243
- }
244
- ]
245
- ```
246
- """)
247
-
248
- # ---- Footer ----
249
- gr.Markdown(f"""
250
- <div style="text-align:center; margin-top:48px; padding:24px; color:#888; font-size:0.9em;">
251
- Ready to submit? Go to the
252
- <a href="{LEADERBOARD_URL}" target="_blank" style="color:#F37021; font-weight:600; text-decoration:none;">PhotoBench-Full Leaderboard ↗</a>
253
- </div>
254
- """)
255
-
256
-
257
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt DELETED
@@ -1 +0,0 @@
1
- gradio>=4.0
 
 
scripts/package_images.py DELETED
@@ -1,44 +0,0 @@
1
- """
2
- Package raw album images into zip archives for upload to the download Space.
3
-
4
- Usage:
5
- python scripts/package_images.py /path/to/raw_albums /output/dir
6
- """
7
- import argparse
8
- import zipfile
9
- from pathlib import Path
10
-
11
-
12
- def package_album(album_dir: Path, output_dir: Path):
13
- album_name = album_dir.name
14
- zip_path = output_dir / f"{album_name}.zip"
15
-
16
- image_files = sorted([f for f in album_dir.iterdir() if f.is_file() and f.suffix.lower() in (".jpg", ".jpeg", ".png")])
17
-
18
- print(f"Packing {album_name}: {len(image_files)} images -> {zip_path}")
19
-
20
- with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zf:
21
- for img in image_files:
22
- zf.write(img, arcname=img.name)
23
-
24
- size_mb = zip_path.stat().st_size / (1024 * 1024)
25
- print(f" Done: {size_mb:.1f} MB")
26
-
27
-
28
- def main():
29
- parser = argparse.ArgumentParser(description="Package PhotoBench raw albums into zip files.")
30
- parser.add_argument("raw_albums", type=Path, help="Path to raw_albums directory")
31
- parser.add_argument("output_dir", type=Path, help="Output directory for zip files")
32
- args = parser.parse_args()
33
-
34
- args.output_dir.mkdir(parents=True, exist_ok=True)
35
-
36
- for album_dir in sorted(args.raw_albums.glob("album*")):
37
- if album_dir.is_dir():
38
- package_album(album_dir, args.output_dir)
39
-
40
- print("\nAll albums packaged.")
41
-
42
-
43
- if __name__ == "__main__":
44
- main()