调试tensorflow1.X版本的代码在tensorflow2.0以上运行时再reshape时会报错:Value passed to parameter 'input' has DataType uint8 not in list of allowed values: float16, bfloat16, float32, float64
具体修改方法
源代码:
lic = lic.reshape(1, 240, 80, 3)
img_src_copy, Lic_img = img_src, [lic]
修改方法一:
lic = lic.reshape(1, 240, 80, 3)
lic = tf.cast(lic,tf.float32)
img_src_copy, Lic_img = img_src, [lic]
修改方法二
lic = lic.reshape(1, 240, 80, 3)
lic = lic .astype(float)
img_src_copy, Lic_img = img_src, [lic]