项目作者: faciallab

项目描述 :
Deep face recognition.
高级语言: Python
项目地址: git://github.com/faciallab/FaceRecognizer.git
创建时间: 2019-03-18T09:23:58Z
项目社区:https://github.com/faciallab/FaceRecognizer

开源协议:

下载


Face Recognition Project

Introduction

SetUp

Install MTCNN FaceDetector

Follow this instruction FaceDetector Installation.

Install

  1. python setup.py install

Basic Usage

Download the pre-trained model.

Download from pre-trained model and merge the part files

  1. cat model_ir_se50.pth* > model_ir_se50.pth
  2. mv model_ir_se50.pth /path/to/FaceRecognizer/output/res50

FaceVerify

Verify if they are the same person.

rebareba2

  1. from insight_face import FaceSearcher
  2. # Load pre-trained res50 model
  3. searcher.load_state('./output/res50/model_ir_se50.pth', 50)
  4. # Load face images
  5. face1 = cv2.imread('./tests/assets/reba/2.jpg')
  6. face2 = cv2.imread('./tests/assets/reba/3.jpg')
  7. result = searcher.verify(face1, face2)
  8. assert result is True

Find who they are.
reba

  1. face_bank_dir = 'tests/assets/'
  2. multi_face_img = cv2.imread("tests/assets/multi_face.jpg")
  3. searcher.add_face_bank(face_bank_dir, force_reload=True, bank_name='test')
  4. faces, names, best_sim, _, _ = searcher.search(multi_face_img, 'test')
  5. print(names)

result

  1. >> reba

Match

Match the person between two pictures.

  1. source, target, sim = searcher.match(face1, multi_face_img)
  2. cv2.imshow("source", source[0])
  3. cv2.imshow("matched", target[0])

Get embedding vectors

Get the raw embedding vectors of faces in given image.

  1. # expect a tensor shape with (3, 512)
  2. emb, boxes, landmarks = searcher.embedding_faces_in_the_wild(multi_face_img)