A CLI tool that groups photos and videos by person using offline face recognition.
Project description
face-grouper
A CLI tool that groups photos and videos by person using offline face recognition.
Installation
# Default (dlib backend, photos only)
pipx install face-grouper
# With video support
pipx install "face-grouper[video]"
# With ArcFace support (more accurate, recommended)
pipx install "face-grouper[arcface]"
# With both video + ArcFace
pipx install "face-grouper[video,arcface]"
# Upgrade (core only)
pipx upgrade face-grouper
Compile error? Install CMake first:
brew install cmake(macOS),sudo apt install cmake build-essential(Linux), or Visual Studio Build Tools (Windows).
Don't have pipx? brew install pipx && pipx ensurepath (macOS) or pip install --user pipx && pipx ensurepath (Linux/Windows).
Usage
Photos (fgroup group)
# ⭐ Quick start — named clusters, flat output, include single-photo people
fgroup group ./photos --ref-dir ./refs --output ./sorted --backend arcface --mode rename --min-samples 1
# Basic grouping into person_1/, person_2/, ... subfolders
fgroup group ./photos --output ./sorted
# Pass individual files
fgroup group a.jpg b.jpg c.jpg --output ./sorted
# Disable multi-face export (legacy: one output per photo)
fgroup group ./photos --output ./sorted --no-multi-export
Originals are never modified. Supported formats: .jpg .jpeg .png .webp .bmp
Videos (fgroup video)
# Group short clips by person
fgroup video ./clips --output ./sorted
# Allow longer videos (default 15s, max 120s)
fgroup video ./clips --output ./sorted --max-duration 30
# Use ArcFace for better accuracy
fgroup video ./clips --output ./sorted --backend arcface
# Preview without copying
fgroup video ./clips --output ./sorted --dry-run
Supported formats: .mp4 .mov .avi .mkv. Requires pip install 'face-grouper[video]'.
Videos exceeding --max-duration are skipped and copied to output/skipped/. A video with multiple people is copied into each relevant person folder.
Parameters
Common parameters (fgroup group and fgroup video)
| Option | Default | Description |
|---|---|---|
INPUTS... |
(required) | Directories or files to scan (recursive) |
--output / -o |
(required) | Output directory |
--backend |
dlib |
Face recognition backend. dlib: fast, 128-D embeddings, works offline, good for frontal faces — pair with --model cnn for better accuracy. arcface: 512-D embeddings, more accurate across varied lighting/angles, but downloads around 300 MB (buffalo_l model) on first run to ~/.insightface/; --model and --upsample are ignored for this backend |
--mode |
group |
group → person_N/ subfolders; rename → flat files with sequential index |
--start-index |
1 |
Starting index for file counters in rename mode (e.g. --start-index 10 → person_N_img_10.ext, person_N_img_11.ext, …). Ignored in group mode |
--eps |
0.5 |
DBSCAN max distance between embeddings for same person. Raise to merge split clusters, lower to split merged ones. Use --debug to calibrate |
--min-samples |
2 |
Min detections to form a cluster. People below threshold go to unknown/. Set to 1 to keep solo faces |
--ref-dir |
none | Folder of named reference images. john.jpg → cluster named john. Multiple photos per person supported: john_1.jpg, john_2.jpg, … all map to john |
--model |
hog |
dlib only: hog (fast) or cnn (accurate, GPU recommended) |
--upsample |
1 |
dlib only: upsample N times before detection — finds smaller faces, ~4× cost per level |
--dry-run |
false |
Preview planned operations without copying anything |
--debug |
false |
Print pairwise distance stats to help choose --eps |
fgroup group specific
| Option | Default | Description |
|---|---|---|
--no-multi-export |
false |
Only use the largest face per photo. By default every detected face is exported independently — a photo with two people lands in both person folders |
fgroup video specific
| Option | Default | Description |
|---|---|---|
--max-duration |
15.0 |
Max video length in seconds (1–120). Videos over this go to skipped/. Warns if > 30s |
Dev mode
git clone https://github.com/your-username/face-grouper.git
cd face-grouper
# Install with all optional extras for full local development
pip install -e ".[arcface,video]"
# Verify the CLI is wired up
fgroup --help
Changes to face_grouper/*.py take effect immediately — no reinstall needed. Only re-run pip install -e . if you change pyproject.toml (e.g. new dependency or entry point).
macOS compile error? Install CMake first:
brew install cmake
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file face_grouper-0.4.2.tar.gz.
File metadata
- Download URL: face_grouper-0.4.2.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
850ccd0b288f6138af899bd2bb2fdea60babed63537a93e17e4dd17beca5ca81
|
|
| MD5 |
8f279b1b45023f0974e08c43ecd12be9
|
|
| BLAKE2b-256 |
e5688bc8d0727ecee7b0155e296e0af884c5a1fb433703ffa8214b15e3fabacb
|
Provenance
The following attestation bundles were made for face_grouper-0.4.2.tar.gz:
Publisher:
publish.yml on dinhanhthi/face-grouper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
face_grouper-0.4.2.tar.gz -
Subject digest:
850ccd0b288f6138af899bd2bb2fdea60babed63537a93e17e4dd17beca5ca81 - Sigstore transparency entry: 1427727956
- Sigstore integration time:
-
Permalink:
dinhanhthi/face-grouper@94a9148be59a974824286f83b07bd820d02fde6d -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/dinhanhthi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94a9148be59a974824286f83b07bd820d02fde6d -
Trigger Event:
push
-
Statement type:
File details
Details for the file face_grouper-0.4.2-py3-none-any.whl.
File metadata
- Download URL: face_grouper-0.4.2-py3-none-any.whl
- Upload date:
- Size: 22.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f46beaae43aea19509d6d3d11734ce430bf2e8e7ff3ff1829b4c728b2d19bc04
|
|
| MD5 |
6e62add1dd90111ef821c3448076bc59
|
|
| BLAKE2b-256 |
550746571f6473f7544982fb6cefb0a045a74c8fc387a14b7fcd363d70622b2b
|
Provenance
The following attestation bundles were made for face_grouper-0.4.2-py3-none-any.whl:
Publisher:
publish.yml on dinhanhthi/face-grouper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
face_grouper-0.4.2-py3-none-any.whl -
Subject digest:
f46beaae43aea19509d6d3d11734ce430bf2e8e7ff3ff1829b4c728b2d19bc04 - Sigstore transparency entry: 1427728064
- Sigstore integration time:
-
Permalink:
dinhanhthi/face-grouper@94a9148be59a974824286f83b07bd820d02fde6d -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/dinhanhthi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94a9148be59a974824286f83b07bd820d02fde6d -
Trigger Event:
push
-
Statement type: