首页 > 解决方案 > 以黑色为主的 uint16 图像的训练后量化

问题描述

我的应用程序有一个训练有素的模型,我尝试使用 keras 进行训练后量化。但是后备量化根本不起作用。我的图像是 uint16,它是灰度(1 通道)。我的模型无需量化即可工作。在我的其他应用程序中,量化也适用于 rgb 图像。但是使用后备量化,我的模型和 uint16 灰度数据没有得到很好的输出。这是我使用的图像的分布。

在此处输入图像描述

训练后量化应该怎么做?

这是转换的代码:

{input_data = (img/(255*255)).astype('float32')
interpreter = tf.lite.Interpreter(model_path=TFLiteModelPath)
interpreter.allocate_tensors()

input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()


interpreter.set_tensor(input_details[0]['index'], input_data)
interpreter.invoke()
TFLiteResult = interpreter.get_tensor(output_details[0]['index'])
img =TFLiteResult[0]*255*255}

标签: fallbackquantization

解决方案


推荐阅读