| # 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 |
| |