Skip to content

linxiaohui/facenet-opencv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

FaceNet face features using OpenCV

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages