介绍CenterNet人脸检测项目如何使用。
与CenterNet一致,参考INSTALL.md
- 下载 WIDERFACE数据集
- 下载RetinaFace提供的标注集,包含bounding boxes 和 five facial landmarks
切换到
src/tools/widerface/
目录下,
修改get_widerface_landmark.py中行末位置的txt_path和save_path路径,分别用于训练和验证数据,然后运行。
修改keypoints2coco.py.py中行末位置的img_path、txt_path和save_path路径,分别用于训练和验证数据,然后运行。
数据集最终形成如下的目录。
WiderFace |-- |-- WIDER_train | |-- images | | |-- xxxxx.jpg | | |-- ... | |-- keypoints_train.json |-- WIDER_val | ... |-- WIDER_test | ...
opts选项按需要自己设置,运行类似如下命令
python main.py multi_pose --exp_id widerface --arch dla_34 --dataset face
这里只评估了bbox, 未对landmark进行评估。
python test.py multi_pose --exp_id widerface --arch dla_34 --dataset face --load_model ../exp/multi_pose/widerface/model_best.pth --keep_res
python eval_widerface.py multi_pose --exp_id widerface --arch dla_34 --dataset face --load_model ../exp/multi_pose/widerface/model_best.pth --keep_res
python demo.py multi_pose --demo /path/to/image/or/folder/or/video/or/webcam --arch dla_34 --load_model ../models/xxx.pth