Skip to main content

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_embedding will be a list of 512-float vectors averaged across faces found.
  • face_count is the number of faces detected.
  • annotated_bytes is 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

face_embeddings_lib-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

face_embeddings_lib-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

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

Hashes for face_embeddings_lib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dadeaeae707a30027777a64d5a83344bbccf845cfc6459e39600f77b6ee0fe55
MD5 87e3a4d1b05c4db0b4d95a9e79eddc9d
BLAKE2b-256 d5c05e101901b13eb38b152070141fd173556b824fc519dee2152c07b143102d

See more details on using hashes here.

File details

Details for the file face_embeddings_lib-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for face_embeddings_lib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6864e184be7675284fec7a459fb9abf358d51585dd28ef132cb249f99099baf0
MD5 1de20e07b7c82c21f2fa69619ca8d88d
BLAKE2b-256 12c9f74d8730df12c750185dc954204def213d2224cd0638deb76e70cb325601

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page