DLib : train_shape_predictor_ex.cpp

拥有回忆 提交于 2019-12-01 12:18:57

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.

I created the training_with_face_landmarks.xml for helen training images (part 1, 2, 3, & 4) of total 2000 images.

Download Link: https://www.dropbox.com/s/jk98moqm8vopp5b/training_with_face_landmarks_2000.zip?dl=0

Steps:

  1. Download Train images - part 1, Train images - part 2, Train images - part 3 & Train images - part 4 from http://www.ifp.illinois.edu/~vuongle2/helen/. (each part has 500 images, so total of 2000 images)
  2. Place all the images & the training_with_face_landmarks.xml in a common folder (Ex: Folder name "train").
  3. In the project train_shape_predictor_ex.cpp, comment out these sections/lines

    a. Reference to testing_with_face_landmarks.xml and its usage b. trainer set_oversampling_amount(100) c. trainer set_nu(0.05) d. trainer set_tree_depth(3)

  4. Set command line argument as ./train
  5. Run the project
  6. It will generate sp.dat of size approx 178 MB (took 2 hours approx in my laptop)
  7. Use this sp.dat file in face_landmark_detection_ex project Command line Ex: sp.dat Example_image.jpg
  8. In face_landmark_detection_ex.cpp, a. In a loop of 194, call draw_solid_circle function b. using save_png function save the landmark output as a file.

Enjoy :)

Regards Gopi. J

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!