Skip to content

Commit

Permalink
fix bug in tutorial text
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhare committed Apr 19, 2018
1 parent 5a5e4f2 commit c4f66ee
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Thursday/practical-part1/keras-mnist-bettercnn-vis-maxact3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
step=1

# we're interested in maximising outputs of the 3rd layer:
layer_output = model.layers[3].output

for i in xrange(0,15):
layer_output = model.layers[2].output
for i in range(0,15):
# build a loss function that maximizes the activation
# of the nth filter of the layer considered
loss = K.mean(layer_output[:, :, :, i])
Expand All @@ -33,7 +32,7 @@
input_img_data = np.random.random((1, 28, 28, 1)) * 0.07 + 0.5

# run gradient ascent for 50 steps
for j in range(50):
for j in range(30):
loss_value, grads_value = iterate([input_img_data])
input_img_data += grads_value * step

Expand Down
2 changes: 1 addition & 1 deletion Thursday/practical-part1/keras-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ layer_output = model.layers[3].output
for i in xrange(0,15):
# build a loss function that maximizes the activation
# of the nth filter of the layer considered
loss = K.mean(layer_output[:, i, :, :])
loss = K.mean(layer_output[:, :, :, i])

# compute the gradient of the input picture wrt this loss
grads = K.gradients(loss, input_img)[0]
Expand Down
Binary file modified Thursday/practical-part1/keras-tutorial.pdf
Binary file not shown.
Binary file modified Thursday/practical-part1/maxact.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 c4f66ee

Please sign in to comment.