大多数示例都使用手写数字MNIST数据集[1]。 数据集包含60,000个培训样本和10,000个测试样本。 这些数字是标准化的,位于形象的中心。 图像为固定大小(28x28像素),值为0到1。 为了简单起见,每个图像都被展平,转换为具有784*28 )个特征的一维numpy数组。
概览
。
用法
在本示例中,为tensor flow https://Github.com/tensor flow/tensor flow/Blob/r 0.7/tensor flow/Examples /教程/Tutorials/Tuturior非常有助于管理数据,并且可以:
加载数据集将整个数据集加载到numpy数组中导入到MNIST
fromtensorflow.examples.tutorials.mnistimportinput _数据
Mn ist=输入数据.读取数据集('/tmp /数据/',一个热=真) ) ) ) ) ) ) ) )。
# #数据加载
X_train=mnist.train.images
Y_train=mnist.train.labels
x _ test=最大值. test.images
y _ test=Mn ist.test .标签
下一个函数。 可以遍历整个数据集,只返回所需数据集的样本部分。 这样可以节省内存,避免加载整个数据集。 # #获取以下64个图像排列和标签
batch_X,batch _ y=Mn ist.train .下一个(64 ) ) ) ) ) ) ) ) ) ) )。
[1] :3358 yann.le Cun.com/exdb/Mn ist /