Search code examples
pythonc++face-recognitiondlib

compute_face_descriptor() alternative in C++


In python API of dlib there is a function called compute_face_descriptor() but I couldn't find any alternative to it in C++ API.

How can I create an alternative to it in C++?


Solution

  • compute_face_descriptor() is coming from dlib.face_recognition_model_v1(face_recognition_model)

    face_recognition_model contains dlib_face_recognition_resnet_model_v1.dat

    see here https://github.com/ageitgey/face_recognition_models/blob/master/face_recognition_models/init.py

    face_recognition_model = face_recognition_models.face_recognition_model_location()
    face_encoder = dlib.face_recognition_model_v1(face_recognition_model)
    
    .....
    
    def face_encodings(face_image, known_face_locations=None, num_jitters=1):
        raw_landmarks = _raw_face_landmarks(face_image, known_face_locations, model="small")
        return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]