Skip to content

Commit c4f66ee

Browse files
committed
fix bug in tutorial text
1 parent 5a5e4f2 commit c4f66ee

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

Thursday/practical-part1/keras-mnist-bettercnn-vis-maxact3.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
step=1
1414

1515
# we're interested in maximising outputs of the 3rd layer:
16-
layer_output = model.layers[3].output
17-
18-
for i in xrange(0,15):
16+
layer_output = model.layers[2].output
17+
for i in range(0,15):
1918
# build a loss function that maximizes the activation
2019
# of the nth filter of the layer considered
2120
loss = K.mean(layer_output[:, :, :, i])
@@ -33,7 +32,7 @@
3332
input_img_data = np.random.random((1, 28, 28, 1)) * 0.07 + 0.5
3433

3534
# run gradient ascent for 50 steps
36-
for j in range(50):
35+
for j in range(30):
3736
loss_value, grads_value = iterate([input_img_data])
3837
input_img_data += grads_value * step
3938

Thursday/practical-part1/keras-tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ layer_output = model.layers[3].output
631631
for i in xrange(0,15):
632632
# build a loss function that maximizes the activation
633633
# of the nth filter of the layer considered
634-
loss = K.mean(layer_output[:, i, :, :])
634+
loss = K.mean(layer_output[:, :, :, i])
635635

636636
# compute the gradient of the input picture wrt this loss
637637
grads = K.gradients(loss, input_img)[0]
1 Byte
Binary file not shown.

Thursday/practical-part1/maxact.png

-166 KB
Loading

0 commit comments

Comments
 (0)