Skip to main content

FaceNet face features using OpenCV

Project description

facenet-opencv

FaceNet face features using OpenCV

Credits

facenet by davidsandberg

facenet_opencv_dnn by TanFluent

Why this exists

  1. The original project need tensorflow installed.
  2. The method/model need tensorflow 1.x, which is unavailable on python 3.8.
  3. A package with model in it, without depending tensorflow, is convenient.

How is this done

Download original models

20180408-102900

Or

20180402-114759

Install Tensorflow environment

python3.6 on linux

pip3 install protobuf==3.19.4 grpcio==1.8.6 tensorflow==1.7

Run the scripts

with some model path fix

  1. python3 convert_variable_to_constant.py
  2. python3 convert_tf_pb_to_cv_pb.py

Be noticed: the package contains the result of model 20180408-102900.

How to use

Install

pip3 install opencv-python
pip3 install mtcnn_opencv
pip3 install facenet_opencv

Code

from facenet_cv2 import FaceNet
model = FaceNet()

vectors = model.face_features(open("x.jpg", "rb").read())

for v in vectors:
    print(v)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

facenet_opencv-0.1.0-py3-none-any.whl (87.1 MB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for facenet_opencv-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17b2f659dddd9ffae20a5c3b15dab2df70e4eafd45d3f46b17bf5ec6682c9849
MD5 cb3e57a33a3b9e73f08ae5ce14f07af7
BLAKE2b-256 0438ebbe08c00acd34632a81ade6f4675220f38446dd04e51f80dc0dd4386e02

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