Open zerodwide opened 1 year ago
I'm also interested in this question. It seems they are not using any detector because every image is a single face. Maybe just a centerCrop followed by a 112x112 resizing? I don't know. I wish the code of that demo were public.
Im also intersetd in the onnx files of the models used here (r100-w2m and insightface-private) because i can't find them in https://github.com/deepinsight/insightface/tree/master/model_zoo#1-face-recognition-models
By the way, I tried to replicate the demo with the only public model r50-600k (IR50 trained on WebFace-600K) avaliable here and those are the results I got.
My preprocesing is first 112x122 resizing and then normalize (mean=127.5, std=128) My postprocesing is L2 normalization of the embedding. The score is the dot procuct of the 2 (L2 normalized) embeddings.
Demo result: They ARE the same person; Score: 0.4821.
Demo result: They are NOT the same person; Score: -0.0354.
Demo result: They are NOT the same person; Score: 0.1879.
Demo result: They ARE the same person; Score: 0.3136.
Demo result: They ARE the same person; Score: 0.2825.
Demo result: They are LIKELY TO be the same person; Score: 0.2586.
You can see that demo results and my results differs a lot.
@zerodwide SCRFD-10GF @javiabellan You should do face-alignment, not image resizing.
Thanks @nttstar for answering.
Any plans form making code of the demo public or the models used (r100-w2m and insightface-private) public aswell?
No such plan. For r100-w2m you can train it by yourself.
@javiabellan Possible for you to share your code for face recognition?
@HeChengHui No sorry, but i can give you the full pipeline:
The similarity of 2 faces is the dot product of the L2-normalized embeddings.
@javiabellan
3. Infer face recognizer (IResNet50-WebFace-600K)
could you perhaps point me to any reference code?
I tried doing
handler = insightface.model_zoo.get_model("w600k_r50.onnx", providers=['CUDAExecutionProvider'])
handler.prepare(ctx_id=0)
handler.compute_sim(ref, ref)
where ref
is an image, but i get 5.576827495436904e-09 as the score.
Another question is that during the preprocessing, did you normalise both reference and probe or only one?
@nttstar
is normed_embedding
still being used? it is returning me None
when doing the following
app = FaceAnalysis(name='antelope', allowed_modules=['detection'], providers=['CUDAExecutionProvider'])
app.prepare(ctx_id=0, det_size=(640, 640), det_thresh=0.3)
for probe_face in probe_faces:
probe_emb = probe_face.normed_embedding
print("probe",probe_emb)
>>> None
@HeChengHui No sorry, but i can give you the full pipeline:
infer with SCRFD-10GF
- Prepro: Resize max size to 640px and normalize img
- Postpro: Rescale boxes and landmarks to original image resolution
- Use the landmarks (5 facial keypoints) to do face aligment (this returns a 112x112 img)-> code
Infer face recognizer (IResNet50-WebFace-600K)
- Prepro: Normalize img
- Postpro: L2 normalization of the embedding
The similarity of 2 faces is the dot product of the L2-normalized embeddings.
Hi, how did you use buffalo_l or other face recognition models without default face detection models? Which one is correct for computing the similarity between two images?
handler = insightface.model_zoo.get_model(r"C:\Users\windows.insightface\models\buffalo_l\w600k_r50.onnx") handler.prepare(ctx_id=-1)
f1 = handler.get_feat(img1) f2 = handler.get_feat(img2)
out = handler.compute_sim(f1, f2) print(out) or similarity = np.dot(f1, f2.T) print(similarity)
dear @nttstar What detector used on Recognition demo at http://demo.insightface.ai:7008?
Thanks in advance.