soloface2 / README.md
BidyutSaha's picture
Upload README.md with huggingface_hub
83d20d6 verified
|
Raw
History Blame Contribute Delete
7.33 kB
---
license: cc-by-4.0
task_categories:
- object-detection
- keypoint-detection
language:
- en
pretty_name: SoloFace2
size_categories:
- 100K<n<1M
tags:
- face-detection
- facial-landmarks
- tinyML
- embedded-AI
- single-face
- resource-constrained
- bounding-box
- keypoints
- WIDER-FACE
- COCO
annotations_creators:
- machine-generated
multilinguality:
- monolingual
---
# SoloFace2: A Large-Scale Single-Face Dataset with Landmarks
SoloFace2 is a large-scale face detection and landmark regression dataset
optimized for **resource-constrained deployment** (TinyML, edge AI, microcontrollers).
Every image contains **exactly one visible human face or none at all**,
making it ideal for training lightweight single-face detectors.
## Key Features
- **5 facial landmarks** per face (eyes, nose, mouth corners)
- **Single-face only** — no multi-face ambiguity
- **Stratified splits** — 80/10/10 train/val/test, stratified by face presence
- **5× augmentation** (WIDER FACE, SoloFace train) — geometric + color + crop
- **224×224 JPEGs** — ready-to-train, quality 95
- **Multiple sources** for diversity: studio portraits, natural scenes, crowds, backgrounds
## Dataset Statistics
| Split | Face (p=1) | No-face (p=0) | Total |
|-------|-----------|---------------|-------|
| Train | 46,689 | 67,147 | 113,836 |
| Val | 5,792 | 8,397 | 14,189 |
| Test | 5,909 | 8,387 | 14,296 |
| **Total** | **58,390** | **83,931** | **142,321** |
*Face:No-face = 1:1.44 overall (41% face). Training uses 50/50 batch sampling.*
## Source Composition
| Source | Generator | Face | No-face | Description |
|--------|-----------|------|---------|-------------|
| SoloFace train | RetinaFace | 27,498 | 28,862 | COCO-derived, 5× augmented |
| SoloFace test | YuNet | 1,669 | 180 | COCO-derived, raw images |
| SoloFace val | YuNet | 196 | 21 | COCO-derived, raw images |
| WIDER FACE train | RetinaFace | 22,255 | 0 | Natural scenes, 5× augmented |
| WIDER FACE val | RetinaFace | 5,175 | 0 | Natural scenes, 5× augmented |
| COCO no-person | YuNet | 1,597 | 54,868 | Person-free scenes |
| **Total** | | **58,390** | **83,931** | |
## Label Format
Each image has a corresponding row in `labels.csv`:
| Column | Type | Description |
|--------|------|-------------|
| `image` | str | JPEG filename |
| `p` | int | 1 = face present, 0 = no face |
| `x` | int | Bbox left edge (224×224 pixels) |
| `y` | int | Bbox top edge |
| `w` | int | Bbox width |
| `h` | int | Bbox height |
| `right_eye_x`, `right_eye_y` | int | Right eye center |
| `left_eye_x`, `left_eye_y` | int | Left eye center |
| `nose_x`, `nose_y` | int | Nose tip |
| `right_mouth_x`, `right_mouth_y` | int | Right mouth corner |
| `left_mouth_x`, `left_mouth_y` | int | Left mouth corner |
| `score` | float | Detection confidence (0.0 when p=0) |
**Coordinate space:** All integers are in 224×224 pixel coordinates.
Divide by 224 to normalize to [0, 1].
**Landmark order (subject's perspective):**
0. Right eye | 1. Left eye | 2. Nose tip | 3. Right mouth | 4. Left mouth
## Face Detection Models
Labels were generated by two complementary face detectors:
| Model | Usage | Output |
|-------|-------|--------|
| **RetinaFace** (insightface) | WIDER FACE, SoloFace train | Bbox + 5 landmarks |
| **YuNet** (OpenCV) | SoloFace test/val, COCO | Bbox + 5 landmarks |
Both models target the same 5 anatomical points. The column order is
normalized to YuNet convention in the CSV.
## Data Augmentation (5×)
Applied to WIDER FACE and SoloFace training images (matching original SoloFace):
| Augmentation | Parameters |
|-------------|------------|
| Rotation | ±15° random |
| Scaling | ±20% random |
| Horizontal flip | 50% probability |
| Brightness | ±30% random |
| Contrast | ±30% random |
| Random crop | Up to 10% from edges |
All augmentations preserve bounding box and landmark consistency.
Augmented variants are named `*_aug0.jpg` through `*_aug4.jpg`.
## Splits
Train/val/test splits are 80/10/10, stratified by the `p` column.
The `splits.csv` file maps each image to its split.
```
split_dataset() using sklearn.model_selection.train_test_split
stratify on column p
random_state = 42
train : val : test = 80 : 10 : 10
```
## Download & Extract
Images are split across 5 tar.gz archives (~640 MB each, 3.2 GB total). VGGFace2 images are excluded:
```
images_part_01.tar.gz images_part_03.tar.gz images_part_05.tar.gz
images_part_02.tar.gz images_part_04.tar.gz
```
**Option 1: Extract script (recommended)**
```bash
# Download all images_part_*.tar.gz files, then:
python extract_images.py
```
**Option 2: Manual extraction**
```bash
# Linux/Mac
for f in images_part_*.tar.gz; do tar -xzf "$f"; done
# Windows (PowerShell)
Get-ChildItem images_part_*.tar.gz | ForEach-Object { tar -xzf $_ }
```
## File Structure
```
soloface2/
├── README.md ← This dataset card
├── images/ ← 142,321 JPEG images (224×224, quality 95)
├── images_part_01.tar.gz ← Image archive chunk 1
├── ...
├── images_part_05.tar.gz ← Image archive chunk 5
├── extract_images.py ← Archive extraction script
├── labels.csv ← All labels (image, p, bbox, landmarks, score)
├── splits.csv ← Train/val/test split assignments
└── generate_splits.py ← Split generation script (reproducibility)
```
## Intended Use
1. Training lightweight face detection models for edge deployment
2. Facial landmark regression on resource-constrained hardware
3. Single-face detection benchmarking
4. TinyML model compression and quantization research
5. Privacy-preserving on-device face detection
## Usage
```python
import pandas as pd
from pathlib import Path
from PIL import Image
# Load labels and splits
labels = pd.read_csv("labels.csv")
splits = pd.read_csv("splits.csv")
df = labels.merge(splits, on="image")
# Training subset
train = df[df["split"] == "train"]
row = train.iloc[0]
img = Image.open(f"images/{row['image']}") # 224×224 RGB
# Normalize coordinates to [0, 1]
DATA_SIZE = 224
bbox = [row["x"] / DATA_SIZE, row["y"] / DATA_SIZE,
row["w"] / DATA_SIZE, row["h"] / DATA_SIZE]
kps = [
(row["right_eye_x"] / DATA_SIZE, row["right_eye_y"] / DATA_SIZE),
(row["left_eye_x"] / DATA_SIZE, row["left_eye_y"] / DATA_SIZE),
(row["nose_x"] / DATA_SIZE, row["nose_y"] / DATA_SIZE),
(row["right_mouth_x"] / DATA_SIZE, row["right_mouth_y"] / DATA_SIZE),
(row["left_mouth_x"] / DATA_SIZE, row["left_mouth_y"] / DATA_SIZE),
]
```
## License
| Source | License |
|--------|---------|
| VGGFace2 | Research use only |
| SoloFace | CC BY 4.0 |
| WIDER FACE | Research use |
| COCO 2017 | CC BY 4.0 |
This dataset is for **research purposes only**. Ensure compliance with
VGGFace2 and WIDER FACE terms before commercial use.
## Citation
```bibtex
@dataset{soloface2,
title = {SoloFace2: A Large-Scale Single-Face Dataset with Landmarks},
author = {Saha, Bidyut and Samanta, Riya},
year = {2026},
publisher = {Hugging Face},
note = {Extended from SoloFace (10.5281/zenodo.14474899) with
WIDER FACE and RetinaFace landmarks}
}
```
## Contact
- Bidyut Saha: sahabidyut999@gmail.com
- Riya Samanta: study.riya1792@gmail.com