Skip to main content

A high-level API for ConvNet visualizations in Keras

Project description

keravis

keravis is a high-level API for ConvNet visualizations in Keras. As of v1.0, it supports visualizations of

  1. Convolutional layer activations
  2. 2-dimensional feature space representations
  3. Saliency maps (vanilla backprop, guided backprop, and occlusion)
  4. Generated inputs that result in maximal class scores
  5. Patches in a set of images that maximally activate an intermediate neuron

with support for nested pretrained models.

This is a hobby project that was inspired by lecture 14 of Stanford's CS231n: Convolutional Neural Networks for Visual Recognition http://cs231n.stanford.edu/. It is not yet optimized for serious use (see keras-vis instead).

Installation

You can install keravis using pip

pip install keravis

Usage

Read the documentation

Sample Visualizations

Below are sample visualizations from a small convolutional network trained on MNIST

from keravis import feature_space
feature_space(model,X=x_test[:5000],y=y_test[:5000],kind='tsne')

MNIST_TSNE

from keravis import saliency_backprop
saliency_backprop(model,test_img,class_idx=7)

saliency_1

from keravis import saliency_guided_backprop
saliency_guided_backprop(model,test_img,class_idx=7)

saliency

from keravis import maximal_class_score_input
maximal_class_score_input(model,class_idx=5,dim=(28,28,1))

gradient_ascent_5

from keravis import maximally_activating_patches
maximally_activating_patches(model,'conv2d_1',X=x_test)

MNIST_CONV_FEATURES

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keravis-1.0.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keravis-1.0.2-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file keravis-1.0.2.tar.gz.

File metadata

  • Download URL: keravis-1.0.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for keravis-1.0.2.tar.gz
Algorithm Hash digest
SHA256 af112e2c2c88a6f8d457c3b1682ea4cae48c211eb652b8825e9bdff129cb852a
MD5 0e68c4dee5e1165746d00aebbcfff315
BLAKE2b-256 48d9f7e7f9533125ce695ec65138248bcbc42c11195ffbffa65c14ee4496d762

See more details on using hashes here.

File details

Details for the file keravis-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: keravis-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for keravis-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 977a8ec655e04df9fcbc50ed0324925fd500f97f6234b2d8cfb47cf868a28b61
MD5 b7aeb1a94937526ed998c3e430cd451f
BLAKE2b-256 d28f556ffaa81efd2be08f263af4d717ada31f8497ea3f0fc210b1010703c727

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page