No description
  • Python 93.5%
  • Dockerfile 6.5%
Find a file
2026-06-25 10:34:16 +03:00
.github Bump actions/setup-python from 5 to 6 2026-06-25 07:33:54 +00:00
app Implement idle timeout for GPU model to optimize memory usage and add idle reaper thread 2026-06-25 10:25:57 +03:00
docs Phase 0: scaffold sharevent-faces (FastAPI + InsightFace) service 2026-06-20 07:15:28 +03:00
tests Implement idle timeout for GPU model to optimize memory usage and add idle reaper thread 2026-06-25 10:25:57 +03:00
.coverage Add tests for authentication, media handling, metrics, and video processing 2026-06-20 22:34:47 +03:00
.dockerignore Phase 0: scaffold sharevent-faces (FastAPI + InsightFace) service 2026-06-20 07:15:28 +03:00
.env.example Phase 0: scaffold sharevent-faces (FastAPI + InsightFace) service 2026-06-20 07:15:28 +03:00
.gitignore Phase 0: scaffold sharevent-faces (FastAPI + InsightFace) service 2026-06-20 07:15:28 +03:00
.gitleaks.toml Add Dependabot configuration and CI workflows for dependency management and secret scanning 2026-06-20 11:54:54 +03:00
Dockerfile Update Dockerfile to enforce CPUExecutionProvider during model baking to prevent segfaults 2026-06-20 12:22:21 +03:00
pyproject.toml Phase 0: scaffold sharevent-faces (FastAPI + InsightFace) service 2026-06-20 07:15:28 +03:00
README.md Phase 3: /cluster (HDBSCAN) + /metrics + hardening + model bake 2026-06-20 07:25:52 +03:00
requirements.txt Remove onnxruntime-gpu from requirements and update comments for clarity on dependency management 2026-06-20 12:15:35 +03:00

sharevent-faces

Self-hosted face detection, recognition & people-grouping microservice for ShareVent. Mirrors the sharevent-nudenet service pattern (its own git repo, GPU container, internal-network-only) but is built on FastAPI + InsightFace (ArcFace buffalo_l) with onnxruntime-gpu and a CPU fallback.

It exposes embedding + clustering endpoints; it stores nothing. The backend (sharevent-be) owns all persistence (faces, persons, links) and all gating. Media is only ever sent here when the gallery_face_grouping module is enabled for an event — see FACE_RECOGNITION_PLAN.md §5 (privacy, non-negotiable).

Biometric embeddings are GDPR Art. 9 special-category data. This service never logs raw embeddings or selfies and persists no media beyond a request lifetime.

Endpoints

Method Path Purpose
GET /healthz Liveness + model/device report.
POST /embed Detect + embed faces in one image (multipart).
POST /embed/video Sample + track + one embedding per person-tracklet.
POST /cluster HDBSCAN (cosine) over a list of embeddings → labels.
GET /metrics Prometheus-style counters (req count, latency, GPU mem).

All non-health endpoints require Authorization: Bearer <FACES_AUTH_TOKEN>.

Full request/response contracts: docs/ARCHITECTURE.md.

Run locally

python -m venv .venv && . .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env                            # set FACES_AUTH_TOKEN
uvicorn app.main:app --host 0.0.0.0 --port 5001

Without onnxruntime-gpu + CUDA the service runs on CPU automatically.

Build the container

docker build -t sharevent-faces .
docker run --gpus all -p 5001:5001 --env-file .env sharevent-faces

The InsightFace model is baked into the image at build time (no runtime download).

Status

Service complete (Phases 03 of FACE_RECOGNITION_PLAN.md): /embed, /embed/video, /cluster, /metrics and /healthz are all implemented; the buffalo_l model is baked into the image at build time. BE integration (worker, persistence, gating) is Phases 59.