Tencent / ncnn

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

尝试按照官方步骤转换yolact出现错误 #1706

Closed gujingxiao closed 4 years ago

gujingxiao commented 4 years ago

如题,我按照官方的讲解 https://zhuanlan.zhihu.com/p/128974102 ,尝试了yolact的转换,转换过程中都比较顺利,但是转换后的结果与官方给的出现了差别,并且在使用ncnn运行中出现了错误,具体描述如下: 系统环境:Ubuntu16.04 pytorch1.4.0 ncnn版本为最新的20200413
onnx版本 1.6.0 onnx simplier 0.2.6 onnx runtime 1.2.0

操作步骤:

  1. 操作步骤以及使用的模型完全按照官方流程操作,整个转换过程没有出现问题,但是转换出来的param里面层的name与官方给的对应不上,可以参考下面给出的附件yolact.txt。 官方example里面给出的取出层分别为:
    ex.extract("619", maskmaps);// 138x138 x 32 ex.extract("816", location);// 4 x 19248 ex.extract("818", mask);// maskdim 32 x 19248 ex.extract("820", confidence);// 81 x 19248

    我操作之后,对应的层为617 813 815 817

  2. 模型转好之后,我使用了example代码进行推理,加载模型等都正常,但是在 ex.extract("617", maskmaps);// 138x138 x 32 ex.extract("813", location);// 4 x 19248 ex.extract("815", mask);// maskdim 32 x 19248 ex.extract("817", confidence);// 81 x 19248 运行之后,只有maskmaps里面有数值,location、mask和confidence里面全部为空 微信截图_20200420180110 微信截图_20200420180200

  3. 所以目前不知道具体哪里操作错误,还请大佬帮忙分析,感谢感谢

nihui commented 4 years ago

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

gujingxiao commented 4 years ago

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

我刚刚核对的时候也发现,感谢官方答复,现在结果正常了,谢谢!

liulai commented 4 years ago

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

我刚刚核对的时候也发现,感谢官方答复,现在结果正常了,谢谢!

老哥,我跑这个yolact.cpp,模型都能跑出结果,但是后面报错了。请问下你用的什么设备啊?

piaoliuping123 commented 4 years ago

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

我刚刚核对的时候也发现,感谢官方答复,现在结果正常了,谢谢!

你好,dalao, 我遇到和你一样的问题,请问你是怎么解决的?谢谢

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

我刚刚核对的时候也发现,感谢官方答复,现在结果正常了,谢谢!

老哥,我跑这个yolact.cpp,模型都能跑出结果,但是后面报错了。请问下你用的什么设备啊?

您好,我在执行./ncnnoptimize yolact.param yolact.bin yolact-opt.param yolact-opt.bin 0 这条命令的时候报错,显示如下: Input layer input.1 without shape info, shape_inference aborted unsupported resize type 0 unsupported resize type 0 unsupported resize type 0 请问怎么解决,谢谢了

zqnnn commented 4 years ago

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

我刚刚核对的时候也发现,感谢官方答复,现在结果正常了,谢谢!

你好,dalao, 我遇到和你一样的问题,请问你是怎么解决的?谢谢

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

我刚刚核对的时候也发现,感谢官方答复,现在结果正常了,谢谢!

老哥,我跑这个yolact.cpp,模型都能跑出结果,但是后面报错了。请问下你用的什么设备啊?

您好,我在执行./ncnnoptimize yolact.param yolact.bin yolact-opt.param yolact-opt.bin 0 这条命令的时候报错,显示如下: Input layer input.1 without shape info, shape_inference aborted unsupported resize type 0 unsupported resize type 0 unsupported resize type 0 请问怎么解决,谢谢了

你解决这个问题了吗?我也遇到了

nihui commented 4 years ago

Input layer input.1 without shape info, shape_inference aborted unsupported resize type 0

这两种提示可以无视的...

zqnnn commented 4 years ago

Input layer input.1 without shape info, shape_inference aborted unsupported resize type 0

这两种提示可以无视的...

忽略这个进行./ncnn2table会出现这个问题。。 ./ncnn2table --param ../psenet_lite_nobn_fp32.param --bin ../psenet_lite_nobn_fp32.bin --images ../../../../data/final_test/imgs/ --output psenet_lite_nobn.table --mean=104,117,123 --norm=0.017,0.017,0.017 --size=185,40 --thread=2 --- ncnn post training quantization tool --- 16:26:39 Apr 26 2020 fopen true failed fopen true failed not found [Input] Layer, Check your ncnn.param

gujingxiao commented 4 years ago

你的 param 中 Concat axis 没改啊 0x6 手工微调模型 这一段再看看

我刚刚核对的时候也发现,感谢官方答复,现在结果正常了,谢谢!

老哥,我跑这个yolact.cpp,模型都能跑出结果,但是后面报错了。请问下你用的什么设备啊?

我先在windows上测得,结果正常了;后来放到了安卓上和linux服务器上,也都没问题

gujingxiao commented 4 years ago

官方大佬的教程还是非常棒的,我后来又修改了mobilenetv2做backbone,还修改了各种比例和特征层,都完美支持,手动点个赞。 @nihui

ReverseSystem001 commented 4 years ago

Input layer input.1 without shape info, shape_inference aborted unsupported resize type 0 这两种提示可以无视的...

忽略这个进行./ncnn2table会出现这个问题。。 ./ncnn2table --param ../psenet_lite_nobn_fp32.param --bin ../psenet_lite_nobn_fp32.bin --images ../../../../data/final_test/imgs/ --output psenet_lite_nobn.table --mean=104,117,123 --norm=0.017,0.017,0.017 --size=185,40 --thread=2 --- ncnn post training quantization tool --- 16:26:39 Apr 26 2020 fopen true failed fopen true failed not found [Input] Layer, Check your ncnn.param 问题出在这,所有--参数后面都要添加=号,要不找不到...... ./ncnn2table --param=out-opt.param

nihui commented 2 months 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