.. index:: 
  !Face search

.. _face_search:

===========
Face search
===========

Face search is the process in which a probe template is searched against the reference templates of more than one subject. It returns a candidate list.

The :ref:`FaceMatcher<id3_face_face_matcher_class>` module provides a search method that performs a one-to-many search of a biometric probe against a previously initialized dictionary of biometric references. This method is generally used when the database size is relatively small (up to 1000 templates).

For large databases (over 1000 templates), the :ref:`FaceIndexer<id3_face_face_indexer_class>` module offers a more efficient way of performing a one-to-many search. From an index file created from a list of :ref:`face templates<id3_face_face_template_class>`, it uses modern indexing techniques for fast, lossless searching.

Constructing a face index
==========================

The example below demonstrates how to construct a face index:

.. tab-set::

  .. tab-item:: Python
    :sync: Python

    .. literalinclude:: /../samples/sample.py
      :language: python
      :start-after: [face_indexer_construction]
      :end-before: [face_indexer_construction]
      :dedent: 4

Searching in the index
======================

The example below demonstrates how to search for a face using the index:

.. tab-set::

  .. tab-item:: Python
    :sync: Python

    .. literalinclude:: /../samples/sample.py
      :language: python
      :start-after: [face_indexer_search]
      :end-before: [face_indexer_search]
      :dedent: 4

See also
========

- :ref:`id3_face_face_encoder_class`
- :ref:`id3_face_face_indexer_class`
- :ref:`id3_face_face_matcher_class`
