MNIST安装以及出现的问题

1.通过代码下载:

from tensorflow.examples.tutorials.mnist import input_data
mnist =input_data.read_data_sets("MNIST_data/", one_hot  = True)

其中input_data.py中没有任何函数、类,重要的是代码中导入了read_data_sets模块:

该模块中存在read_data_sets函数体,其中SOURCE_URL属性值可能会造成无法下载成功,我推荐两种选择url1 = "https://storage.googleapis.com/cvdf-datasets/mnist/"和url2 = "http://yann.lecun.com/exdb/mnist/",我是用的url1能够下载,url2不可以

2.测试是否下载成功

#查看训练数据大小
print(mnist.train.images.shape)
print(mnist.train.labels.shape)
#查看验证数据大小
print(mnist.validation.images.shape)
print(mnist.validation.labels.shape)
#查看测试数据大小
print(mnist.test.images.shape)
print(mnist.test.labels.shape)

3.执行结果:

(55000, 784)
(55000, 10)
(5000, 784)
(5000, 10)
(10000, 784)
(10000, 10)




 
 

猜你喜欢

转载自blog.csdn.net/weixin_42694291/article/details/81044287