- TensorFlow implementation of Striving for Simplicity: The All Convolutional Net (2014).
- Guided backpropagation generates clearer visulizations than deconvnet for higher layers.
- Python 3.3+
- Tensorflow 1.3
- TensorCV
- VGG19 is used for visulization. The model is defined in
CNN-Visualization/lib/nets/vgg.py. - Guided backpropagation copmutation class is defined in
CNN-Visualization/lib/models/guided_backpro.py. - Example usage is in
CNN-Visualization/example/guided_backpropagation.py.
-
Setup directories in file
CNN-Visualization/example/guided_backpropagation.py.IM_PATH- directory of testing image dataVGG_PATH- directory of pre-trained VGG19 parametersSAVE_DIR- directory of saving result images
-
Download the pre-trained VGG parameters
- Download pre-trained VGG19 model here and put it in
VGG_PATH.
- Download pre-trained VGG19 model here and put it in
-
Testing images
-
Put testing images in
IM_PATH. -
Change image type to the corresponding type if testing images are not jpeg files
input_im = ImageFromFile('.jpg', data_dir=IM_PATH, num_channel=3, shuffle=False)
-
To get the guided backpropagation maps for all the image in IM_PATH, go to CNN-Visualization/example/ and run:
python guided_backpropagation.py
- Results will be saved in
SAVE_DIRas map_IDX_class_PREDICT_LABEL.png.
Qian Ge



