Skip to content

Commit

Permalink
Use Floyd's cifar-10 dataset if present
Browse files Browse the repository at this point in the history
  • Loading branch information
ludwiktrammer committed Feb 26, 2017
1 parent 76c054e commit 2e84ff7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions image-classification/dlnd_image_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
"\n",
"cifar10_dataset_folder_path = 'cifar-10-batches-py'\n",
"\n",
"# Use Floyd's cifar-10 dataset if present\n",
"floyd_cifar10_location = '/input/cifar-10/python.tar.gz'\n",
"if isfile(floyd_cifar10_location):\n",
" tar_gz_path = floyd_cifar10_location\n",
"else:\n",
" tar_gz_path = 'cifar-10-python.tar.gz'\n",
"\n",
"class DLProgress(tqdm):\n",
" last_block = 0\n",
"\n",
Expand All @@ -39,15 +46,15 @@
" self.update((block_num - self.last_block) * block_size)\n",
" self.last_block = block_num\n",
"\n",
"if not isfile('cifar-10-python.tar.gz'):\n",
"if not isfile(tar_gz_path):\n",
" with DLProgress(unit='B', unit_scale=True, miniters=1, desc='CIFAR-10 Dataset') as pbar:\n",
" urlretrieve(\n",
" 'https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz',\n",
" 'cifar-10-python.tar.gz',\n",
" tar_gz_path,\n",
" pbar.hook)\n",
"\n",
"if not isdir(cifar10_dataset_folder_path):\n",
" with tarfile.open('cifar-10-python.tar.gz') as tar:\n",
" with tarfile.open(tar_gz_path) as tar:\n",
" tar.extractall()\n",
" tar.close()\n",
"\n",
Expand Down

0 comments on commit 2e84ff7

Please sign in to comment.