| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
FC Face Service is a self-hosted face-recognition REST service for CPR. It combines SeetaFace6 for on-host face detection, alignment, feature extraction, and silent liveness checks; pgvector for organization-isolated 1:N search; and Alibaba Cloud Facebody as a cautious 1:1 fallback.
Repository short description: Self-hosted face recognition REST service powered by SeetaFace6, pgvector, and Alibaba Cloud Facebody fallback.
This service moves the Android-side face-login capability into a backend service. Its state is isolated within this service: pgvector stores face embeddings and SeetaFace6 models are mounted at runtime. It does not access or modify the legacy business backend database.
Android (public)
│ probe OSS key + org_id
▼
Business backend (private)
│ internal REST call
▼
FC Face Service (default: 127.0.0.1:8090)
├─ fetches probe images from OSS
├─ SeetaFace6: detect, align, silent-liveness gate, and 512-dimensional embedding
├─ pgvector: organization-scoped cosine Top-1 search
└─ Alibaba Cloud Facebody: 1:1 review for uncertain results
| Document | Audience | Contents |
|---|---|---|
| Project status | Team | Background, decisions, progress, completed work, and follow-ups |
| Business backend integration (Chinese) | Backend developers | Required business-backend endpoints, presigning, SN → org mapping, and library maintenance |
| Recognition service API (Chinese) | Backend and QA | Port 8090 API contract, examples, and full-vectorization workflow |
| Operations guide | Operators and backend developers | Access, storage, architecture, deployment, debugging, and testing |
| SeetaFace engine notes | Service developers | Native engine setup and model requirements |
cmd/server/main.go Application entry point
internal/config Environment-based configuration
internal/engine Engine interface, SeetaFace6 CGO implementation, and non-native stub
internal/store pgvector persistence and organization-scoped 1:N retrieval
internal/oss OSS image retrieval and presigned URLs
internal/fallback Alibaba Cloud Facebody 1:1 fallback
internal/service Recognition workflow orchestration
internal/httpapi REST routing and handlers
Dockerfile / docker-compose Containerized deployment
models/ Six runtime-mounted SeetaFace6 .csta files (not committed)
Requests and responses use application/json. When FACE_API_TOKEN is configured, every endpoint except /healthz requires the X-Face-Token header.
// Request
{ "org_id": "1024", "probe_key": "photo/probe-xxx.jpg" }
// Match response
{ "matched": true, "subject_id": "88", "score": 0.71, "liveness": "real", "via": "engine" }
// No-match response
{ "matched": false, "reason": "liveness_spoof", "liveness": "spoof", "score": 0, "via": "engine" }Possible reason values include no_face, liveness_spoof, liveness_fuzzy, and empty_library. via is either engine or fallback.
{ "key_a": "photo/a.jpg", "key_b": "photo/b.jpg" }
// { "match": true, "score": 0.68, "via": "engine" }Provide all (subject_id, oss_key) pairs for one organization. The service downloads each image, extracts embeddings, and transactionally replaces that organization's library. Entries that cannot be processed are reported in failures without preventing other entries from being enrolled.
// Request
{
"entries": [
{ "subject_id": "88", "oss_key": "photo/88.jpg" },
{ "subject_id": "91", "oss_key": "FunSki/91.jpg" }
]
}
// Response
{ "org_id": "1024", "total": 2, "enrolled": 2, "failed": 0, "failures": [] }POST /faces Add or update one face: { org_id, subject_id, oss_key }
DELETE /faces Delete one face: { org_id, subject_id }
GET /healthz Health check; no authentication required
Put the six SeetaFace6 .csta model files in ./models/: face_detector, face_landmarker_pts5, face_recognizer_light, fas_first, fas_second, and quality_lbn.
Create local configuration: cp .env.example .env, then enter least-privilege Alibaba Cloud RAM credentials. Never commit .env.
Start the service and pgvector:
docker compose up -d --buildVerify it:
curl -s http://localhost:8090/healthzThe response should be ok.
Populate each organization's library through POST /sync/{org_id}.
For local development without the native SDK, use the default stub engine:
go build ./cmd/server
go test ./...
go vet ./...Build with -tags seeta only after the required SeetaFace6 headers, libraries, and models are installed locally.
Keep credentials only in .env, begin with .env.example, and use least-privilege RAM credentials. Do not commit SeetaFace models, generated runtime data, or biometric data.
| Back | FazBrowse Home | New Git URL |