解决‘tf.ResizeNearestNeighbor‘ op is neither a custom op nor a flex op

解决'tf.ResizeNearestNeighbor' op is neither a custom op nor a flex op

将tensorflow模型转换为TFlite模型:参考我的博客https://panjinquan.blog.csdn.net/article/details/107231435 ,其中可能会出现转换错误:

'tf.ResizeNearestNeighbor' op is neither a custom op nor a flex op
<unknown>:0: error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag): ResizeNearestNeighbor.

 自从Tensorflow更新到2.0后,我就发现几乎每个版本的都有细微的差异问题,出现这个错误,可能是由于的网络层添加UpSampling2D这些上采样层,但TFlite是支持UpSampling2D操作的.

我可以很负责任的告诉你,TFlite是支持UpSampling2D,在TF2.0下支持float16量化,但不支持int8量化.不能转的原因可能是训练模型的版本,跟你测试的版本不一致导致的,比如当你用TF2.0进行模型训练时,在TF2.2进行TFlite转换,就可能出现这个错误,你需要保证训练和转换TFLite的版本一致即可

最近测试,发现TF升级到最新的TF2.3,完美解决

pip install tensorflow-gpu==2.3.0

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI吃大瓜

尊重原创,感谢支持

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值