Debugging Keras nets by making them dream out loud
keras-vis generates saliency maps, activation maximizations, and class activation maps to reveal what your trained Keras model is actually looking at.

What it does
keras-vis is a Python toolkit for visualizing and debugging trained Keras neural networks. It implements activation maximization, saliency maps, and class activation maps to show which parts of an input image drive a model’s decisions. The library frames every visualization as an energy minimization problem, letting you compose weighted loss functions and regularizers—like total variation and Lp-norm—to generate or highlight inputs via gradient descent. It handles N-dimensional image inputs and works with both Theano and TensorFlow backends in either channel format.
The interesting bit
Instead of scattered one-off scripts, the toolkit unifies these techniques under a single optimization interface. You stack losses and regularizers into an Optimizer object that minimizes them jointly, and use callbacks like GifGenerator to animate the descent, turning a debugging session into a slow-motion replay of the model “deciding” what to see.
Key highlights
- Supports activation maximization, saliency maps, and class activation maps out of the box.
- Treats visualizations as composable energy-minimization problems with pluggable losses and regularizers.
- Handles N-dimensional image inputs and both
channels_firstandchannels_lastformats across Theano and TensorFlow. - Includes input modifiers like
Jitterand callbacks likeGifGeneratorto tweak and record the optimization process. - Requires Keras 2.0 or higher.
Caveats
- Most documentation links are currently broken; the README explicitly redirects users to the
examples/directory for working samples.
Verdict
Worth a look if you are debugging Keras CNNs and prefer composing gradient-based visualizations from modular losses and regularizers. Not for you if you are outside the Keras 2.x/Theano-TensorFlow backend ecosystem or need fully maintained documentation.
Frequently asked
- What is raghakot/keras-vis?
- keras-vis generates saliency maps, activation maximizations, and class activation maps to reveal what your trained Keras model is actually looking at.
- Is keras-vis open source?
- Yes — raghakot/keras-vis is open source, released under the MIT license.
- What language is keras-vis written in?
- raghakot/keras-vis is primarily written in Python.
- How popular is keras-vis?
- raghakot/keras-vis has 3k stars on GitHub.
- Where can I find keras-vis?
- raghakot/keras-vis is on GitHub at https://github.com/raghakot/keras-vis.