A package wrapping the FaceNet embedding model
Project description
keras-facenet
This is a simple wrapper around this wonderful implementation of FaceNet. I wanted something that could be used in other applications, that could use any of the four trained models provided in the linked repository, and that took care of all the setup required to get weights and load them. I prefer using Keras wherever possible because of its API, so I used the example provided here and implemented it as part of the code.
Enough background -- so how are you supposed to use this?
Installing
pip install keras-facenet
Usage
To get embeddings for the faces in an image, you can do something like the following.
from keras_facenet import FaceNet
embedder = FaceNet()
# Gets a detection dict for each face
# in an image. Each one has the bounding box and
# face landmarks (from mtcnn.MTCNN) along with
# the embedding from FaceNet.
detections = embedder.extract(image, threshold=0.95)
# If you have pre-cropped images, you can skip the
# detection step.
embeddings = embedder.embeddings(images)
Logging
To see what's going on under the hood, set logging to view INFO
logs. If using in a Jupyter notebook, you can use the following.
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel('INFO')
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
Hashes for keras_facenet-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45c06a86ebec05be33670b58e3fac3936ab26d407c67c709e6d385a0cda4a54b |
|
MD5 | 6abead0b1c7aa9db352d1582c8c9c160 |
|
BLAKE2b-256 | 40142cee6855349215a809a7727bec6f18d5c716a2498638d86caf9e6d67c7ce |