Skip to content

Commit

Permalink
supports loading fashion-mnist data
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Sep 17, 2017
1 parent 8683086 commit 38d24d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions download.py
Expand Up @@ -105,14 +105,14 @@ def download_lsun(dirpath):
_download_lsun(data_dir, category, 'val', tag)
_download_lsun(data_dir, '', 'test', tag)

def download_mnist(dirpath):
def download_mnist(dirpath, use_fashion=False):
data_dir = os.path.join(dirpath, 'mnist')
if os.path.exists(data_dir):
print('Found MNIST - skip')
return
else:
os.mkdir(data_dir)
url_base = 'http://yann.lecun.com/exdb/mnist/'
url_base = 'http://yann.lecun.com/exdb/mnist/' if not use_fashion else 'http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/'
file_names = ['train-images-idx3-ubyte.gz','train-labels-idx1-ubyte.gz','t10k-images-idx3-ubyte.gz','t10k-labels-idx1-ubyte.gz']
for file_name in file_names:
url = (url_base+file_name).format(**locals())
Expand Down

0 comments on commit 38d24d7

Please sign in to comment.