原来在一本书上看到过,从多个tfrecord文件中读取数据的方法,今天想用在网上找了一下,现在记录一下,免得自己以后忘记了又不好找,

tfrecord_file_path = '/train/*.tfrecords'#train是存放tfrecord的文件夹
filename_queue = tf.train.string_input_producer(
               tf.train.match_filenames_once(tfrecord_file_path),
               shuffle=True, num_epochs=None) #None表示没哟限制
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)  #返回文件名和文件
features = tf.parse_single_example(serialized_example,
                    features={XXXXXXX}) #取出XXXXXXX