File size: 1,690 Bytes
8d960ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# YFCC50K Photo Corpus Scripts

Pipeline for curating, fetching, and uploading the Lightcella photo corpus
from the YFCC100M dataset.

## Pipeline

### Step 1: Curate (`curate_manifest.py`)

Selects 50k photos from YFCC100M with date/GPS/resolution stratification.

Requires:
- YFCC100M SQLite database (~65GB): `yfcc100m_dataset.sql`
- MediaEval placing subset files (downloaded automatically via AWS CLI)
- Python packages: `yfcc100m`, `opencv-python-headless`, `awscli`

Three phases run sequentially:
1. **Build metadata** -- scans YFCC SQLite for MediaEval placing hashes, extracts GPS/date/Flickr credentials
2. **Select subset** -- stratified sampling by date, GPS, faces, resolution tiers
3. **Upgrade resolution** -- probes Flickr for higher-res versions, assigns fetch tiers

```bash
python curate_manifest.py --db /path/to/yfcc100m_dataset.sql --out-dir ./output
```

Output: `manifest.tsv` (the same format shipped in this repo).

### Step 2: Fetch (`fetch_flickr.py`)

Downloads Flickr originals for manifest entries. Resumable, rate-limit aware.

```bash
python fetch_flickr.py --manifest manifest.tsv --out-dir ./photos
```

Features:
- Classifies Flickr users as alive/dead/unsampled for efficient probing
- Validates JPEG dimensions (skips <501px max edge)
- Restores file mtime from manifest date (fallback for EXIF-less photos)
- Automatic retry with backoff on 429s

### Step 3: Upload (`upload_hf.py`)

Creates ~1GB tar shards and uploads them to HuggingFace.

```bash
python upload_hf.py --src-dir ./photos --repo lightcella/photo-corpus --prefix yfcc
```

Features:
- Resumable (skips already-uploaded shards)
- Deletes local tar after successful upload to save disk