Closed ELERKSOSY closed 3 years ago
could you please to run unit_tests.py: https://github.com/serengil/deepface/blob/master/tests/unit_tests.py
I am asking this because to understand everything in your installation is oke. From 182th line to 225th line, bulk facial recognition testing applied and testing score is almost 100%. If you got much lower than the same data set, then your environment might be problematic.
Thank you for your swift reply.
Here is the test result: Passed unit tests: 143 / 150 Unit tests are completed successfully. Score: 95.33 %
Here are all the lines which reported failed: img8.jpg - img9.jpg unverified as same person based on VGG-Face and cosine . Distance: 0.63 , Threshold: 0.4 ( failed ) img8.jpg - img9.jpg unverified as same person based on Facenet and cosine . Distance: 1.07 , Threshold: 0.4 ( failed ) img8.jpg - img9.jpg unverified as same person based on Facenet and euclidean . Distance: 12.69 , Threshold: 10 ( failed ) img8.jpg - img9.jpg unverified as same person based on Facenet512 and euclidean_l2 . Distance: 1.47 , Threshold: 1.04 ( failed ) img8.jpg - img9.jpg unverified as same person based on ArcFace and cosine . Distance: 1.01 , Threshold: 0.68 ( failed ) img8.jpg - img9.jpg unverified as same person based on ArcFace and euclidean_l2 . Distance: 1.42 , Threshold: 1.13 ( failed )
Else this all are passed.
However in line 260 I got the following error. I'm not sure if this related to our discussion or no.
File "unit_tests.py", line 260, in
Hello Sefik,
Any suggestion for me? thank you in advance. @serengil
@ELERKSOSY: I could probably take a look at this for you, but it's difficult without seeing the faces in question. Do you have a sample of two faces that show the problematic result?
@davedgd Thank you. Please find here the link for the 2 faces to compare Faces Link
@ELERKSOSY: based on your sample, I think the issue is that your faces may feature obstruction/occlusion, which can be problematic for various models (e.g., see these papers: https://arxiv.org/abs/2006.11366 and https://arxiv.org/pdf/2103.02805.pdf). As an aside, the fact that you need to disable enforce_detection for recognition is occasionally indicative of such a problem being present.
More generally, you may still be able to use deepface here, but what I would suggest is to define your own max_threshold_to_verify or perhaps loosen it (based on your own testing/tuning) to see if you can improve performance. In addition, changing the normalization parameter of the verify method to a model-appropriate one (e.g., 'VGGFace'
when using that type of model) may also be helpful.
More broadly, you may want to explore alternative models that are designed to handle occlusion better; there may be some relevant papers available (ideally with models provided) here: https://github.com/ChanChiChoi/awesome-Face_Recognition
PS. Image quality is also an important factor when it comes to model performance, and this may also impact your results depending on the data.
@davedgd Thank you for the update and the support :)
@davedgd thank you Dave, I have been getting lots of questions in this context. I can answer your comments for the following ones.
So, I am closing this issue if Dave's answer satisfies you.
Hello,
Thanks for the efforts that have been made in this project.
I try to use Deepface for face recognition project and I always got a high distance value (0.50, 0.40, 0.90, etc...). Either way when I match two identical faces or two different faces.
Based on this high distance rate I can't recognize when the faces are really similar or are not similar. I can't understand exactly where the problem is.
Please allow me to share with you the test results and the images used for that test. In the following test I used the function DeepFace.verify in the following form.
DeepFace.verify(img1, img2, model_name = models[0], enforce_detection=False)
The results of testing the 8 models using images "Compare1_1.jpg" and "Compar1.jpg" both images are for the same person VGG-Face: {'verified': False, 'distance': 0.44292289429961096, 'max_threshold_to_verify': 0.4, 'model': 'VGG-Face', 'similarity_metric': 'cosine'} Facenet: {'verified': False, 'distance': 0.6333912740174673, 'max_threshold_to_verify': 0.4, 'model': 'Facenet', 'similarity_metric': 'cosine'} Facenet512: {'verified': False, 'distance': 0.8702504608399846, 'max_threshold_to_verify': 0.3, 'model': 'Facenet512', 'similarity_metric': 'cosine'} OpenFace: {'verified': False, 'distance': 0.5087096803701614, 'max_threshold_to_verify': 0.1, 'model': 'OpenFace', 'similarity_metric': 'cosine'} DeepFace: {'verified': False, 'distance': 0.553310695441039, 'max_threshold_to_verify': 0.23, 'model': 'DeepFace', 'similarity_metric': 'cosine'} DeepID: {'verified': False, 'distance': 0.13006360093034186, 'max_threshold_to_verify': 0.015, 'model': 'DeepID', 'similarity_metric': 'cosine'} ArcFace: {'verified': False, 'distance': 0.8135608215721015, 'max_threshold_to_verify': 0.68, 'model': 'ArcFace', 'similarity_metric': 'cosine'} Dlib: {'verified': False, 'distance': 0.13527489178242857, 'max_threshold_to_verify': 0.07, 'model': 'Dlib', 'similarity_metric': 'cosine'}
The results of testing using images "Compare2.jpg" and "Compar1.jpg" images are for different persons. VGG-Face: {'verified': False, 'distance': 0.6741864154211878, 'max_threshold_to_verify': 0.4, 'model': 'VGG-Face', 'similarity_metric': 'cosine'} Facenet: {'verified': False, 'distance': 0.8947649415469396, 'max_threshold_to_verify': 0.4, 'model': 'Facenet', 'similarity_metric': 'cosine'} Facenet512: {'verified': False, 'distance': 0.7981975540095653, 'max_threshold_to_verify': 0.3, 'model': 'Facenet512', 'similarity_metric': 'cosine'} OpenFace: {'verified': False, 'distance': 0.9307918202843598, 'max_threshold_to_verify': 0.1, 'model': 'OpenFace', 'similarity_metric': 'cosine'} DeepFace: {'verified': False, 'distance': 0.5348909209478492, 'max_threshold_to_verify': 0.23, 'model': 'DeepFace', 'similarity_metric': 'cosine'} DeepID: {'verified': False, 'distance': 0.03627996863889005, 'max_threshold_to_verify': 0.015, 'model': 'DeepID', 'similarity_metric': 'cosine'} ArcFace: {'verified': False, 'distance': 1.0408795676381812, 'max_threshold_to_verify': 0.68, 'model': 'ArcFace', 'similarity_metric': 'cosine'} Dlib: {'verified': False, 'distance': 0.1283770384893438, 'max_threshold_to_verify': 0.07, 'model': 'Dlib', 'similarity_metric': 'cosine'}
Here are the link for 3 images used for testing: Images used for the above test
Kindly advise me. Thank you in advance.