Skip to main content

A CLI tool that groups photos and videos by person using offline face recognition.

Project description

face-grouper Logo

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 groupperson_N/ subfolders; rename → flat files with sequential index
--start-index 1 Starting index for file counters in rename mode (e.g. --start-index 10person_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

face_grouper-0.4.2.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

face_grouper-0.4.2-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

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

Hashes for face_grouper-0.4.2.tar.gz
Algorithm Hash digest
SHA256 850ccd0b288f6138af899bd2bb2fdea60babed63537a93e17e4dd17beca5ca81
MD5 8f279b1b45023f0974e08c43ecd12be9
BLAKE2b-256 e5688bc8d0727ecee7b0155e296e0af884c5a1fb433703ffa8214b15e3fabacb

See more details on using hashes here.

Provenance

The following attestation bundles were made for face_grouper-0.4.2.tar.gz:

Publisher: publish.yml on dinhanhthi/face-grouper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for face_grouper-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f46beaae43aea19509d6d3d11734ce430bf2e8e7ff3ff1829b4c728b2d19bc04
MD5 6e62add1dd90111ef821c3448076bc59
BLAKE2b-256 550746571f6473f7544982fb6cefb0a045a74c8fc387a14b7fcd363d70622b2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for face_grouper-0.4.2-py3-none-any.whl:

Publisher: publish.yml on dinhanhthi/face-grouper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page