Code Monkey home page Code Monkey logo

pytorch-convis's Introduction

convis

A tool to visualize convolutional, ReLU, and pooling layer activations on an input image. This is a PyTorch implementation of htoyryla's convis.

An output image from a single channel (left), and a layer heatmap (right):

Dependencies:

Setup:

After installing the dependencies, you'll need to run the following script to download the default VGG and NIN models:

python models/download_models.py

You can also place convis.py or convis_heatmap.py in your neural-style-pt directory, in order to more easily work with models and input images.

Usage:

convis.py will create an output image for every channel in the specified layer:

python convis.py -input_image examples/inputs/tubingen.jpg -model_file models/vgg19-d01eb7cb.pth -layer conv2_2 -output_dir output

convis_heatmap.py will create a single output image composed of every channel in the specified layer:

python convis_heatmap.py -input_image examples/inputs/tubingen.jpg -model_file models/vgg19-d01eb7cb.pth -layer relu4_2

Parameters:

  • -input_image: Path to the input image.
  • -image_size: Maximum side length (in pixels) of the generated image. Default is 512.
  • -layer: The target layer. Default is relu4_2
  • -pooling: The type of pooling layers to use; one of max or avg. Default is max.
  • -model_file: Path to the .pth file for the VGG or NIN model.
  • -output_image: Name of the output image. Default is out.png.
  • -output_dir: Name of the output image directory. Default is output.

The output files will be named like output/tubingen-conv3_2-69.png

pytorch-convis's People

Contributors

progamergov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.