Giter VIP home page Giter VIP logo

torchray's Introduction

TorchRay

The TorchRay package implements several visualization methods for deep convolutional neural networks using PyTorch. In this release, TorchRay focuses on attribution, namely the problem of determining which part of the input, usually an image, is responsible for the value computed by a neural network.

TorchRay is research oriented: in addition to implementing well known techniques form the literature, it provides code for reproducing results that appear in several papers, in order to support reproducible research.

TorchRay was initially developed to support the paper:

  • Understanding deep networks via extremal perturbations and smooth masks. Fong, Patrick, Vedaldi. Proceedings of the International Conference on Computer Vision (ICCV), 2019.

Examples

The package contains several usage examples in the examples subdirectory.

Here is a complete example for using GradCAM:

from torchray.attribution.grad_cam import grad_cam
from torchray.benchmark import get_example_data, plot_example

# Obtain example data.
model, x, category_id, _ = get_example_data()

# Grad-CAM backprop.
saliency = grad_cam(model, x, category_id, saliency_layer='features.29')

# Plots.
plot_example(x, saliency, 'grad-cam backprop', category_id)

Requirements

TorchRay requires:

  • Python 3.4 or greater
  • pytorch 1.1.0 or greater
  • matplotlib

For benchmarking, it also requires:

  • torchvision 0.3.0 or greater
  • pycocotools
  • mongodb (suggested)
  • pymongod (suggested)

On Linux/macOS, using conda you can install

while read requirement; do conda install \
-c defaults -c pytorch -c conda-forge --yes $requirement; done <<EOF
pytorch>=1.1.0
pycocotools
torchvision>=0.3.0
mongodb
pymongo
EOF

Installing TorchRay

Using pip:

pip install torchray

From source:

python setup.py install

or

pip install .

Full documentation

The full documentation can be found here.

Changes

See the CHANGELOG.

Join the TorchRay community

See the CONTRIBUTING file for how to help out.

The team

TorchRay has been primarily developed by Ruth C. Fong and Andrea Vedaldi.

License

TorchRay is CC-BY-NC licensed, as found in the LICENSE file.

torchray's People

Contributors

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