https://github.com/progamergov/pytorch-convis
A tool to visualize convolutional layer activations on an input image.
https://github.com/progamergov/pytorch-convis
cnn convis heatmap machine-learning network-in-network neural-style-pt nin pytorch vgg vision visualisation visualization
Last synced: 7 months ago
JSON representation
A tool to visualize convolutional layer activations on an input image.
- Host: GitHub
- URL: https://github.com/progamergov/pytorch-convis
- Owner: ProGamerGov
- License: mit
- Created: 2018-04-14T03:11:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-23T23:42:35.000Z (almost 6 years ago)
- Last Synced: 2025-03-17T12:11:40.559Z (7 months ago)
- Topics: cnn, convis, heatmap, machine-learning, network-in-network, neural-style-pt, nin, pytorch, vgg, vision, visualisation, visualization
- Language: Python
- Size: 1.29 MB
- Stars: 17
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# convis
A tool to visualize convolutional, ReLU, and pooling layer activations on an input image. This is a PyTorch implementation of [htoyryla](https://github.com/htoyryla)'s [convis](https://github.com/htoyryla/convis).![]()
An output image from a single channel (left), and a layer heatmap (right):### Dependencies:
* [PyTorch](http://pytorch.org/)
### 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](https://github.com/ProGamerGov/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`