Skip to content

Commit

Permalink
Ch15 figs (rasbt#41)
Browse files Browse the repository at this point in the history
* Added ch15 images/ folder

* Added images to part1

* Added images to part2

* Run all cells (part1)

* Run all cells (part2)

* Removed extra files
  • Loading branch information
vmirly authored Nov 4, 2019
1 parent f169cad commit 224fc6e
Show file tree
Hide file tree
Showing 24 changed files with 570 additions and 133 deletions.
455 changes: 392 additions & 63 deletions ch15/ch15_part1.ipynb

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions ch15/ch15_part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,42 @@







# ## The building blocks of convolutional neural networks
#
# ### Understanding CNNs and feature hierarchies





#
#
# ### Performing discrete convolutions
#
# ### Discrete convolutions in one dimension
#
#









# ### Padding inputs to control the size of the output feature maps
#
#





# ### Determining the size of the convolution output


Expand Down Expand Up @@ -77,6 +103,18 @@ def conv1d(x, w, p=0, s=1):















def conv2d(X, W, p=(0, 0), s=(1, 1)):
W_rot = np.array(W)[::-1,::-1]
X_orig = np.array(X)
Expand Down Expand Up @@ -110,12 +148,20 @@ def conv2d(X, W, p=(0, 0), s=(1, 1)):

# ## Subsampling layers





# ## Putting everything together – implementing a CNN
#
# ### Working with multiple input or color channels
#
#





# **TIP: Reading an image file**


Expand Down Expand Up @@ -169,6 +215,10 @@ def conv2d(X, W, p=(0, 0), s=(1, 1)):







conv_layer = keras.layers.Conv2D(
filters=16, kernel_size=(3, 3),
kernel_regularizer=keras.regularizers.l2(0.001))
Expand All @@ -194,6 +244,10 @@ def conv2d(X, W, p=(0, 0), s=(1, 1)):







####### Binary Crossentropy
bce_probas = tf.keras.losses.BinaryCrossentropy(from_logits=False)
bce_logits = tf.keras.losses.BinaryCrossentropy(from_logits=True)
Expand Down Expand Up @@ -240,6 +294,10 @@ def conv2d(X, W, p=(0, 0), s=(1, 1)):
#
# ### The multilayer CNN architecture





# ### Loading and preprocessing the data


Expand Down
179 changes: 111 additions & 68 deletions ch15/ch15_part2.ipynb

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions ch15/ch15_part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@




# ## Gender classification from face images using CNN
#

Expand Down Expand Up @@ -120,7 +121,7 @@ def count_items(ds):
img_center_crop, size=(218, 178))
ax.imshow(img_resized.numpy().astype('uint8'))

#plt.savefig('figures/15_14.png', dpi=300)
# plt.savefig('figures/15_14.png', dpi=300)
plt.show()


Expand Down Expand Up @@ -156,7 +157,7 @@ def count_items(ds):
if i == 0:
ax.set_title('Step 3: Resize', size=15)

#plt.savefig('figures/15_15.png', dpi=300)
# plt.savefig('figures/15_15.png', dpi=300)
plt.show()


Expand Down Expand Up @@ -226,6 +227,12 @@ def preprocess(example, size=(64, 64), mode='train'):


# ### Training a CNN gender classifier
#
# * **Global Average Pooling**







Expand Down
Binary file removed ch15/figures/15_12.png
Binary file not shown.
Binary file removed ch15/figures/15_13.png
Binary file not shown.
Binary file removed ch15/figures/15_14.png
Binary file not shown.
Binary file removed ch15/figures/15_15.png
Binary file not shown.
Binary file removed ch15/figures/15_16.png
Binary file not shown.
Binary file removed ch15/figures/15_18.png
Binary file not shown.
Binary file removed ch15/figures/figures-15_19.png
Binary file not shown.
Binary file added ch15/images/15_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 ch15/images/15_02.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 ch15/images/15_03.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 ch15/images/15_04.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 ch15/images/15_05.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 ch15/images/15_06.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 ch15/images/15_07.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 ch15/images/15_08.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 ch15/images/15_09.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 ch15/images/15_10.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 ch15/images/15_11.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 ch15/images/15_12.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 ch15/images/15_13.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 224fc6e

Please sign in to comment.