diff --git a/ch13/ch13_part1.ipynb b/ch13/ch13_part1.ipynb index 09926e68..b7be9f2a 100644 --- a/ch13/ch13_part1.ipynb +++ b/ch13/ch13_part1.ipynb @@ -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" ] @@ -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", @@ -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()" ] }, { @@ -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" ] } ], diff --git a/ch13/ch13_part1.py b/ch13/ch13_part1.py index 7a9a5bb0..490136fe 100644 --- a/ch13/ch13_part1.py +++ b/ch13/ch13_part1.py @@ -524,6 +524,7 @@ def load_and_preprocess(path, label): ax.imshow(image) ax.set_title('{}'.format(label), size=15) + plt.show() @@ -531,7 +532,8 @@ def load_and_preprocess(path, label): -mnist, mnist_info = tfds.load('mnist', with_info=True) +mnist, mnist_info = tfds.load('mnist', with_info=True, + shuffle_files=False) print(mnist_info) @@ -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()