[941]mnist数据集问题

raise IOError, ‘Not a gzipped file’

There is an error:

File "tensorflow/models/image/mnist/convolutional.py", line 59, in extract_data
    bytestream.read(16)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 268, in read
    self._read(readsize)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 303, in _read
    self._read_gzip_header()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 197, in _read_gzip_header
    raise IOError, 'Not a gzipped file'

解决方法:

The code attempts to download the data files from the MNIST web site, and assumes it’s properly downloaded if the file is present locally on your system. You might have a corrupted file, in which case deleting it and retrying might help. Otherwise, try to get the data via your browser directly from:

下载后替换原来的文件就没有问题了

http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz 
http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz 
http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz 
http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz

from tensorflow.examples.tutorials.mnist import input_data在未来的版本中将被移除解决方法

在学习神经网络时,经常会用到MNIST数据集,使用Tensorflow导入数据集的时候,使用以下方法有时会出现警告

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

解决方法是修改为以下代码

from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
import tensorflow as tf
mnist = read_data_sets("MNIST_data/", one_hot=True)

成功导入结果

Extracting MNIST_data/train-images-idx3-ubyte.gz
Extracting MNIST_data/train-labels-idx1-ubyte.gz
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz

参考:https://blog.csdn.net/Julialove102123/article/details/70226249/
https://blog.csdn.net/qq1440643730/article/details/104122320

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周小董

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值