Search code examples
computer-visionface-detectionkeypointdlib

Facial Landmark Detection using Dlib


Is it possible to use train_shape_predictor_ex.cpp.html and face_landmark_detection_ex.cpp.html to training with different landmark numbers? Both detect 68 landmarks in a frontal face by default. I would like to detect 39 landmarks only. I can train all right using the train_shape_predictor_ex. however face_landmark_detection_ex outputs the attached message:

exception thrown

Error detected at line 25. 
Error detected in file /Users/Vareto/Documents/Dlib/dlib/../dlib/image_processing/render_face_detections.h.
Error detected in function std::vector dlib::render_face_detections(const std::vector &, const dlib::rgb_pixel).
Failing expression was dets[i].num_parts() == 68.
std::vector render_face_detections()
Invalid inputs were given to this function.
dets[0].num_parts(): 39

Solution

  • In terms of error messages this one is pretty clear.

    It's saying that while you've got 39 markers (congrats on training it!), the demo is still trying to draw 68 in the render_face_detections() function.

    39 != 68