Skip to content

Commit 2e84ff7

Browse files
committed
Use Floyd's cifar-10 dataset if present
1 parent 76c054e commit 2e84ff7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

image-classification/dlnd_image_classification.ipynb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
"\n",
3232
"cifar10_dataset_folder_path = 'cifar-10-batches-py'\n",
3333
"\n",
34+
"# Use Floyd's cifar-10 dataset if present\n",
35+
"floyd_cifar10_location = '/input/cifar-10/python.tar.gz'\n",
36+
"if isfile(floyd_cifar10_location):\n",
37+
" tar_gz_path = floyd_cifar10_location\n",
38+
"else:\n",
39+
" tar_gz_path = 'cifar-10-python.tar.gz'\n",
40+
"\n",
3441
"class DLProgress(tqdm):\n",
3542
" last_block = 0\n",
3643
"\n",
@@ -39,15 +46,15 @@
3946
" self.update((block_num - self.last_block) * block_size)\n",
4047
" self.last_block = block_num\n",
4148
"\n",
42-
"if not isfile('cifar-10-python.tar.gz'):\n",
49+
"if not isfile(tar_gz_path):\n",
4350
" with DLProgress(unit='B', unit_scale=True, miniters=1, desc='CIFAR-10 Dataset') as pbar:\n",
4451
" urlretrieve(\n",
4552
" 'https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz',\n",
46-
" 'cifar-10-python.tar.gz',\n",
53+
" tar_gz_path,\n",
4754
" pbar.hook)\n",
4855
"\n",
4956
"if not isdir(cifar10_dataset_folder_path):\n",
50-
" with tarfile.open('cifar-10-python.tar.gz') as tar:\n",
57+
" with tarfile.open(tar_gz_path) as tar:\n",
5158
" tar.extractall()\n",
5259
" tar.close()\n",
5360
"\n",

0 commit comments

Comments
 (0)