简体   繁体   English

如何使用张量流加载我自己的图像数据?

[英]How to load my own Image data with tensorflow?

I have an image set which has 300,000 images in it. 我有一个包含300,000张图像的图像集。 There are 10000 categories and 30 images per category . 10,000个类别每个类别30张图像 Each image file name is like 01_flower.png, 02_flower.png, 01_cat.png ... . 每个图像文件名都类似于01_flower.png, 02_flower.png, 01_cat.png ...

The question is: 问题是:

  1. How to load these images with tensorflow. 如何使用张量流加载这些图像。

  2. How to encode testing image tag to one hot vector. 如何将测试图像标签编码为一个热矢量。

Really appreciate your help. 非常感谢您的帮助。

It is hard to tell where exactly your Problems start. 很难说出您的问题从何开始。

To get you started, there are multiple ways to load data into a TensorFlow program: 首先,有多种方法可以将数据加载到TensorFlow程序中:

  • Feeding: Python code provides the data when running each step. 提要:运行每个步骤时,Python代码都会提供数据。
  • Reading from files: an input pipeline reads the data from files at the beginning of a TensorFlow graph. 从文件读取:输入管道在TensorFlow图的开头从文件读取数据。
  • Preloaded data: a constant or variable in the TensorFlow graph holds all the data (for small data sets). 预加载的数据:TensorFlow图中的常量或变量包含所有数据(适用于小型数据集)。

A small Code example could look like that: 一个小的代码示例如下所示:

with tf.Session():
  input = tf.placeholder(tf.float32)
  classifier = ...
  print(classifier.eval(feed_dict={input: your_data}))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM