简体   繁体   English

使用 TF-lite 将 MobileFacenet 转换为量化感知 model 时,create_training_graph() 失败

[英]create_training_graph() failed when converted MobileFacenet to quantize-aware model with TF-lite

I am trying to quantize MobileFacenet ( code from sirius-ai ) according to the suggestion and I think I met the same issue as this one我正在尝试根据建议量化MobileFacenet来自 sirius-ai 的代码),我认为我遇到了与这个相同的问题

When I add tf.contrib.quantize.create_training_graph() into training graph当我将tf.contrib.quantize.create_training_graph()添加到训练图中
(train_nets.py ln.187: before train_op = train(...) or in train() utils/common.py ln.38 before gradients) (train_nets.py ln.187:在train_op = train(...)之前或train() utils/common.py ln.38 之前的梯度)

It did not add quantize-aware ops into the graph to collect dynamic range max\min.它没有在图中添加量化感知操作来收集动态范围 max\min。

I assume that I should see some additional nodes in tensorboard, but I did not, thus I think I did not successfully add quantize-aware ops in training graph.我假设我应该在 tensorboard 中看到一些额外的节点,但我没有,因此我认为我没有成功地在训练图中添加量化感知操作。 And I try to trace tensorflow, found that I got nothing with _FindLayersToQuantize().我尝试追踪 tensorflow,发现我对 _FindLayersToQuantize() 一无所获。

However when I add tf.contrib.quantize.create_eval_graph() to refine the training graph.但是,当我添加tf.contrib.quantize.create_eval_graph()来优化训练图时。 I can see some quantize-aware ops as act_quant... Since I did not add ops in training graph successfully, I have no weights to load in eval graph.我可以看到一些量化感知操作作为act_quant ...由于我没有成功在训练图中添加操作,因此我没有权重可以加载到评估图中。 Thus I got some error message as因此我收到了一些错误消息

Key MobileFaceNet/Logits/LinearConv1x1/act_quant/max not found in checkpoint

or或者

tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value MobileFaceNet/Logits/LinearConv1x1/act_quant/max

Does anyone know how to fix this error?有谁知道如何解决这个错误? or how to get quantized MobileFacenet with good accuracy?或者如何以高精度获得量化的 MobileFacenet?

Thanks!谢谢!

H, H,

Unfortunately, the contrib/quantize tool is now deprecated.不幸的是,contrib/quantize 工具现在已被弃用。 It won't be able to support newer models, and we are not working on it anymore.它将无法支持较新的模型,我们不再致力于它。

If you are interested in QAT, I would recommend trying the new TF/Keras QAT API .如果您对 QAT 感兴趣,我建议您尝试新的TF/Keras QAT API We are actively developing that and providing support for it.我们正在积极开发它并为其提供支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM