conveiro


Nameconveiro JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/showmax/conveiro
SummaryVisualization of filters in convolutional neural networks
upload_time2024-03-18 10:14:25
maintainer
docs_urlNone
authorThe ShowmaxLab & Showmax teams
requires_python~=3.4
licenseApache License, Version 2.0
keywords cnn neural networks deep dream visualization
VCS
bugtrack_url
requirements scipy numpy matplotlib tensorflow tensornets pillow click graphviz
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## 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

* https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb
* https://ai.googleblog.com/2015/06/inceptionism-going-deeper-into-neural.html

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
* https://distill.pub/2017/feature-visualization/
* https://github.com/tensorflow/lucid

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:

* https://github.com/Showmax/conveiro/tree/master/docs/deep_dream.ipynb
* https://github.com/Showmax/conveiro/tree/master/docs/cdfs.ipynb

Simplest example:

```python
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](docs/example.png)

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

## Articles

* [Showmax Tech Blog: Introducing Conveiro...](https://tech.showmax.com/2019/04/conveiro/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/showmax/conveiro",
    "name": "conveiro",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.4",
    "maintainer_email": "",
    "keywords": "CNN,neural networks,deep dream,visualization",
    "author": "The ShowmaxLab & Showmax teams",
    "author_email": "oss+conveiro@showmax.com",
    "download_url": "https://files.pythonhosted.org/packages/a0/82/7ca6686068cabd433beeb3d21b6c63aa15c54c16ffcb75c9e49da55839e1/conveiro-0.2.1.tar.gz",
    "platform": "any",
    "description": "## Warning\nThis repository is archived and is no longer maintained.\n\n# Conveiro\n\nConveiro (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.\n\nAll of these methods are based on:\n\n### Deep dream\n\nDeep dream is implementation of technique based on\n\n* https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb\n* https://ai.googleblog.com/2015/06/inceptionism-going-deeper-into-neural.html\n\nHow it works:\n* We create random image (or we can use seed image)\n* We feed this image to network and optimize it based on calculated gradients\n* We employ few clever tricks based on scaling and frequencies\n\nThere are few more steps but this is the essence of this technique.  \n\n### CDFS\nCDFS (color-decorrelated fourier space) is custom implementation of technique based on\n* https://distill.pub/2017/feature-visualization/\n* https://github.com/tensorflow/lucid\n\nHow it works:\n* We generate random complex coefficient\n* We use said coefficients to generate image by inverse fourier transformation\n* After we feed this image to network we can calculate gradients and use gradient descent to optimize these coefficient\n\nThere are few more steps but this is the essence of this technique.\n\n## Requirements\n\n* Python 3.4 and above\n* Tensorflow (CPU or GPU variant, version 2 not yet supported)\n* Numpy\n* Matplotlib\n* click, tensornets, pillow, graphviz (if you want to use the command-line tool with examples)\n\n## Installation\n\n```\npip install conveiro\n```\n\nDevelopment version\n\n```\npip install -e .    # from cloned repository\n```\n\n## Command-line usage\n\nThis library comes with a command-line tool called `conveiro`\nthat can visualize and hallucinate networks from `tensornets` library.\n\n```\nUsage: conveiro COMMAND [OPTIONS] [ARGS]...\n\nCommands:\n  graph     Create a graph of the network architecture.\n  layers    List available layers (operations) in a network.\n  networks  List available network architectures (from tensornets).\n  render    Hallucinate an image for a layer / neuron.\n```\n\nRun `conveiro --help` or `conveiro [command-name] --help` to \nshow the list of capabilities and options.\n\n## Examples\n\nFor examples how to use this library please take a look at jupyter notebooks in `docs/` folder:\n\n* https://github.com/Showmax/conveiro/tree/master/docs/deep_dream.ipynb\n* https://github.com/Showmax/conveiro/tree/master/docs/cdfs.ipynb\n\nSimplest example:\n\n```python\nimport tensorflow as tf\nimport tensornets as nets\nfrom conveiro import cdfs\n\ninput_t, decorrelated_image_t, coeffs_t = cdfs.setup(224)\n\nmodel = nets.Inception1(input_t)\ngraph = tf.get_default_graph()\n\nwith tf.Session() as sess:\n    sess.run(model.pretrained())\n\n    objective = graph.get_tensor_by_name(\"inception1/block3b/concat:0\")\n    image = cdfs.render_image(sess, decorrelated_image_t, coeffs_t, objective[..., 55], 0.01)\n    cdfs.show_image(cdfs.process_image(image))\n```\n\n![CDFS output](docs/example.png)\n\n**Note** The API is preliminary and may change in future versions.\n\n## Articles\n\n* [Showmax Tech Blog: Introducing Conveiro...](https://tech.showmax.com/2019/04/conveiro/)\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Visualization of filters in convolutional neural networks",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/showmax/conveiro"
    },
    "split_keywords": [
        "cnn",
        "neural networks",
        "deep dream",
        "visualization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb5df1ecdc33ff2490b3c9df325ced1c299f95c1a29608cda7053c2db0b84bc3",
                "md5": "7fccc910871817b4bc31b2c6ad092383",
                "sha256": "b0c27ccfb3d965da700864a51dcd4099296a44fed5043ba90c6a0a5b8a6bbb21"
            },
            "downloads": -1,
            "filename": "conveiro-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7fccc910871817b4bc31b2c6ad092383",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.4",
            "size": 15465,
            "upload_time": "2024-03-18T10:14:24",
            "upload_time_iso_8601": "2024-03-18T10:14:24.122204Z",
            "url": "https://files.pythonhosted.org/packages/fb/5d/f1ecdc33ff2490b3c9df325ced1c299f95c1a29608cda7053c2db0b84bc3/conveiro-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0827ca6686068cabd433beeb3d21b6c63aa15c54c16ffcb75c9e49da55839e1",
                "md5": "c54fecc52a34d274b5b81890198f5c08",
                "sha256": "b8ef9640754a1fd25768afdc5fb31de09232dd3fc0b1477c120da661e5523326"
            },
            "downloads": -1,
            "filename": "conveiro-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c54fecc52a34d274b5b81890198f5c08",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.4",
            "size": 15307,
            "upload_time": "2024-03-18T10:14:25",
            "upload_time_iso_8601": "2024-03-18T10:14:25.892645Z",
            "url": "https://files.pythonhosted.org/packages/a0/82/7ca6686068cabd433beeb3d21b6c63aa15c54c16ffcb75c9e49da55839e1/conveiro-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-18 10:14:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "showmax",
    "github_project": "conveiro",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "tensorflow",
            "specs": [
                [
                    "<",
                    "2.0"
                ]
            ]
        },
        {
            "name": "tensornets",
            "specs": []
        },
        {
            "name": "pillow",
            "specs": []
        },
        {
            "name": "click",
            "specs": []
        },
        {
            "name": "graphviz",
            "specs": []
        }
    ],
    "lcname": "conveiro"
}
        
Elapsed time: 0.22232s