【问题标题】:What is the fastest way to read a list of jpeg images and convert it into TFRecords in TensorFlow?在 TensorFlow 中读取 jpeg 图像列表并将其转换为 TFRecords 的最快方法是什么?
【发布时间】:2017-03-04 13:14:30
【问题描述】:

我有一个 txt 文件中的图像和标签列表,格式如下:

file1.jpg 1

file2.jpg 0

file3.jpg 1

file4.jpg 1

标签是二进制的。

如何将图像数据转换为 TFRecord 文件,而无需将图像分配到标签的子目录(在初始模型数据准备中使用),并且只需读取 jpg 图像?我已经看过 tensorflow 的 TFRecords 教程,但似乎图像已经全部以张量形式构建。

我尝试了以下解决方案: How do I convert a directory of jpeg images to TFRecords file in tensorflow?

但它似乎不起作用。

【问题讨论】:

标签: python image tensorflow tfrecord


【解决方案1】:

按照以下链接中的代码解决您的问题。我完全按照你的要求做了。 (将一组 png 或 jpeg 图像转换为 TfRecords(二进制图像)。我提供了读取 tfrecords 的方法。此外,就我而言,我有一组存储在字符串中的特征,并且我将它们存储到 tfrecords 中。

Creating TfRecords from a list of strings and feeding a Graph in tensorflow after decoding

希望此代码对您有所帮助。

【讨论】:

  • 如果这是旧 q/a 的副本,那么您可能应该在评论中将其称为副本。
猜你喜欢
  • 1970-01-01
  • 2016-02-24
  • 2013-05-12
  • 2011-06-27
  • 1970-01-01
  • 2014-10-21
  • 2019-09-13
  • 2018-02-11
  • 2020-06-05
相关资源
最近更新 更多