Open pose 量化时转 tflite 的模型过程中一直报错

我最近在尝试量化 open pose 这个项目, 已经成功得到了 quantized aware training 的模型,并且用 evaluation graph 得到了 pb 文件,之后用 freeze_graph.freeze_graph 得到了 frozen pb,这些步骤都成功了,但是之后将 pb 转为 tflite 的模型过程中一直报错 ,错误都是类似的:

Unimplemented: this graph contains an operator of type Cast for which the quantized form is not yet implemented.

我尝试修改 bug。 第一次报错是 contains an operator FusedBatchNormV3 which the quantized form is not yet implemented, 我在 tensorflow12.0 环境下 freeze 模型,得到的便是 FusedBatchNorm 而不是 FusedBatchNormV3 了(之前用的是 tensorflow14.0rc 版本)

第二次报错是 contains an operator Size which the quantized form is not yet implemented. 我将 eval 模型中的 batchsize 固定为 1, 该错误消失

第三次报错是 contains an operator Cast which the quantized form is not yet implemented, 具体的位置如下图所示:

这个错误找了好久都没法解决。不知道成果转换之后的模型 fuse batchnorm 这块都是什么样的呢。我现在没法确定是伪量化训练过程中的问题,还是说是 eval 中的问题。求大神指导。

多谢!


小祥,发表于 2019-6-13 11:19:26