简体   繁体   中英

loading fashion_mnist data takes too much time

I am using python 3.6.6, tensorflow 1.11.0, and keras 2.1.6 on Windows 10 Following the below blog as a guideline to import and load the data.

https://www.tensorflow.org/tutorials/keras/basic_classification

The shell IDLE prints too much output and continues indefinitely.

This line in my code seems to be the issue:

(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()

Below are a few lines of output from my shell IDLE execution:

1.11.0

Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-images-idx3-ubyte.gz

    8192/26421880 [..............................] - ETA: 0s
   16384/26421880 [..............................] - ETA: 2:05
  172032/26421880 [..............................] - ETA: 21s 
  450560/26421880 [..............................] - ETA: 11s
  933888/26421880 [>.............................] - ETA: 7s 
 1507328/26421880 [>.............................] - ETA: 5s
 2056192/26421880 [=>............................] - ETA: 4s
 2670592/26421880 [==>...........................] - ETA: 4s
 3358720/26421880 [==>...........................] - ETA: 3s
 3833856/26421880 [===>..........................] - ETA: 3s
 4259840/26421880 [===>..........................] - ETA: 3s
 4489216/26421880 [====>.........................] - ETA: 3s
 4931584/26421880 [====>.........................] - ETA: 3s
 4997120/26421880 [====>.........................] - ETA: 3s
 5005312/26421880 [====>.........................] - ETA: 3s
 5013504/26421880 [====>.........................] - ETA: 4s
 5021696/26421880 [====>.........................] - ETA: 4s
 5029888/26421880 [====>.........................] - ETA: 4s
 5038080/26421880 [====>.........................]

Why the shell does not stop? I appreciate any help.

我相信 IDLE 的 shell 不够快,可能会减慢文件下载速度,请尝试从终端运行相同的 Python 代码,因为它会下载文件,并且只需执行一次。

To execute Matias Valdenegro's answer of loading outside IDLE you can open Python's Command Line (or on Windows' Command Line type python and press Enter).
Then type
import tensorflow as tf
Press Enter and type:
tf.keras.datasets.mnist.load_data()
Press Enter, wait, and in the end you're ready to use mnist on IDLE without having to load again.

Faced the same issue & does the following on Window machine -

  1. Get into Python (Shell) Command line Interface by typing python. Then in Python shell run below mentioned commands..
 from keras.datasets import mnist (train_images,train_labels), (test_images, test_labels) = mnist.load_data()

This took only 61 seconds (this may take less than that if your net speed is on higher side...) Once this is done then you can run your program from IDLE as well & then it will run quickly at least won't get stuck on downloading the dataset.... Matias Valdenegro also suggesting the same....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM