2016-11-29 261 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"

你應該是好去!

相關問題