Skip to main content

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


Download files

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

Source Distribution

keras-facenet-0.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

keras_facenet-0.3-py2-none-any.whl (11.1 kB view details)

Uploaded Python 2

File details

Details for the file keras-facenet-0.3.tar.gz.

File metadata

  • Download URL: keras-facenet-0.3.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for keras-facenet-0.3.tar.gz
Algorithm Hash digest
SHA256 fa94045985d52b866c9cca11fbcf4ac5f677b331fd149d62d067957da0d13e36
MD5 7daa713e1e4306aff5521aa68eb67225
BLAKE2b-256 13841331ca6dd1e65a141ebd2a84dc3288cc611fdfc0e8c5c3043b59c5a35053

See more details on using hashes here.

File details

Details for the file keras_facenet-0.3-py2-none-any.whl.

File metadata

  • Download URL: keras_facenet-0.3-py2-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for keras_facenet-0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 98a677ba38a00ed13b9eb602176c3eec8b70d8340fffc6484aaf1214b563cff5
MD5 7a8d0c5aa98b7b530e8106c687784dbf
BLAKE2b-256 baaf2fa059f8c9e0d3eb51212d68d472bdd177d49642c2226f8cf8958531598d

See more details on using hashes here.

Supported by

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