Commit 36f8a677 authored by Amir Mohammadi's avatar Amir Mohammadi
Browse files

Use webarchive to download mnist

parent 1dcdf6e9
Pipeline #6284 passed with stages
in 6 minutes and 51 seconds
...@@ -22,7 +22,7 @@ The MNIST Database is a database of handwritten digits, which has a training ...@@ -22,7 +22,7 @@ The MNIST Database is a database of handwritten digits, which has a training
set of 60,000 examples, and a test set of 10,000 examples. It is a subset of set of 60,000 examples, and a test set of 10,000 examples. It is a subset of
a larger set available from NIST. The digits have been size-normalized and a larger set available from NIST. The digits have been size-normalized and
centered in a fixed-size image. You can download the MNIST database from: centered in a fixed-size image. You can download the MNIST database from:
http://yann.lecun.com/exdb/mnist/ https://web-beta.archive.org/web/20161231041016/http://yann.lecun.com/exdb/mnist/
""" """
from .query import Database from .query import Database
......
...@@ -21,12 +21,12 @@ import shutil ...@@ -21,12 +21,12 @@ import shutil
import os import os
class Database(): class Database():
"""Wrapper class for the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/). """Wrapper class for the MNIST database of handwritten digits (https://web-beta.archive.org/web/20161231041016/http://yann.lecun.com/exdb/mnist/).
""" """
def __init__(self, data_dir = None): def __init__(self, data_dir = None):
"""Creates the database. The data_dir argument should be the path to the directory """Creates the database. The data_dir argument should be the path to the directory
containing the four binary files available from http://yann.lecun.com/exdb/mnist/""" containing the four binary files available from https://web-beta.archive.org/web/20161231041016/http://yann.lecun.com/exdb/mnist/"""
# initialize members # initialize members
import os import os
self.m_labels = set(range(0,10)) self.m_labels = set(range(0,10))
...@@ -80,11 +80,11 @@ class Database(): ...@@ -80,11 +80,11 @@ class Database():
elif not os.path.exists(directory): elif not os.path.exists(directory):
os.makedirs(directory) os.makedirs(directory)
print("Downloading the mnist database from http://yann.lecun.com/exdb/mnist/ ...") print("Downloading the mnist database from https://web-beta.archive.org/web/20161231041016/http://yann.lecun.com/exdb/mnist/ ...")
for f in self.m_mnist_filenames: for f in self.m_mnist_filenames:
tmp_file = os.path.join(directory, f) tmp_file = os.path.join(directory, f)
url = 'http://yann.lecun.com/exdb/mnist/'+f url = 'https://web-beta.archive.org/web/20161231041016/http://yann.lecun.com/exdb/mnist/'+f
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
# python2 technique for downloading a file # python2 technique for downloading a file
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment