Face Recognition and Vector Database Integration
A face-recognition backend that turns faces into vectors and stores them. Add, search, update or delete an identity in milliseconds, against either a local or a cloud vector database.

- Year
- Jun 2023
- Timeline
- 3 months
- Type
- Machine Learning
- Status
- Completed
<50ms
To match a face against the gallery with a vector search, instead of a linear scan that slows down with every new identity.
Overview
Most face-recognition tutorials stop at "is this Person A?" I wanted the part that matters in production: where do the faces live, and how fast can you find one among thousands? This project encodes each face into a 128-dimension embedding and stores it in a vector database, so recognition becomes a nearest-neighbour search instead of a brute-force comparison. It exposes a CRUD API over identities and runs against ChromaDB locally or Pinecone in the cloud, with the same code and one environment variable to switch.
The hard parts
- 01
Keeping recognition accurate in real conditions: bad lighting, odd angles, partial faces.
- 02
Staying fast as the gallery grows: a linear scan that's fine for 50 faces falls over at 50,000.
- 03
Designing one interface that behaves identically over a local store (ChromaDB) and a managed cloud store (Pinecone).
- 04
Managing API keys and credentials without hard-coding a secret.
The approach
Faces are embedded with the `face_recognition` library (dlib under the hood) and stored as vectors, so identification becomes an approximate-nearest-neighbour query, which is sub-linear and cheap. A thin abstraction layer hides the backend, making ChromaDB and Pinecone interchangeable, and credentials come only from environment variables. It is covered by `unittest` and wired to GitHub Actions, which runs the suite across Python versions and operating systems on every push.
Outcome
The result is a recognition backend you can drop into a larger system: identities go in and come back by similarity in milliseconds, the storage layer is swappable, and CI runs the tests on every push. Moving from local prototyping (ChromaDB) to cloud search (Pinecone) is a config change.
What I'd do differently
I would add embedding versioning. Today, changing the face-encoding model means re-embedding everyone. Next time I would store the model version alongside each vector and support a background re-index, so upgrading the model doesn't mean downtime.
Stack
Like what you see?
Let's build the next one.
Hiring, or have a problem that needs this kind of engineering? I read every message myself.

