This is a implementation of Deconvnet in keras, following Matthew D.Zeiler's paper Visualizing and Understanding Convolutional Networks
Given a pre-trained keras model, this repo can visualize features of specified layer including dense layer.
- Keras 1.1(Theano Backend)
- Python >= 2.7
- argparse 1.0
- Pillow 1.1
Below is several examples of feature visualization based on pre-trained VGG16 in keras, 'max' means pick the greates activation in the feature map to be visualized and set other elements to zeros, 'all' mean use all values in the feature map to visualize.
The left is max activation feature, the right is all activation feature
- Original Image
- block4_conv2_46
The 46th feature in block4_conv2 layer catches 'nose' feature
- block5_conv3_256
The 256th feature in block5_conv3 layer catches 'ear' feature
- fc1_0
- fc2_248
- predictions_248
predictions_248 is the predicted class of the image(label: Eskimo_dog)
- The code implements visualize function for only Convolution2D, MaxPooling2D, Flatten, Input, Dense, Activation layers, thus cannot handle other type of layers.
- The code support only plain networks, thus cannot visualize ResNet, Highway Networks or something.