Input to reshape is a tensor with 37632 values, but the requested shape has 150528

前端 未结 3 1726
礼貌的吻别
礼貌的吻别 2020-12-18 03:20

I have the same question:Input to reshape is a tensor with 37632 values, but the requested shape has 150528.

 writer = tf.python_io.TFRecordWriter(\"/home/he         


        
3条回答
  •  死守一世寂寞
    2020-12-18 03:57

    I had the same error just like you, and I found the reason behind it. It is because when you store your image with .tostring(), the data is stored with the format of tf.float32. Then you decode the tfrecord with decode_raw(tf.uint8), which causes the dismatch error. I solved it by change the code to:

    image=tf.decode_raw(image_raw,tf.float32)
    

    or:

    image=tf.image.decode_jpeg(image_raw,channels=3)
    

    if you image_raw is jpeg format originally

提交回复
热议问题