GithubHelp home page GithubHelp logo

farlandliu / cnnvis-pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leelabcnbc/cnnvis-pytorch

0.0 1.0 0.0 14.41 MB

visualization of CNN in PyTorch

Jupyter Notebook 99.89% Python 0.11%

cnnvis-pytorch's Introduction

cnnvis-pytorch

visualization of CNN in PyTorch

this project is inspired by a summary of visualization methods in Lasagne examples, as well as deep visualization toolbox.

Visualization of CNN units in higher layers is important for my work, and currently (May 2017), I'm not aware of any library with similar capabilities as the two mentioned above written for PyTorch. For a discussion of this feature in PyTorch, see https://discuss.pytorch.org/t/understanding-deep-network-visualize-weights/2060

Indeed I have some experience with deep visualization toolbox, which only supports Caffe. However, it has very poor support for networks whose input size is not around 256x256x3 (standard size for ImageNet dataset, before cropping), and indeed I need to visualize networks not having input of such size, such as networks trained on CIFAR-10, etc. In addition, it can't support visualization techniques other than "deconvolution". Therefore, eventually, converting PyTorch models to Caffe and then hacking the code of deep visualization toolbox to make it work is probably not worthwhile.

Some people have tried doing visualization in TensorFlow. See https://github.com/insikk/Grad-CAM-tensorflow. However, TensorFlow has too much boilerplate, and in general I'm not familiar with it. I believe with the huge amount of boilerplate around TensorFlow, figuring out the usage of existing visualization code on my particular models, adapted to my particular needs, would possibly take more of my time than working on a pure PyTorch solution.

Implementation

It's going to be implemented mainly through forward and backward hooks of torch.nn.Module. Since most of visualization techniques focus on fiddling with ReLU layers, this means that as long as your ReLU layers, as well as those layers which contain your interested units are implemented using torch.nn.Module, not torch.nn.functional, then the code should work.

Alternatives

While it's possible to define some modified ReLU layers, as suggested by PyTorch developers, this make break the code, as autograd assumes correct grad computation.

cnnvis-pytorch's People

Contributors

zym1010 avatar

Watchers

farland 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.