Toybrick

楼主: protossw512

【已解决!】RKNN转换Tensorflow官方的Deeplabv3后inference结果不

protossw512

中级会员

积分
252
楼主
发表于 2019-3-5 05:11:15    查看: 22171|回复: 18 | [复制链接]    打印 | 显示全部楼层
本帖最后由 protossw512 于 2019-3-6 07:32 编辑

问题已经解决了,原因是中间层的输出是channel first的,所以reshap的时候需要注意。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

protossw512

中级会员

积分
252
沙发
 楼主| 发表于 2019-3-5 16:28:55 | 显示全部楼层
raul 发表于 2019-3-5 16:17
谢谢反馈,我这里复现下。

顺便一说,我在这里调出了第一层conv(MobilenetV2/Conv/Conv2D)的结果,发现已经不对了。
然后我尝试避免使用rknn自带的图像归一化,直接用 (0. 0. 0. 1.0),然后自己把图像转成np.float32,再自己做归一化,结果inference的时候出现了segmentation fault不知道为什么,np.float16也不行。
我的quantization一直都没开。
有没有其他什么办法能调出rknn归一化后输入网络之前的数据么?
回复

使用道具 举报

protossw512

中级会员

积分
252
板凳
 楼主| 发表于 2019-3-6 03:26:07 | 显示全部楼层
raul 发表于 2019-3-5 16:17
谢谢反馈,我这里复现下。

你好,问题已经解决了,原因是中间层的输出是channel在前面的,所以最后的输出reshape不应该是1, 65, 65, 21, 而应该是1, 21, 65, 65。然后再np.transpose成 1, 65, 65, 21进行处理。

非常感谢大家的帮助!
回复

使用道具 举报

protossw512

中级会员

积分
252
地板
 楼主| 发表于 2019-3-8 14:25:30 | 显示全部楼层
chuyee 发表于 2019-3-8 07:56
What's the inference time do you get for DeepLabv3? Is it possible for less than 1s?

Deeplabv3+ is not actually as computation intensive as you think of. Depending on your network architecture, you can run mobilnetv2_dm0.5 up to 15 fps with input size of 513x513.
回复

使用道具 举报

protossw512

中级会员

积分
252
5#
 楼主| 发表于 2019-3-13 06:08:24 | 显示全部楼层
chuyee 发表于 2019-3-12 16:55
I answer it myself, dm stands for depth multiplier. 0.5 means halve the number of channels used in ...

Yep, the first frame cannot represent general runtime on tensorflow framework. Even if you use dm=1.0 and add aspp and decoder, you can still run it with 10 fps with input size of 513x513, pretty amazing.
回复

使用道具 举报

protossw512

中级会员

积分
252
6#
 楼主| 发表于 2019-3-15 04:46:19 | 显示全部楼层
chuyee 发表于 2019-3-13 15:29
Here is my deeplabv3 result on 3399pro. I only get 3FPS. I'm using the rknn model converted from dee ...

depends on what input / output node are you using, and whether you quantize your model.
回复

使用道具 举报

protossw512

中级会员

积分
252
7#
 楼主| 发表于 2019-3-26 04:18:28 | 显示全部楼层
chuyee 发表于 2019-3-26 03:56
@protossw512, see my bug report for rknn.perf_eval() on http://t.rock-chips.com/forum.php?mod=view ...

I am pretty sure, since after tested on Python with official mobilenet deeplabv3 I switched to C++ and use native C++ code evaluated the performance on my own deeplabv3.
In addition to official mobilenet version, I added decoder and aspp modules, which brings additional operations and input size of 400x400. I am able to run it with 9.x FPS.
I also find using node argmax is pretty slow, so I used biasAdd as output, and write my own implementation on C++ to get segmentation result.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表