Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.15k stars 4.14k forks source link

bad result with onnx converted model #436

Closed junedgar closed 6 years ago

junedgar commented 6 years ago

I trained mobilenetv2 model which used the pytorch 0.4. Then i converted the pythorch model to onnx model followed the guidance . In the end, i used the onnx2ncnn tool to convert the onnx model, but the output matrix always None.

I also use the PytorchConverter , but results didn't match which tested on python.

Can you show me some ncnn examples which use the model converted from pytorch?

Thank you @nihui

junedgar commented 6 years ago

I solved the problem by using PytorchConverter, there is something wrong when I preprocessed the image.

nihui commented 1 month ago

针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn

pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]

详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx