Insightface: Alignment problems in Deploy

Created on 8 Mar 2018  Â·  12Comments  Â·  Source: deepinsight/insightface

Hi,
I've been trying to use the deploy/test.py script on two easy examples from LFW, but encountered several problems.

First, the predefined threshold does not pass any of the images. Now, even when reducing the threshold the cosine similarity is really low (~0.1).

Looking at the images fed into the network
it seems like there is a problem with the MTCNN alignment, the images are badly cropped, and look different from the images inside the LFW verification bin.

Any ideas?

Most helpful comment

The thing is using a different alignment process than used during training could result in performance drop, so I would still like to use the original process.

All 12 comments

I use pyseeta to alignment see #68

i replace the mxnet version mtcnn with dlib to detect face

The thing is using a different alignment process than used during training could result in performance drop, so I would still like to use the original process.

Hi all, my scripts under deploy/ is a toy example which suppose that you already have a face detector to crop the face from raw image. MTCNN can also be used as a face detector.

@nttstar, so which detector did you use for generating the training data? Is the alignment code the same?

Yes, MTCNN for training dataset.

OK, great :-)
What's the purpose of detect_face_limited? Because using the original detect_face seems to solve the problem with the detection.

Yes, right. My previous idea was to allow third-party face detectors.

how to use dlib in face_embedding.py? could u display the code please?

@zhyj3038

@tinatiant

  • in test.py

import dlib

def get_face_area(img_path):
img = cv2.imread(img_path)
detector = dlib.get_frontal_face_detector()
dets = detector(img, 1)
for k, d in enumerate(dets):
pos_start = tuple([d.left(), d.top()])
pos_end = tuple([d.right(), d.bottom()])

  height = d.bottom()-d.top()
  width = d.right()-d.left()
  img_blank = np.zeros((height, width, 3), np.uint8)
  for i in range(height):
    for j in range(width):
      img_blank[i][j] = img[d.top()+i][d.left()+j]
  return img_blank

img_path1 = ‘/home/A_0002.jpg‘
img_face1 = sc_get_face_area(img_path1)
f1 = model.get_feature(img_face1)

  • Replace part of the detector code in face_embedding.py,as follows

detector = MtcnnDetector(model_folder=mtcnn_path, ctx=ctx, num_worker=1, accurate_landmark = True, threshold=[0.0,0.0,0.2])

detector = dlib.get_frontal_face_detector()

I use dlib to detect and align face too(mmod face detector and shape_predictor_5_face_landmarks), would this bring serious performance degradation?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnhVPB picture AnhVPB  Â·  4Comments

WIll-Xu35 picture WIll-Xu35  Â·  3Comments

shenriver picture shenriver  Â·  5Comments

1frey picture 1frey  Â·  4Comments

zhenglaizhang picture zhenglaizhang  Â·  3Comments