How can I import the MNIST dataset that has been manually downloaded?

前端 未结 4 1155
北海茫月
北海茫月 2021-02-05 18:36

I have been experimenting with a Keras example, which needs to import MNIST data

from keras.datasets import mnist
import numpy as np
(x_train, _), (x_test, _) =          


        
4条回答
  •  生来不讨喜
    2021-02-05 19:09

    You do not need additional code for that but can tell load_data to load a local version in the first place:

    1. You can download the file https://s3.amazonaws.com/img-datasets/mnist.npz from another computer with proper (proxy) access (taken from https://github.com/keras-team/keras/blob/master/keras/datasets/mnist.py),
    2. copy it to the the directory ~/.keras/datasets/ (on Linux and macOS)
    3. and run load_data(path='mnist.npz') with the right file name

提交回复
热议问题