| --- |
| license: other |
| task_categories: |
| - image-classification |
| - zero-shot-image-classification |
| tags: |
| - face-recognition |
| - face-verification |
| - lfw |
| - imagefolder |
| pretty_name: LFW HF-ready |
| size_categories: |
| - 10K<n<100K |
| --- |
| |
| # LFW HF-ready |
|
|
| This folder packages the local LFW (Labeled Faces in the Wild) images as a |
| Hugging Face `imagefolder` dataset with the canonical 10-fold verification |
| pairs file. |
|
|
| ## Layout |
|
|
| ``` |
| lfw/ |
| ├── README.md |
| ├── pairs.csv |
| └── train/ |
| ├── images/<shard>/<file>.jpg |
| └── metadata.csv |
| ``` |
|
|
| ## metadata.csv columns |
|
|
| - `file_name`: relative image path used by `ImageFolder`, e.g. `images/000/Aaron_Eckhart_0001.jpg`. |
| - `label`: numeric identity label. |
| - `label_name` / `identity`: identity name. |
| - `image_num`: per-identity image index from the original filename (1-based). |
| - `source_filename`: original LFW filename. |
|
|
| ## pairs.csv columns |
|
|
| `pairs.csv` mirrors the official LFW `pairs.txt` (10 folds x 300 positive + |
| 300 negative = 6000 verification pairs). |
|
|
| - `pair_id` (0..5999), `fold_id` (1..10), `fold_position` (0..299). |
| - `is_same`: 1 for positive pairs (same identity), 0 for negatives. |
| - `image_a`, `image_b`: bare filenames (e.g. `Abel_Pacheco_0001.jpg`). |
| - `image_a_path`, `image_b_path`: paths under the `train` split. |
|
|
| ## Local Stats |
|
|
| - Images: 13233 |
| - Unique identities: 5749 |
| - Identities with one image: 4069 |
| - Verification pairs: 6000 (3000 positive / 3000 negative) |
| - Folds: 10 x 600 pairs |
|
|
| ## Loading |
|
|
| ```python |
| from datasets import load_dataset |
| |
| ds = load_dataset("imagefolder", data_dir="data/evaluation/huggingface/lfw") |
| train = ds["train"] |
| ``` |
|
|
| ```python |
| import pandas as pd |
| |
| pairs = pd.read_csv("data/evaluation/huggingface/lfw/pairs.csv") |
| ``` |
|
|
| ## Notes |
|
|
| LFW is described by its authors as an unconstrained face verification benchmark. |
| The images here are the original (non-aligned) drop. Check the original dataset |
| terms before publishing or redistributing it. |
|
|