tensorflow - 如何将图像导入 Tensorflow?

标签 tensorflow

我是 Tensorflow 新手,正在学习 Mnist 简单教程。现在我想用我自己的图像做类似的事情。我不知道该怎么做。本教程是这样做的:

  batch_xs, batch_ys = mnist.train.next_batch(100)

当我从图像创建它时,batch_xs、batch_ys 到底应该是什么?

我看到有一个 ImageFlow 库,这似乎完全符合我的要求,但我也不知道如何使用它。描述说我应该打电话

  convert_images(images, labels, filename)

但它甚至不包含我的图像的路径。

非常感谢您的关注。

最佳答案

查看 mnist.train.next_batch() 的实现,看来 batch_xs 应该是大小为 batch_size x num_pixels 的矩阵,而 batch_ys 应该是一个矩阵大小为 batch_size x num_classes(如果 one_hot 为 True)或长度为 batch_size 的向量(否则)。

当您调用mnist.train.next_batch(100)时,batch_xs将为100 x 784batch_ys 将为 100 x 10。对于您自己的应用程序,您可能需要更改像素数和类数。

关于tensorflow - 如何将图像导入 Tensorflow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35863073/

相关文章:

machine-learning - Tensorflow:确定药物剂量的用例

Tensorflow多维argmax

python - 类型错误 : 'DType' object is not callable

opencv - 如何在运行 Tensorflow 推理 session 之前批处理多个视频帧

tensorflow - 分布式 Tensorflow : check failed: size>=0

python - Tensorflow:如何在应用程序中使用经过训练的模型?

python - Keras plot_model 没有正确显示输入层

python - NotImplementedError : Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array. T

python - 在急切执行期间不支持 session 关键字参数。您通过了 : {'learning_rate' : 1e-05}

tensorflow - 无法使用 get_tensor_by_name 恢复 Dropout