Unable To Read From Tensorflow Tfrecord File
I am able to create the tfrecords file by using the below code. def _int64_feature(value): return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) def _bytes_fea
Solution 1:
The error is raised because tf.train.shuffle_batch
needs to know the shape of your tensors to be able to batch them (items in a batch must have all the same shape).
In principle, however, raw data can have different sizes, so tf.decode_raw
doesn't set any shape for your tensor.
In the comments, you mention that all your images have shape (192,81,2)
, so you only need to set that shape in the image tensor before returning from read_and_decode
:
defread_and_decode(filename_queue):
# rest of your code here
image_shape = [height, width, depth]
image = tf.reshape(image, image_shape)
image.set_shape(image_shape) #<<<<<<<<<<<<<<<return image,label
Post a Comment for "Unable To Read From Tensorflow Tfrecord File"