f92dd441311594f80ee5be4a2d2a1d6b21b96c59,examples/visualize_layer.py,,visualize_multiple_same_filter,#,39
Before Change
// 20 is the imagenet category for "ouzel"
indices = [20] * num_runs
images = [visualize_activation(model, layer_idx, filter_indices=idx,
text=utils.get_imagenet_label(idx),
max_iter=500) for idx in indices]
// Easily stitch images via `utils.stitch_images`
stitched = utils.stitch_images(images)
if show:
plt.axis("off")
plt.imshow(stitched)
After Change
num_runs: The number of times the same filter is visualized
// Build the VGG16 network with ImageNet weights
model = VGG16(weights="imagenet", include_top=True)
print("Model loaded.")
// The name of the layer we want to visualize
// (see model definition in vggnet.py)
layer_name = "predictions"
layer_idx = [idx for idx, layer in enumerate(model.layers) if layer.name == layer_name][0]
// 20 is the imagenet category for "ouzel"
indices = [20] * num_runs
images = []
for idx in indices:
img = visualize_activation(model, layer_idx, filter_indices=idx, max_iter=500)
img = utils.draw_text(img, utils.get_imagenet_label(idx))
images.append(img)
// Easily stitch images via `utils.stitch_images`
stitched = utils.stitch_images(images)
if show:
plt.axis("off")
plt.imshow(stitched)

In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: raghakot/keras-vis
Commit Name: f92dd441311594f80ee5be4a2d2a1d6b21b96c59
Time: 2017-05-07
Author: ragha@outlook.com
File Name: examples/visualize_layer.py
Class Name:
Method Name: visualize_multiple_same_filter
Project Name: raghakot/keras-vis
Commit Name: f92dd441311594f80ee5be4a2d2a1d6b21b96c59
Time: 2017-05-07
Author: ragha@outlook.com
File Name: examples/visualize_layer.py
Class Name:
Method Name: visualize_multiple_categories
Project Name: raghakot/keras-vis
Commit Name: f92dd441311594f80ee5be4a2d2a1d6b21b96c59
Time: 2017-05-07
Author: ragha@outlook.com
File Name: examples/visualize_layer.py
Class Name:
Method Name: visualize_multiple_same_filter
Project Name: raghakot/keras-vis
Commit Name: f92dd441311594f80ee5be4a2d2a1d6b21b96c59
Time: 2017-05-07
Author: ragha@outlook.com
File Name: examples/visualize_layer.py
Class Name:
Method Name: visualize_random