Python Train\u shape\u predictor.py文件给出了一个错误
我正在尝试使用 输出:Python Train\u shape\u predictor.py文件给出了一个错误,python,face-detection,dlib,Python,Face Detection,Dlib,我正在尝试使用 输出: /home/msc/Face_Rec/abc/training_with_face_landmarks.xml Training with cascade depth: 10 Training with tree depth: 2 Training with 500 trees per cascade level. Training with nu: 0.05 Training with random seed: Training with oversampling a
/home/msc/Face_Rec/abc/training_with_face_landmarks.xml
Training with cascade depth: 10
Training with tree depth: 2
Training with 500 trees per cascade level.
Training with nu: 0.05
Training with random seed:
Training with oversampling amount: 300
Training with feature pool size: 400
Training with feature pool region padding: 0
Training with lambda_param: 0.1
Training with 20 split tests.
Traceback (most recent call last):
File "train_shape_predictor.py", line 29, in <module>
dlib.train_shape_predictor(training_xml_path, "predictor.dat", options)
RuntimeError:
Error detected at line 248.
Error detected in file /tmp/pip_build_root/dlib/dlib/../dlib/image_processing/shape_predictor_trainer.h.
Error detected in function dlib::shape_predictor dlib::shape_predictor_trainer::train(const image_array&, const std::vector<std::vector<dlib::full_object_detection> >&) const [with image_array = dlib::array<dlib::array2d<unsigned char> >].
Failing expression was objects[i][j].num_parts() != 0.
shape_predictor shape_predictor_trainer::train()
You can't give objects that don't have any parts to the trainer.
/home/msc/Face\u Rec/abc/training\u with\u Face\u landmarks.xml
级联深度训练:10
树深度训练:2
每级梯级500棵树的培训。
使用nu进行培训:0.05
随机种子训练:
过采样量的培训:300
具有功能池大小的培训:400
使用功能池区域填充进行培训:0
使用lambda_参数进行培训:0.1
通过20次分割测试进行训练。
回溯(最近一次呼叫最后一次):
文件“train\u shape\u predictor.py”,第29行,在
dlib.train\u shape\u predictor(training\u xml\u路径,“predictor.dat”,选项)
运行时错误:
在第248行检测到错误。
在文件/tmp/pip\u build\u root/dlib/dlib/./dlib/image\u processing/shape\u predictor\u trainer.h中检测到错误。
函数dlib::shape\u predictor dlib::shape\u predictor\u trainer::train(const image\u array&,const std::vector&)const[with image\u array=dlib::array]中检测到错误。
失败的表达式为objects[i][j]。num_parts()!=0
形状预测器形状预测器训练器::训练()
您不能将没有任何零件的对象交给培训师。
请有人帮我解决那个错误。提前感谢。首先,让我们弄清楚对象和部分在这里的意思。
假设您正在训练一个模型来检测人脸的地标。所以
- 对象是人脸和
- 部分是它的标志性位置李>
1.仅使用对象标记(或注释)数据集,而不使用其部分或,
2.您正在将零件标记为盒子 如果是前者。不要这样做。
如果是后者,则.xml文件必须如下所示:注释为方框的要素点
<image file='/path/to/image/directory/<filename>.jpg'>
<box top='145' left='114' width='239' height='257'>
<box top='178' left='157' width='1' height='1'/>
<box top='179' left='158' width='1' height='1'/>
<box top='155' left='211' width='1' height='1'/>
<box top='152' left='245' width='1' height='1'/>
<box top='187' left='292' width='1' height='1'/>
<box top='340' left='343' width='1' height='1'/>
</image>
二,。当imglab窗口打开时:
a) 在感兴趣的对象周围标注框
b) 双击该框,然后右键单击要表示特征点的位置。弹出菜单会提示您所有可能的标签
imglab-h
希望这有帮助。祝你好运,伙计 首先,让我们弄清楚这里的对象和部分是什么意思。
假设您正在训练一个模型来检测人脸的地标。所以
- 对象是人脸和
- 部分是它的标志性位置李>
1.仅使用对象标记(或注释)数据集,而不使用其部分或,
2.您正在将零件标记为盒子 如果是前者。不要这样做。
如果是后者,则.xml文件必须如下所示:注释为方框的要素点
<image file='/path/to/image/directory/<filename>.jpg'>
<box top='145' left='114' width='239' height='257'>
<box top='178' left='157' width='1' height='1'/>
<box top='179' left='158' width='1' height='1'/>
<box top='155' left='211' width='1' height='1'/>
<box top='152' left='245' width='1' height='1'/>
<box top='187' left='292' width='1' height='1'/>
<box top='340' left='343' width='1' height='1'/>
</image>
二,。当imglab窗口打开时:
a) 在感兴趣的对象周围标注框
b) 双击该框,然后右键单击要表示特征点的位置。弹出菜单会提示您所有可能的标签
imglab-h
<image file='path/to/image/directory/<filename>.jpg'>
<box top='185' left='114' width='238' height='261'>
<label>Hand</label>
<part name='13' x='192' y='200'/>
<part name='20' x='219' y='195'/>
<part name='27' x='277' y='225'/>
<part name='34' x='345' y='382'/>
<part name='38' x='192' y='430'/>
<part name='6' x='123' y='235'/>
</box>
</image>
$ imglab ./<dataset_file>.xml --parts "<label1> <label2> <label3> <label4>"
$ imglab ./data-set.xml --parts "head ears right_eye left_eye"