Skip to content

DoppelSort

DoppelSort logo

DoppelSort is a Python CLI for scanning portrait directories, storing face embeddings in SQLite, and comparing faces by cosine similarity. Use it to find a doppelgänger in a local photo collection, compare two portraits directly, or build a reusable face index.

What it does

  • Scan one or more directories and index every detected face in SQLite.
  • Compare two portraits and report cosine similarity, distance, and a threshold-based match decision.
  • Match a source portrait against an existing index and rank the closest candidates.
  • Maintain the index with summary statistics and duplicate cleanup.
  • Evaluate model and threshold choices with labeled image pairs.

Embeddings are L2-normalized float32 vectors scored with cosine similarity. The index records the embedding model and dimension, and refuses mismatched models instead of comparing incompatible vectors.

Quick start

uv sync --dev
uv run doppelsort scan ./portraits --db-path ./faces.db
uv run doppelsort match ./me.jpg --db-path ./faces.db --top-n 10
uv run doppelsort compare ./me.jpg ./candidate.jpg

Scans append by default. Pass --overwrite to clear an existing index first.

Documentation

Status

DoppelSort is beta software at version 0.2.0. Exact NumPy search is the supported matching path; optional approximate-search and alternate-backend work is tracked in the roadmap.

License

DoppelSort is released under the MIT License.