Skip to content

x1155665/CNN-Visualizer

Repository files navigation

CNN Visualizer

This is a simple convolutional neural network visualizer using PyQt and Caffe.

The work is based on Deep Visualization Toolbox. The toolbox and methods are described casually here and more formally in this paper:

The code of the improved version by Arik Poznanski were also used.

Features

Main features of the Deep Visualization Toolbox that are implemented in the CNN Visualizer:

  • Activation of each neuron
  • Backprop/Deconvolution/Guided backprop
  • Images that cause high activation (These images are pre-computed by the scripts in ./find_maxes/)

Missing feature:

  • Synthetic images that cause high activation

The GUI looks like this: Screenshot

Supported network architectures

In the very beginning, this tool was intended for VGG16. Support for other VGG16-like CNNs were added later.

Non-sequential networks are not supported.

Setting up

1. Get PyQt running.

You may need to install Qt5, SIP and PyQt5.

Install Qt5

You can use the following command to check if Qt5 is already installed on your computer:

qmake --version

If Qt5 is not yet installed, you can get it from the official website of Qt or install it from your linux distribution’s repositories. On ubuntu:

sudo apt-get install build-essential
sudo apt-get install qt5-default

Install SIP and PyQt5

If you want to run the tool on python3, you can use pip3 to install SIP and PyQt5:

pip3 install PyQt5-sip
pip3 install PyQt5

For python2, you have to download the source of SIP and PyQt5, then install the packages by running:

python2 configure.py
make 
make install

2. Compile the modified caffe by Arik Poznanski

Get the code by from the repository

Configure Makefile.config.example accordingly and rename it to Makefile.config.

Compile by running:

make all pycaffe 

3. Download and configure the CNN visualizer

While the "master" branch runs with python2, the "py3" branch runs with python3. Please download the version you want.

Change the general settings in main_settings.yaml.

Use model_setting_template.yaml as template to create settings file for the new model and then register this file in main_settings.yaml

Compute the top images (optional):

python find_maxes/find_max_act.py --model model_name
python find_maxes/crop_max_patches.py --model model_name

Run the tool by:

python CNN_Vis_Demo.py

About

Convolutional neural network visualizer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages