face_verification.db package¶
Submodules¶
face_verification.db.db module¶
Contains the code related for face recogniction/verification using on a database.
-
class
face_verification.db.db.Database(path)[source]¶ Bases:
objectA simple wrapper for sqlite database
-
create(table_name='tt') → None[source]¶ Create a new table. The table name itself is not very important since we are not doing any relational searches.
- Parameters
table_name (str, optional) – Defaults to “tt”.
- Returns
None
-
delete(name: str) → None[source]¶ Deletes the matching name from the database
- Parameters
name (str) – name to match
-
get_value(name: str) → bytes[source]¶ Returns the embedding associated with the name.
- Parameters
name (str) – Name of the person in the database.
- Returns
Bytes type embedding.
- Return type
bytes
-
-
face_verification.db.db.compare_embedding(embedding: Union[torch.Tensor, numpy.ndarray], db: face_verification.db.db.Database) → Optional[Tuple[str, float]][source]¶ - Compares the given embedding with every embedding in db. Returns the first
matched name and distance if any is found.
- Parameters
embedding (Union[torch.Tensor, np.ndarray]) – Embedding vector, either numpy or torch
db (Database) – Database to search the images
- Returns
Name, distance pair if matched.
- Return type
Union[Tuple[str, float], None]