This repository contains a number of CNN visualization techniques specialized for neuroscience research using PyTorch.
Besides the conventional methods such as Activation Maximization (AM) and its variants, this repository also contains methods borrowed from the neuroscience field:
- Feature maps (i.e. neuron activation maps) of each layer.
- Kernel ranking for various rankings such as "orientation".
- Group AM on an entire layer or batches of kernels.
- Background
- Files to interact with
- Activation Maximization
- Group AM
- Feature Map Visualization
- Kernel Ranking
main_am.py
- run vanilla gradient ascent on selected neuron (kernel in CNN).
main_activation.py
- visualize output of selected neuron (kernel in CNN).
main_guided_backprop.py
- run guided backpropagation on selected neuron (kernel in CNN).
main_integrated_grad.py
- run integrated gradients on selected neuron (kerenl in CNN).
Create two files:
<methodName>.py
- class/function for running the visualization method.main_<methodName>.py
- file for running the visualization method with custom inputs.
Recent progress in deep learning has taken a lot of intuitions from the human brain. From the simple multi-layer perceptron to the variations of CNNs, these architecture share substantial similarity with how the brain processes sensory information (e.g. V1, V2, etc.). With the growth in computational power, these neural networks have been showing performances that exceed the human mind in specific downstream tasks.
However, till this day, the inner-workings of these powerful neural networks are still in question. While there are methods for visualizing weights of neural networks such as activation maximization and gradient-based saliency maps, the process of understanding individual weights in the network are still unintuitive to scientists.
NeuroVis tries to tackle this problem from a different perspective.
AM visualization matrix of the 1st layer and 0th kernel.
The format of each AM visualization matrix is as follows:
Initial image (rgb) | AM result (rgb) | - | target feature map |
Initial image (depth) | AM result (depth) | - | Resulting feature map |
Activation map of the 3rd Conv layer 0th kernel. (Black: low activation; White: is high activation. )