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:
- Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. Presented at the Deep Learning Workshop, International Conference on Machine Learning (ICML), 2015.
The code of the improved version by Arik Poznanski were also used.
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
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.
You may need to install Qt5, SIP and PyQt5.
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
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
Get the code by from the repository
Configure Makefile.config.example accordingly and rename it to Makefile.config.
Compile by running:
make all pycaffe
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