zlib。错误:解压时错误-3:距离代码无效

时间:2021-06-07 20:29:28

I was trying to create a model using Tensorflow using the mnist dataset . I have installed Tensorflow Properly and then when i try to create the model using the command .

我试图使用mnist数据集创建一个使用Tensorflow的模型。我已经正确地安装了Tensorflow,然后当我尝试使用命令创建模型时。

python convolutional.py

I am getting an error message on the console :

我在控制台收到一条错误消息:

Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Traceback (most recent call last):
  File "convolutional.py", line 316, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "convolutional.py", line 128, in main
    train_data = extract_data(train_data_filename, 60000)
  File "convolutional.py", line 75, in extract_data
    buf = bytestream.read(IMAGE_SIZE * IMAGE_SIZE * num_images)
  File "/usr/lib/python2.7/gzip.py", line 261, in read
    self._read(readsize)
  File "/usr/lib/python2.7/gzip.py", line 312, in _read
    uncompress = self.decompress.decompress(buf)
zlib.error: Error -3 while decompressing: invalid block type

i am using Python2.7 installed in a 14.04 Ubuntu operating system .

我使用的是安装在14.04 Ubuntu操作系统中的Python2.7。

1 个解决方案

#1


2  

It seems like the source of the problem is invalid data file: "data/train-images-idx3-ubyte.gz". Is there any way to get a fresh copy of the file? Please validate the new copy of the file using the following shell command:

似乎问题的根源是无效的数据文件:“data/train-image -idx3-ubyte.gz”。有什么办法能得到这份文件的新副本吗?请使用以下shell命令验证文件的新副本:

gunzip -t  data/train-images-idx3-ubyte.gz

Once the above test will return answer that the gz file is valid, execute your script:

一旦上述测试将返回gz文件有效的答案,执行您的脚本:

python convolutional.py

#1


2  

It seems like the source of the problem is invalid data file: "data/train-images-idx3-ubyte.gz". Is there any way to get a fresh copy of the file? Please validate the new copy of the file using the following shell command:

似乎问题的根源是无效的数据文件:“data/train-image -idx3-ubyte.gz”。有什么办法能得到这份文件的新副本吗?请使用以下shell命令验证文件的新副本:

gunzip -t  data/train-images-idx3-ubyte.gz

Once the above test will return answer that the gz file is valid, execute your script:

一旦上述测试将返回gz文件有效的答案,执行您的脚本:

python convolutional.py