Face Identification System (1:N) Development

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1 servicesAll 1566 services
Face Identification System (1:N) Development
Complex
from 2 weeks to 3 months
FAQ
AI Development Areas
AI Solution Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822

Development of Face Identification Systems (1:N)

Face identification is searching for a person in a database without pre-specifying a candidate. System receives face photo and returns: who is this from registered people or "unknown". Technically more complex than verification: requires scalable storage, fast ANN search, correct threshold management as database grows.

Architectural Solution for Scale

With database > 100k faces, brute force search becomes too slow. Hierarchy of approaches:

Database Size Search Method Latency
< 10k Brute-force cosine similarity (NumPy) < 1 ms
10k–1M FAISS IVFFlat < 5 ms
1M–100M FAISS IVFPQ (Product Quantization) < 10 ms
> 100M ScaNN or Milvus cluster < 20 ms
import faiss
import numpy as np
from dataclasses import dataclass

@dataclass
class IdentificationResult:
    person_id: str | None
    person_name: str | None
    similarity: float
    identified: bool

class FaceIdentificationSystem:
    def __init__(self, embedding_dim: int = 512,
                 n_lists: int = 100,  # IVF parameter
                 threshold: float = 0.45):
        self.dim = embedding_dim
        self.threshold = threshold

        # FAISS IVFFlat index with Inner Product (cosine via normalization)
        quantizer = faiss.IndexFlatIP(embedding_dim)
        self.index = faiss.IndexIDMap(
            faiss.IndexIVFFlat(quantizer, embedding_dim, n_lists,
                               faiss.METRIC_INNER_PRODUCT)
        )
        self.index.nprobe = 20  # higher = more accurate but slower

        self.id_map = {}  # faiss_int_id -> {'person_id': str, 'name': str}
        self._next_id = 0

    def register(self, person_id: str, name: str,
                 embeddings: np.ndarray) -> int:
        """Register multiple photos of one person"""
        faiss.normalize_L2(embeddings)
        ids = np.arange(self._next_id, self._next_id + len(embeddings))

        if not self.index.is_trained:
            # Need minimum dataset for IVF training
            self.index.train(embeddings)

        self.index.add_with_ids(embeddings, ids)

        for fid in ids:
            self.id_map[int(fid)] = {'person_id': person_id, 'name': name}

        self._next_id += len(embeddings)
        return len(embeddings)

    def identify(self, query_embedding: np.ndarray,
                 k: int = 5) -> IdentificationResult:
        query = query_embedding.reshape(1, -1).copy()
        faiss.normalize_L2(query)

        similarities, faiss_ids = self.index.search(query, k)

        best_sim = float(similarities[0][0])
        best_id = int(faiss_ids[0][0])

        if best_id == -1 or best_sim < self.threshold:
            return IdentificationResult(None, None, best_sim, False)

        person_info = self.id_map[best_id]
        return IdentificationResult(
            person_info['person_id'],
            person_info['name'],
            best_sim,
            True
        )

Multiple Images Per Person

Registering multiple photos at different angles and lighting conditions increases recall. When identifying with aggregation over all person's photos:

def identify_with_aggregation(self, query_emb: np.ndarray,
                               k: int = 10) -> IdentificationResult:
    """k candidates → vote aggregation by person_id"""
    query = query_emb.reshape(1, -1).copy()
    faiss.normalize_L2(query)
    similarities, faiss_ids = self.index.search(query, k)

    votes = {}
    for sim, fid in zip(similarities[0], faiss_ids[0]):
        if fid == -1:
            continue
        pid = self.id_map[int(fid)]['person_id']
        votes[pid] = votes.get(pid, 0) + float(sim)

    if not votes:
        return IdentificationResult(None, None, 0.0, False)

    best_pid = max(votes, key=votes.get)
    best_score = votes[best_pid] / k  # normalize

    if best_score < self.threshold:
        return IdentificationResult(None, None, best_score, False)

    name = self.id_map[next(
        fid for fid, info in self.id_map.items()
        if info['person_id'] == best_pid
    )]['name']
    return IdentificationResult(best_pid, name, best_score, True)

Closed-set vs Open-set Identification

Closed-set: all queries belong to one of registered people. Task reduces to ranking.

Open-set: system must reject "unknown" — people not in database. Requires rejection threshold tuning. As database grows, threshold may need adjustment: from 1000 to 100k people, chance of random match increases.

Real-time Database Updates

Adding new users without reindexing: index.add_with_ids() works incrementally. Removal: IndexIDMap.remove_ids(). Persistence via faiss.write_index().

Production System Metrics

  • CMC (Cumulative Match Characteristic): Rank-1, Rank-5, Rank-10 accuracy
  • DIR@FAR (Detection and Identification Rate): for open-set
  • Latency p95/p99 under peak load
  • QPS (queries per second) — for infrastructure planning
Database Size Recommended Hardware QPS
< 100k 1 CPU server 500+
100k–10M 1 GPU + FAISS GPU 2000+
> 10M Milvus cluster 5000+
Project Scale Timeline
Up to 100k faces, single location 4–6 weeks
1M+ faces, multi-site 8–14 weeks
Enterprise real-time system 12–20 weeks