Skip to content

Commit

Permalink
Adding shuffle_files=False for MNIST
Browse files Browse the repository at this point in the history
  • Loading branch information
vmirly committed Nov 24, 2019
1 parent 9b79101 commit 7f4bee8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
29 changes: 16 additions & 13 deletions ch13/ch13_part1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1268,23 +1268,23 @@
"output_type": "stream",
"text": [
"Requirement already satisfied: tensorflow-datasets in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (1.3.0)\n",
"Requirement already satisfied: attrs in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (19.2.0)\n",
"Requirement already satisfied: promise in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (2.2.1)\n",
"Requirement already satisfied: requests>=2.19.0 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (2.22.0)\n",
"Requirement already satisfied: protobuf>=3.6.1 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (3.10.0)\n",
"Requirement already satisfied: tqdm in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (4.36.1)\n",
"Requirement already satisfied: termcolor in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (1.1.0)\n",
"Requirement already satisfied: wrapt in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (1.11.2)\n",
"Requirement already satisfied: attrs in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (19.2.0)\n",
"Requirement already satisfied: absl-py in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (0.8.0)\n",
"Requirement already satisfied: tensorflow-metadata in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (0.14.0)\n",
"Requirement already satisfied: future in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (0.17.1)\n",
"Requirement already satisfied: six in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (1.12.0)\n",
"Requirement already satisfied: protobuf>=3.6.1 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (3.10.0)\n",
"Requirement already satisfied: numpy in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (1.17.3)\n",
"Requirement already satisfied: dill in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (0.3.1.1)\n",
"Requirement already satisfied: tensorflow-metadata in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (0.14.0)\n",
"Requirement already satisfied: promise in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (2.2.1)\n",
"Requirement already satisfied: future in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (0.17.1)\n",
"Requirement already satisfied: tqdm in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (4.36.1)\n",
"Requirement already satisfied: absl-py in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (0.8.0)\n",
"Requirement already satisfied: wrapt in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-datasets) (1.11.2)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from requests>=2.19.0->tensorflow-datasets) (2019.9.11)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from requests>=2.19.0->tensorflow-datasets) (1.25.6)\n",
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from requests>=2.19.0->tensorflow-datasets) (3.0.4)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from requests>=2.19.0->tensorflow-datasets) (2019.9.11)\n",
"Requirement already satisfied: idna<2.9,>=2.5 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from requests>=2.19.0->tensorflow-datasets) (2.8)\n",
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from requests>=2.19.0->tensorflow-datasets) (3.0.4)\n",
"Requirement already satisfied: setuptools in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from protobuf>=3.6.1->tensorflow-datasets) (41.2.0)\n",
"Requirement already satisfied: googleapis-common-protos in /home/vahid/anaconda3/envs/tf2/lib/python3.7/site-packages (from tensorflow-metadata->tensorflow-datasets) (1.6.0)\n"
]
Expand Down Expand Up @@ -1742,7 +1742,8 @@
}
],
"source": [
"mnist, mnist_info = tfds.load('mnist', with_info=True)\n",
"mnist, mnist_info = tfds.load('mnist', with_info=True,\n",
" shuffle_files=False)\n",
"\n",
"print(mnist_info)\n",
"\n",
Expand Down Expand Up @@ -1789,7 +1790,9 @@
" ax = fig.add_subplot(2, 5, i+1)\n",
" ax.set_xticks([]); ax.set_yticks([])\n",
" ax.imshow(image[:, :, 0], cmap='gray_r')\n",
" ax.set_title('{}'.format(label), size=15)"
" ax.set_title('{}'.format(label), size=15)\n",
" \n",
"plt.show()"
]
},
{
Expand Down Expand Up @@ -1820,7 +1823,7 @@
"output_type": "stream",
"text": [
"[NbConvertApp] Converting notebook ch13_part1.ipynb to script\n",
"[NbConvertApp] Writing 10174 bytes to ch13_part1.py\n"
"[NbConvertApp] Writing 10277 bytes to ch13_part1.py\n"
]
}
],
Expand Down
7 changes: 6 additions & 1 deletion ch13/ch13_part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,16 @@ def load_and_preprocess(path, label):
ax.imshow(image)
ax.set_title('{}'.format(label), size=15)


plt.show()


# Alternative ways for loading a dataset



mnist, mnist_info = tfds.load('mnist', with_info=True)
mnist, mnist_info = tfds.load('mnist', with_info=True,
shuffle_files=False)

print(mnist_info)

Expand All @@ -557,6 +559,9 @@ def load_and_preprocess(path, label):
ax.set_xticks([]); ax.set_yticks([])
ax.imshow(image[:, :, 0], cmap='gray_r')
ax.set_title('{}'.format(label), size=15)

#plt.savefig('ch13-mnist-new.png')
plt.show()



Expand Down

0 comments on commit 7f4bee8

Please sign in to comment.