【发布时间】:2018-03-04 07:52:04
【问题描述】:
我正在尝试使用 Tensorflow 来识别 UCI 数据集的手写数字(https://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+Digits)。其中每一行是一个扁平的 8*8 图像像素矩阵,最后一个属性是类代码 0-9。 然而,我遵循的教程是关于 MNIST 数据的,这是完全不同的。它有一个 0-255 值的 28*28 矩阵。所以,它是这样的:
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data", one_hot=True)
x = tf.placeholder('float', [None, 784])
y = tf.placeholder('float')
由于我是 Tensorflow 的新手,我无法为 UCI 数据准备神经网络模型。我只是想要一些关于如何进行的方向。我有 2 个主要问题。
- 这是导入数据的正确方法吗?
- 如何获取'y'标签作为最后一个属性?
目前我正在考虑做这样的事情:
filename_queue = tf.train.string_input_producer(["optdigits.tra"])
reader = tf.TextLineReader()
_, serialized_example = reader.read(filename_queue)
image,label = decode(serialized_example)
x = tf.placeholder('float', [None, 64])
y = tf.placeholder('float')
基本上,我想准备一个具有 64 个节点的输入层和一个带有输出的 'y' 标签来训练 NN model。
【问题讨论】:
标签: python tensorflow machine-learning neural-network mnist