Skip to content

Commit

Permalink
Ch13 figs (rasbt#30)
Browse files Browse the repository at this point in the history
* Added fig 1 and 2

* Rename image and figure folders

* Using os.path.basename

* Run all cells
  • Loading branch information
vmirly authored Nov 3, 2019
1 parent b337a20 commit 15f7035
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 1,364 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
1,614 changes: 253 additions & 1,361 deletions ch13/ch13_part1.ipynb

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions ch13/ch13_part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import numpy as np
import pathlib
import matplotlib.pyplot as plt
import os
import tensorflow_datasets as tfds

# *Python Machine Learning 3rd Edition* by [Sebastian Raschka](https://sebastianraschka.com) & [Vahid Mirjalili](http://vahidmirjalili.com), Packt Publishing Ltd. 2019
Expand All @@ -30,8 +31,16 @@

# ### Performance challenges





# ### What is TensorFlow?





# ### How we will learn TensorFlow

# ## First steps with TensorFlow
Expand Down Expand Up @@ -361,7 +370,7 @@



imgdir_path = pathlib.Path('images')
imgdir_path = pathlib.Path('cat_dog_images')

file_list = [str(path) for path in imgdir_path.glob('*.jpg')]

Expand All @@ -380,7 +389,7 @@
ax = fig.add_subplot(2, 3, i+1)
ax.set_xticks([]); ax.set_yticks([])
ax.imshow(img)
ax.set_title(file, size=15)
ax.set_title(os.path.basename(file), size=15)

# plt.savefig('ch13-catdot-examples.pdf')
plt.tight_layout()
Expand All @@ -389,7 +398,7 @@



labels = [1 if 'dog' in file else 0
labels = [1 if 'dog' in os.path.basename(file) else 0
for file in file_list]
print(labels)

Expand Down Expand Up @@ -558,3 +567,8 @@ def load_and_preprocess(path, label):








Binary file added ch13/images/01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch13/images/02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15f7035

Please sign in to comment.