我正在尝试从TFrecords文件中读取图像。图像的形状各不相同。阅读后,我想保留它们的形状,这就是我适当地传递高度,宽度和深度参数的原因。但是代码只是在set_shape命令之后才打印出来。我在main函数中初始化了会话。有没有办法获得高度,w,d张量的值,以便我可以将它传递给set_shape?我该如何解决?欢迎任何建议。提前谢谢。
SELECT * FROM table_1 ORDER BY date DESC LIMIT 10
这是我的主要职能:
def read_and_decode(sess,filename_queue):
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
features = tf.parse_single_example(
serialized_example,
# Defaults are not specified since both keys are required.
features={
'height': tf.FixedLenFeature([], tf.int64),
'width': tf.FixedLenFeature([], tf.int64),
'depth': tf.FixedLenFeature([], tf.int64),
'image_raw': tf.FixedLenFeature([], tf.string),
'label': tf.FixedLenFeature([], tf.int64),
})
# Convert from a scalar string tensor (whose single string has
# length mnist.IMAGE_PIXELS) to a uint8 tensor with shape
# [mnist.IMAGE_PIXELS].
image = tf.decode_raw(features['image_raw'], tf.uint8)
image.set_shape([sess.run(features['height']),sess.run(features['width']),sess.run(features['depth'])])
和load_input()函数调用read_and_decode()。
def main(argv=None):
with tf.Graph().as_default():
sess=tf.Session()
pdb.set_trace()
load_inputs(sess,FLAGS.batch_size)