reshape转换失败
来源:5-5 Train部分代码编写

韩悦丶
2020-10-29
老师我在获取获取打包数据进行reshape提示我输入数据的tensor和要求的输入数据的tansor数量不对等,差了4倍
代码:
example = tf.compat.v1.parse_example(batch,feature)
images = tf.decode_raw(example[‘image’],tf.float32)
images = tf.reshape(images,[batchSize,32,32,3])
报错信息:
InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 49152 values, but the requested shape has 196608
[[node Reshape (defined at D:\Python\t\get_data.py:83) ]]
写回答
1回答
-
会写代码的好厨师
2020-10-29
数据应该是因为做了jpg编码,编码以后的数据大小会不同,所以要先做一次解码才能用。修改方式,一种是打包和读取都不做jpg编码,存rgb原始数据。或者,打包做编码,读取的时候做解码。不知道是否可以理解?
012020-11-02
相似问题