Skip to main content

Visualization of filters in convolutional neural networks

Project description

Warning

This repository is archived and is no longer maintained.

Conveiro

Conveiro (convolutional + oneiro, Greek for "dream") is an open source library for feature visualization in deep convolutional networks. It implements multiple techniques for visualization, such as laplace, multiscale, deep dream and CDFS.

All of these methods are based on:

Deep dream

Deep dream is implementation of technique based on

How it works:

  • We create random image (or we can use seed image)
  • We feed this image to network and optimize it based on calculated gradients
  • We employ few clever tricks based on scaling and frequencies

There are few more steps but this is the essence of this technique.

CDFS

CDFS (color-decorrelated fourier space) is custom implementation of technique based on

How it works:

  • We generate random complex coefficient
  • We use said coefficients to generate image by inverse fourier transformation
  • After we feed this image to network we can calculate gradients and use gradient descent to optimize these coefficient

There are few more steps but this is the essence of this technique.

Requirements

  • Python 3.4 and above
  • Tensorflow (CPU or GPU variant, version 2 not yet supported)
  • Numpy
  • Matplotlib
  • click, tensornets, pillow, graphviz (if you want to use the command-line tool with examples)

Installation

pip install conveiro

Development version

pip install -e .    # from cloned repository

Command-line usage

This library comes with a command-line tool called conveiro that can visualize and hallucinate networks from tensornets library.

Usage: conveiro COMMAND [OPTIONS] [ARGS]...

Commands:
  graph     Create a graph of the network architecture.
  layers    List available layers (operations) in a network.
  networks  List available network architectures (from tensornets).
  render    Hallucinate an image for a layer / neuron.

Run conveiro --help or conveiro [command-name] --help to show the list of capabilities and options.

Examples

For examples how to use this library please take a look at jupyter notebooks in docs/ folder:

Simplest example:

import tensorflow as tf
import tensornets as nets
from conveiro import cdfs

input_t, decorrelated_image_t, coeffs_t = cdfs.setup(224)

model = nets.Inception1(input_t)
graph = tf.get_default_graph()

with tf.Session() as sess:
    sess.run(model.pretrained())

    objective = graph.get_tensor_by_name("inception1/block3b/concat:0")
    image = cdfs.render_image(sess, decorrelated_image_t, coeffs_t, objective[..., 55], 0.01)
    cdfs.show_image(cdfs.process_image(image))

CDFS output

Note The API is preliminary and may change in future versions.

Articles

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

conveiro-0.2.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

conveiro-0.2.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file conveiro-0.2.1.tar.gz.

File metadata

  • Download URL: conveiro-0.2.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for conveiro-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b8ef9640754a1fd25768afdc5fb31de09232dd3fc0b1477c120da661e5523326
MD5 c54fecc52a34d274b5b81890198f5c08
BLAKE2b-256 a0827ca6686068cabd433beeb3d21b6c63aa15c54c16ffcb75c9e49da55839e1

See more details on using hashes here.

File details

Details for the file conveiro-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: conveiro-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for conveiro-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0c27ccfb3d965da700864a51dcd4099296a44fed5043ba90c6a0a5b8a6bbb21
MD5 7fccc910871817b4bc31b2c6ad092383
BLAKE2b-256 fb5df1ecdc33ff2490b3c9df325ced1c299f95c1a29608cda7053c2db0b84bc3

See more details on using hashes here.

Supported by

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