https://blog.csdn.net/xia4215/article/details/117228500
之前的步骤可以看这篇文档
后续就把johns目录下的所有文件夹全部删除,然后建立你自己的文件夹。
格式为
unique_key/photo1.jpg,photo2.jpg
如:
文件夹1/图片1.jpg,文件夹1/图片2.jpg
文件夹2/图片3.jpg,文件夹2/图片3.jpg
每一个文件夹代表一类,这一类下面的图片都是一个人
然后去调用./dnn_metric_learning_on_images_ex ../johns
训练将会在没有增益的300次结束
// I've set this to something really small to make the example terminate
// sooner. But when you really want to train a good model you should set
// this to something like 10000 so training doesn't terminate too early.
trainer.set_iterations_without_progress_threshold(300);
官方推荐如果你想要训练一个好的模型,可以调整300到10000
如果想要中断训练,退出程序之后,在目录下把face_metric_sync和face_metric_sync_删了就可以
训练完毕
但是有个问题,我是500个人,但是他只对300个人做了测试,而且我查了其他人的网站,也是300。我在看代码哪里做调整。当然300是可以做统计了的
编译之前需要把 dnn_metric_learning_on_images_ex.cpp 中的input_rgb_image改成input_rgb_image_sized<150>
然后再 cmake --build . --config Release --target dnn_metric_learning_on_images_ex
成功!