How to Add Face Recognition to Your App
Recognize the same person across photos for tagging, deduplication, or personalization — without a managed gallery. Store embedding vectors in your own database and run similarity search on your own terms. Built with the Mental Edge Face Detection and Face Embeddings APIs.
Who it's for
App developers who want full control over identity storage and matching logic — without handing face data to a third-party gallery service.
What you'll use
Step by Step
- Detect the face in the input image. Confirm detection confidence meets your quality threshold; discard low-confidence frames.
- Crop the detected face region using the bounding box coordinates returned by detection.
- POST the cropped face to the embeddings endpoint. Receive a 512-dimension float array.
- Store the embedding in your database alongside the person's identity label. Any vector store works: Postgres + pgvector, Pinecone, Weaviate, or a simple in-memory index.
- For recognition, embed the new face and run a nearest-neighbor search against your stored embeddings. Tune the similarity threshold to balance precision and recall for your use case.
The Result
A face recognition pipeline you fully own — no vendor lock-in, no data leaving your infrastructure, and threshold tuning controlled by you.
All developer tutorials | Face Embeddings API | Face Gallery (managed alternative)