biubug6 / Face-Detector-1MB-with-landmark

1M人脸检测模型(含关键点)
MIT License
1.02k stars 271 forks source link

add mnn inference #38

Open syshensyshen opened 4 years ago

syshensyshen commented 4 years ago

mnn framework for face detect and landmark

rlczddl commented 2 years ago

为什么mnn版本无法用opencl或者cuda后端推理 程序会直接崩溃 有些层不支持吗

syshensyshen commented 2 years ago
  1. mnn op kernel cuda/opencl implementation may be not enough when onnx model has dynamic input shape,
  2. you can try long-side or short-side alignment resize input image, fixed pytorch export onnx model input size,onnx-simplifer model, delete some dynamic shape slice infer operations like permute/gather/scatter
rlczddl commented 2 years ago

感谢回复,我去试下。我注意到了导出的onnx模型输入是320,然后推理用的256。

rlczddl commented 2 years ago

你好,我找到原因了,与mnn无关,原因在于https://github.com/syshensyshen/Face-Detector-1MB-with-landmark/blob/ec64e16f41ef25e9fcfc9e576dc9fdbd8c5c24db/Face_Detector_mnn/reatinaface.cpp#L175, 这边应该传入的拷贝回来的host变量,因为你用的是cpu推理所以getSessionOutput回来的也是cpu所以传入没错,换成opencl后端自然就出错了

syshensyshen commented 2 years ago

it is my fault,thank you!