简体   繁体   English

量化模型的 QAT 输出节点具有相同的最小最大范围

[英]QAT output nodes for Quantized Model got the same min max range

Recently, I have worked on quantization aware training on tf1.x to push the model to Coral Dev Board.最近,我在 tf1.x 上进行了量化感知训练,以将模型推送到 Coral Dev Board。 However, when I finished training the model, why is my min max of my 2 outputs fake quantization is the same?但是,当我完成模型训练后,为什么我的 2 个输出伪量化的最小值最大值相同?

Should it be different when one's maximum target is 95 and one is 2pi?当一个人的最大目标是 95 和一个是 2pi 时,它应该不同吗?

量化感知训练的最小最大值相同

I have figured out the problem.我已经想通了这个问题。 It is the problem when that part of the model is not really trained QAT.当模型的那部分没有真正训练过 QAT 时,就会出现问题。 This happens for the output node that somehow forgets to QAT when training.这种情况发生在训练时不知何故忘记 QAT 的输出节点。 The -6 and 6 values come from the default source of the quantization of tf1.x as mention here -6 和 6 值来自这里提到的 tf1.x 量化的默认来源

To overcome the problem, we should provide some op to trigger the QAT for the output nodes.为了克服这个问题,我们应该提供一些操作来触发输出节点的 QAT。 In my regression case, I add a dummy op: tf.maximum(output,0) in the model to make the node QAT.在我的回归案例中,我在模型中添加了一个虚拟操作:tf.maximum(output,0) 以使节点 QAT。 If your output is strictly between 0-1, applying "sigmoid" activation at output instead of relu can also solve the problems.如果您的输出严格在 0-1 之间,则在输出处应用“sigmoid”激活而不是 relu 也可以解决问题。

这个

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

相关问题 在FPGA / pure python上运行量化张量流模型 - Run quantized tensorflow model on FPGA / pure python 如何将pytorch模型输出归一化在[0,1]范围内 - How to normalize pytorch model output to be in range [0,1] PyTorch 找到关键点:output 节点在一个范围内和负损失 - PyTorch find keypoints: output nodes to be in a range and negative loss ONNX 量化 Model 类型错误:类型“张量(float16)” - ONNX Quantized Model Type Error: Type 'tensor(float16)' 我得到了不同的 output 形状和不同的深度学习 model 声明 - I got different output shape with different Deep Learning model declaration tensorflow 中的最小和最大池化 - Min and Max pooling in tensorflow 隐藏层所有节点的输入都相同,那么它们的输出如何区分? - input to all nodes of hidden layers are same then how they differentiate in their output? Tensorflow Object Detection API 的模型配置中的 min_scale 和 max_scale - min_scale and max_scale in the model config of Tensorflow Object Detection API 在.h5 model 和.pb model 之间得到小 output 值错误 - Got small output value error between .h5 model and .pb model CNN model 预测任何输入的相同 output - CNN model predicting the same output for any inputs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM