Tensorflow之快速加载MNIST数据集

from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf

def myprint(v):
    print(v)
    print(type(v))
    try:
        print(v.shape)
    except:
        try:
            print(len(v))
        except:
            pass


if __name__ == '__main__':
    mnist = input_data.read_data_sets('./input_data', one_hot=True, validation_size=100)
    myprint(mnist.train.labels)
    myprint(mnist.validation.labels)
    myprint(mnist.test.labels)
    myprint(mnist.train.images)
    myprint(mnist.validation.images)
    myprint(mnist.test.images)

 

可能由于网络问题,程序无法把数据集下载到'./input_data'目录下,可以手动下载到对应目录:(mnist官网:http://yann.lecun.com/exdb/mnist/  The MNIST database of handwritten digits, available from this page, has a training set of 60,000 examples, and a test set of 10,000 examples.)

train-images-idx3-ubyte.gz:  training set images (9912422 bytes) 
train-labels-idx1-ubyte.gz:  training set labels (28881 bytes) 
t10k-images-idx3-ubyte.gz:   test set images (1648877 bytes) 
t10k-labels-idx1-ubyte.gz:   test set labels (4542 bytes)

 

MNIST降维可视化参考:http://www.cnblogs.com/huangshiyu13/p/6945239.html

转载于:https://www.cnblogs.com/huangshiyu13/p/6727745.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值