Skip to content

Commit 9acebc5

Browse files
vincentqbfacebook-github-bot
authored andcommitted
[fbsync] Fix (Fashion|K)MNIST download and MNIST download test (#3557)
Summary: * add mirrors to (Fashion|K)MNIST * fix download tests for MNIST Reviewed By: fmassa Differential Revision: D27128007 fbshipit-source-id: 2ca4bba7d8e823cdca3174f408f14e9e6e2e8346
1 parent dc62ac3 commit 9acebc5

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

test/test_datasets_download.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def voc():
249249

250250

251251
def mnist():
252-
return collect_download_configs(lambda: datasets.MNIST(ROOT, download=True), name="MNIST")
252+
with unittest.mock.patch.object(datasets.MNIST, "mirrors", datasets.MNIST.mirrors[-1:]):
253+
return collect_download_configs(lambda: datasets.MNIST(ROOT, download=True), name="MNIST")
253254

254255

255256
def fashion_mnist():

torchvision/datasets/mnist.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,15 @@ class FashionMNIST(MNIST):
206206
target_transform (callable, optional): A function/transform that takes in the
207207
target and transforms it.
208208
"""
209+
mirrors = [
210+
"http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/"
211+
]
212+
209213
resources = [
210-
("http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz",
211-
"8d4fb7e6c68d591d4c3dfef9ec88bf0d"),
212-
("http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz",
213-
"25c81989df183df01b3e8a0aad5dffbe"),
214-
("http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-images-idx3-ubyte.gz",
215-
"bef4ecab320f06d8554ea6380940ec79"),
216-
("http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-labels-idx1-ubyte.gz",
217-
"bb300cfdad3c16e7a12a480ee83cd310")
214+
("train-images-idx3-ubyte.gz", "8d4fb7e6c68d591d4c3dfef9ec88bf0d"),
215+
("train-labels-idx1-ubyte.gz", "25c81989df183df01b3e8a0aad5dffbe"),
216+
("t10k-images-idx3-ubyte.gz", "bef4ecab320f06d8554ea6380940ec79"),
217+
("t10k-labels-idx1-ubyte.gz", "bb300cfdad3c16e7a12a480ee83cd310")
218218
]
219219
classes = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal',
220220
'Shirt', 'Sneaker', 'Bag', 'Ankle boot']
@@ -236,11 +236,15 @@ class KMNIST(MNIST):
236236
target_transform (callable, optional): A function/transform that takes in the
237237
target and transforms it.
238238
"""
239+
mirrors = [
240+
"http://codh.rois.ac.jp/kmnist/dataset/kmnist/"
241+
]
242+
239243
resources = [
240-
("http://codh.rois.ac.jp/kmnist/dataset/kmnist/train-images-idx3-ubyte.gz", "bdb82020997e1d708af4cf47b453dcf7"),
241-
("http://codh.rois.ac.jp/kmnist/dataset/kmnist/train-labels-idx1-ubyte.gz", "e144d726b3acfaa3e44228e80efcd344"),
242-
("http://codh.rois.ac.jp/kmnist/dataset/kmnist/t10k-images-idx3-ubyte.gz", "5c965bf0a639b31b8f53240b1b52f4d7"),
243-
("http://codh.rois.ac.jp/kmnist/dataset/kmnist/t10k-labels-idx1-ubyte.gz", "7320c461ea6c1c855c0b718fb2a4b134")
244+
("train-images-idx3-ubyte.gz", "bdb82020997e1d708af4cf47b453dcf7"),
245+
("train-labels-idx1-ubyte.gz", "e144d726b3acfaa3e44228e80efcd344"),
246+
("t10k-images-idx3-ubyte.gz", "5c965bf0a639b31b8f53240b1b52f4d7"),
247+
("t10k-labels-idx1-ubyte.gz", "7320c461ea6c1c855c0b718fb2a4b134")
244248
]
245249
classes = ['o', 'ki', 'su', 'tsu', 'na', 'ha', 'ma', 'ya', 're', 'wo']
246250

0 commit comments

Comments
 (0)