A minimal library for extracting face embeddings using YOLO for detection and Facenet for embedding.
Project description
face-embeddings-lib
A minimal library for extracting face embeddings from images using YOLO (for face detection) and Facenet (for embedding extraction). Useful for any application needing facial embeddings or face search.
Installation
Install dependencies with Poetry:
poetry install
Or directly with pip:
pip install ultralytics facenet-pytorch torch opencv-python numpy
Usage Example
from face_embeddings_lib import EmbeddingEngine
with open("image.jpg", "rb") as f:
image_bytes = f.read()
engine = EmbeddingEngine()
embeddings = engine.generate_face_embeddings(image_bytes)
print("Number of faces:", embeddings.get("face_count"))
print("Embeddings:", embeddings.get("face_embedding"))
face_embeddingwill be a list of 512-float vectors averaged across faces found.face_countis the number of faces detected.annotated_bytesis the JPEG-encoded annotated image (you can save it or display it).
Requirements
- Python 3.10 or 3.11
- Torch with CUDA enabled for best performance (optional)
License
MIT
face-embeddings-lib
repo for embeddings functions package
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file face_embeddings_lib-0.1.0.tar.gz.
File metadata
- Download URL: face_embeddings_lib-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dadeaeae707a30027777a64d5a83344bbccf845cfc6459e39600f77b6ee0fe55
|
|
| MD5 |
87e3a4d1b05c4db0b4d95a9e79eddc9d
|
|
| BLAKE2b-256 |
d5c05e101901b13eb38b152070141fd173556b824fc519dee2152c07b143102d
|
File details
Details for the file face_embeddings_lib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: face_embeddings_lib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6864e184be7675284fec7a459fb9abf358d51585dd28ef132cb249f99099baf0
|
|
| MD5 |
1de20e07b7c82c21f2fa69619ca8d88d
|
|
| BLAKE2b-256 |
12c9f74d8730df12c750185dc954204def213d2224cd0638deb76e70cb325601
|