When using GPU with CNN model, I am not getting any better results than Hog
See original GitHub issue- face_recognition version: 1.3.0
- Python version:3.6.9
- Operating System:Ubuntu 18.04
Description
I switched to CNN model from Hog and using the below code.
image1_locations = face_recognition.face_locations(image2, number_of_times_to_upsample=2, model='cnn')
image2_locations = `face_recognition.face_locations(image2, number_of_times_to_upsample=2, model=‘cnn’)
image1_encoding = face_recognition.face_encodings(image1, known_face_locations=image1_locations, model=‘large’, num_jitters=1)[0]
image2_encoding = face_recognition.face_encodings(image2, known_face_locations=image2_locations, model=‘large’, num_jitters=1)[0]
face_distance = face_recognition.face_distance([image1_encoding], image2_encoding)`
dlib has been compiled with cuda support as well.
dlib.DLIB_USE_CUDA return True
I am using this facial location to compare with another image to calculate facial distance, but the facial distance did not improve at all. is there something that I’m missing.
Any help would be really great @ageitgey
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Hi @abhianand7, CNN method is used for face location(face detection) in Dlib, not for face encoding. As you can see in the API after finding the face location by each of CNN or hog you call face_encodings which uses deep metric learning to create face embeddings. So in your case, both hog or CNN methods find the same face location and that’s why you see the same face encodings for both. In summary, the CNN method gives you a better result in finding face locations, not face encoding. Here is a good description of differences between hog and CNN. Here is also a good description for deep metric learning.
@abhianand7 That sounds good. Maybe try and find discrepancies between face_recognition calls to dlib and direct usage of dlib. It is my understanding that CNN should provide speed improvement in training/detecting and better accuracy compared to the HOG model.
Let us know if you manage to find the reason for this behavior.