我有一堆图像的格式类似于Cifar10(二进制文件,size = 96*96*3每个图像的字节数),一个接一个的图像(STL-10数据集).我正在打开的文件有138MB.
我试着阅读并检查包含图像的张量的内容,以确保阅读正确,但我有两个问题 -
FixedLengthRecordReader加载整个文件,但只是提供一个输入端在同一时间?因为读取第一个size字节应该相对较快.但是,代码运行大约需要两分钟.sess.run(uint8image),但结果是空的.代码如下:
import tensorflow as tf
def read_stl10(filename_queue):
class STL10Record(object):
pass
result = STL10Record()
result.height = 96
result.width = 96
result.depth = 3
image_bytes = result.height * result.width * result.depth
record_bytes = image_bytes
reader = tf.FixedLengthRecordReader(record_bytes=record_bytes)
result.key, value = reader.read(filename_queue)
print value
record_bytes = tf.decode_raw(value, tf.uint8)
depth_major = tf.reshape(tf.slice(record_bytes, [0], [image_bytes]),
[result.depth, result.height, result.width])
result.uint8image = tf.transpose(depth_major, [1, 2, 0])
return result
# probably …Run Code Online (Sandbox Code Playgroud)