Skip to content

Commit 7699041

Browse files
committed
Added statement to check downloaded dataset.
1 parent 155fd37 commit 7699041

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

tensorflow_datasets/image/mnist.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,32 @@ def _split_generators(self, dl_manager):
333333
"test_data": 'emnist-{}-test-images-idx3-ubyte'.format(self.builder_config.name),
334334
"test_labels": 'emnist-{}-test-labels-idx1-ubyte'.format(self.builder_config.name),
335335
}
336+
336337
dir_name = dl_manager.manual_dir
337338

339+
if not tf.io.gfile.exists(os.path.join(dir_name, filenames['train_data'])):
340+
# The current tfds.core.download_manager is unable to extract multiple and nested files.
341+
# We'll add soon!
342+
msg = "You must download and extract the dataset files manually and place them in : "
343+
msg += dl_manager.manual_dir
344+
msg += """File tree must be like this :\n
345+
.
346+
├── emnist
347+
│   ├── emnist-byclass-train-images-idx3-ubyte
348+
│   ├── emnist-byclass-train-labels-idx3-ubyte
349+
│   ├── emnist-byclass-test-images-idx3-ubyte
350+
│   ├── emnist-byclass-test-labels-idx3-ubyte
351+
│   ├── emnist-bymerge-train-images-idx3-ubyte
352+
│   ├── emnist-bymerge-train-labels-idx3-ubyte
353+
│   ├── emnist-bymerge-test-images-idx3-ubyte
354+
│   ├── emnist-bymerge-test-labels-idx3-ubyte
355+
│   ├── .......
356+
│   ├── .....
357+
│   ├── ...
358+
│ ├──
359+
"""
360+
raise FileNotFoundError(msg.replace(" ", ""))
361+
338362
return [
339363
tfds.core.SplitGenerator(
340364
name=tfds.Split.TRAIN,

tensorflow_datasets/image/mnist_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class KMNISTTest(MNISTTest):
5252

5353

5454
class EMNISTTest(MNISTTest):
55-
DATASET_CLASS = mnist.EMNIST
56-
BUILDER_CONFIG_NAMES_TO_TEST = ["test"]
55+
DATASET_CLASS = mnist.EMNIST
56+
BUILDER_CONFIG_NAMES_TO_TEST = ["test"]
5757

5858

5959
if __name__ == "__main__":

0 commit comments

Comments
 (0)