DLib : train_shape_predictor_ex.cpp

DLib : train_shape_predictor_ex.cpp

本文关键字:ex cpp predictor shape train DLib      更新时间:2023-10-16

我正试图通过在helen数据集上执行train_Dlib_shape_predictor_ex.cpp来训练Dlib的形状预测器,如代码中所述,我将测试图像放在形状预测器当前目录中的人脸文件夹中。但当我运行代码时,它会抛出以下异常:

C:train_shape_predictor_exRelease>train_shape_predictor_ex test
exception thrown!
ERROR: unable to open test/training_with_face_landmarks.xml for reading.

由于helen数据集中没有可用的training_with_face_landmarks.xmltesting_with_face_landmarks.xml文件,请访问以下页面:链接

有一个名为annotation的文件夹,它包含一个文本文件,其中包含数据集中每个图像的194个地标点位置。如何将此文件转换为training_with_face_landmarks.xml

我为总共2000个图像中的helen训练图像(第1、2、3和4部分)创建了training_with_face_landmarks.xml。

下载链接:https://www.dropbox.com/s/jk98moqm8vopp5b/training_with_face_landmarks_2000.zip?dl=0

步骤:

  1. 下载火车图像-部分1,火车图像-第2部分,火车图像部分3&列车图像-第4部分http://www.ifp.illinois.edu/~vuongle2/海伦/。(每个部分有500个图像,因此总共有2000个图像)
  2. 放置所有图像&公共文件夹中的training_with_face_landmarks.xml(例如:文件夹名称"train")
  3. 在项目train_shape_predictor_ex.cpp中,注释掉这些部分/行

    a。testing_with_face_landmarks.xml及其用法参考b.训练器集合_横向采样_装载(100)c.训练器set_nu(0.05)d.训练器set_tree_depth(3)

  4. 将命令行参数设置为/列车
  5. 运行项目
  6. 它将生成大小约178 MB的sp.dat(在我的笔记本电脑中大约花了2个小时)
  7. 在face_landmark_detection_ex项目中使用此sp.dat文件命令行Ex:sp.dat Example_image.jpg
  8. 在face_landmark_detection.ex.cpp中,a.在194的循环中,调用draw_solid_circle函数b.使用save_png函数将地标输出保存为文件

享受:)

问候Gopi。J

打开"training_with_face_landmarks.xml"文件并观察其结构。

现在,问问自己:

  1. 文件之间有什么变化?(提示:点数据)
  2. 什么保持不变?(提示:通用"锅炉板"顶部和尾部)

打开海伦的数据-再次问同样的问题。。。

您现在的任务是将HELEN集合中的数据解析为一个临时数据结构/变量,然后将其写入具有所有所需顶部和尾部的文件。这将是一个笨拙的和可能令人讨厌的写循环内循环内循环等,但你会做到的。

"c++i/o流"作为一个搜索字符串会让你开始。