2016-11-29 260 views
0

当我运行mnist = input_data.read_data_sets("MNIST_data", one_hot = True)时出现以下错误。EOFError:压缩文件在达到流尾标记之前结束 - MNIST数据集

EOFError: Compressed file ended before the end-of-stream marker was reached

即使我手动解压缩文件并将其放置在MNIST_data目录,程序仍试图下载文件,而不是使用提取的文件。

当我使用WinZip这是手动方式解压文件时,WinZip告诉我文件已损坏。

我该如何解决这个问题?

我现在甚至无法加载数据集,我仍然需要调试程序本身。请帮忙。

我点安装Tensorflow,所以我没有一个Tensorflow的例子。所以我去GitHub去获取input_data文件并将它保存在我的main.py所在的目录中。错误只是关于.gz文件。该程序无法提取它。

runfile('C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py', wdir='C:/Users/Nikhil/Desktop/Tensor Flow') Reloaded modules: input_data Extracting MNIST_data/train-images-idx3-ubyte.gz C:\Users\Nikhil\Anaconda3\lib\gzip.py:274: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future return self._buffer.read(size) Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py', wdir='C:/Users/Nikhil/Desktop/Tensor Flow')

File "C:\Users\Nikhil\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace)

File "C:\Users\Nikhil\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py", line 26, in mnist = input_data.read_data_sets("MNIST_data/", one_hot = True)

File "C:\Users\Nikhil\Desktop\Tensor Flow\input_data.py", line 181, in read_data_sets train_images = extract_images(local_file)

File "C:\Users\Nikhil\Desktop\Tensor Flow\input_data.py", line 60, in extract_images buf = bytestream.read(rows * cols * num_images)

File "C:\Users\Nikhil\Anaconda3\lib\gzip.py", line 274, in read return self._buffer.read(size)

File "C:\Users\Nikhil\Anaconda3\lib_compression.py", line 68, in readinto data = self.read(len(byte_view))

File "C:\Users\Nikhil\Anaconda3\lib\gzip.py", line 480, in read raise EOFError("Compressed file ended before the "

EOFError: Compressed file ended before the end-of-stream marker was reached

+0

你碰巧解决了这个错误?我收到类似的错误。 – Moondra

回答

1

这是因为某些原因,您对MNIST数据集的下载不完整。

您必须手动删除通常驻留在~/.keras/datasets或您相对于此路径指定的任何路径下载的文件夹,您的情况为MNIST_data

执行在终端下面的步骤(CTRL + ALT + T):

  1. cd ~/.keras/datasets/
  2. rm -rf "dataset name"

你应该是好去!

相关问题