当前位置:首页 » python教程 » 正文

从多个tfrecord文件中无限读取文件的例子

看: 929次  时间:2020-08-13  分类 : python教程

原来在一本书上看到过,从多个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

以上这篇从多个tfrecord文件中无限读取文件的例子就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持python博客。

<< 上一篇 下一篇 >>

搜索

推荐资源

  Powered By python教程网   鲁ICP备18013710号
python博客 - 小白学python最友好的网站!