使用OpenVino运行MTCNN

时间:2019-06-20 09:05:58

标签: python face-detection openvino

我正在尝试使用OpenVino python API运行MTCNN人脸检测,但是,转换后的模型的性能与原始模型相比大大降低了。我想知道如何获得类似的结果。

我使用以下命令将mtcnn caffe models转换为OpenVino * .xml和* .bin文件。

python3 mo.py --input_model path/to/PNet/det1.caffemodel --model_name det1 --output_dir path/to/output_dir
python3 mo.py --input_model path/to/RNet/det2.caffemodel --model_name det2 --output_dir path/to/output_dir
python3 mo.py --input_model path/to/ONet/det3.caffemodel --model_name det3 --output_dir path/to/output_dir

并使用step_by_step mtcnn jupyter notebook检查转换后的模型的性能。

但是使用OpenVino模型的检测结果明显下降。要重新生成结果,只需要在笔记本中加载OpenVino模型而不是pytorch模型即可。

要重新生成结果,请执行以下步骤。

克隆https://github.com/TropComplique/mtcnn-pytorch.git

并使用this jupyter notebbok

您将看到在P-Net之后的第一阶段中检测到的盒子比原始模型step_by_step mtcnn jupyter notebook中检测到的盒子更多。

您对此有何评论?看起来在模型转换中没有问题,唯一的区别是pytorch具有可变的张量大小(FloatTensor),但对于OpenVino,我必须为每个比例重塑输入大小。这可能是获得不同结果的原因,但是我无法解决此问题。

1 个答案:

答案 0 :(得分:1)

我经历了所有可能犯的错误,并检查了将list_topologies.yaml的mtcnn模型转换为参数。该文件随OpenVino安装一起提供,并列出了诸如比例平均值等的参数。

最后,我通过使用MXNET预训练的MTCNN networks解决了这个问题。

我希望这对可能遇到此问题的其他用户有所帮助。