Search code examples
c++face-detectiontraining-datadlib

DLib : train_shape_predictor_ex.cpp


I am trying to train the shape predictor of Dlib by executing train_dlib_shape_predictor_ex.cpp on helen dataset as described in the code, I place test images in a face folder in current directory of shape predictor. But when I run the code it throws following exception:

C:\train_shape_predictor_ex\Release>train_shape_predictor_ex test

exception thrown!
ERROR: unable to open test/training_with_face_landmarks.xml for reading.

as no training_with_face_landmarks.xml and testing_with_face_landmarks.xml files are available in helen dataset on the following page : link

There is a folder named annotation which contains one text file containing the 194 landmark points location for each and every image in the dataset. How to convert this file into training_with_face_landmarks.xml.


Solution

  • Open up the 'training_with_face_landmarks.xml' file and observe its structure.

    Now, ask yourself:

    1. What changes between files? (hint: the point data)
    2. What stays the same? (hint: generic 'boiler plate' top and tail)

    Open up the HELEN data - ask the same again...

    Your task now is to parse the data from the HELEN set into a temporary data-structure/variable and then write it to file with all the required top and tail. It'll be a kludge and likely annoying to write with loops inside loops inside loops etc. but you'll get there.

    'c++ i/o streams' as a search string will get you started.