piiswrong commented on a change in pull request #7635: add fashion mnist and move mnists to s3 URL: https://github.com/apache/incubator-mxnet/pull/7635#discussion_r135404465
########## File path: python/mxnet/gluon/data/vision.py ########## @@ -102,6 +102,56 @@ def _get_data(self): self._label = label +class FashionMNIST(_DownloadedDataset): + """A dataset of Zalando's article images consisting of fashion products, + a drop-in replacement of the original MNIST dataset from + `https://github.com/zalandoresearch/fashion-mnist`_. + + Each sample is an image (in 3D NDArray) with shape (28, 28, 1). + + Parameters + ---------- + root : str + Path to temp folder for storing data. + train : bool + Whether to load the training or testing set. + transform : function + A user defined callback that transforms each instance. For example:: + + transform=lambda data, label: (data.astype(np.float32)/255, label) + """ + def __init__(self, root='~/.mxnet/datasets/fashion-mnist', train=True, + transform=None): + super(FashionMNIST, self).__init__(root, train, transform) + + def _get_data(self): + if not os.path.isdir(self._root): + os.makedirs(self._root) + url = 'https://apache-mxnet.s3.amazonaws.com/gluon/dataset/fashion-mnist/' + if self._train: + data_file = download(url+'train-images-idx3-ubyte.gz', self._root, Review comment: move url into MNIST._train_data_url/_train_label_url etc and inherit MNIST ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services