以下是读取.tfrecord数据的部分代码: data_queue = tf.train.string_input_producer(image_list, shuffle=shuffle) reader = tf.TFRecordReader() fid, serialized_example = reader.read(data_queue) parser = tf.parse_single_example(serialized_example, features=decomp_feature) data_vol = tf.decode_raw(parser['data_vol'], tf.float32) data_vol = tf.reshape(data_vol, raw_size) data_vol = tf.slice(data_vol, [0, 0, 0], volume_size) label_vol = tf.decode_raw(parser['label_vol'], tf.float32) label_vol = tf.reshape(label_vol, raw_size) label_vol = tf.slice(label_vol, [0, 0, 1], label_size)
在读取的过程中,总会报以下的错误:
OutOfRangeError (see above for traceback): RandomShuffleQueue '_3_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 8, current size 0)
根据网上大部分搜索的,可能是数据size和解码tfrecord打包的尺寸不匹配,或者是如下链接所述: