Code Monkey home page Code Monkey logo

integrated-gradients's Introduction

Integrated Gradients for the Inception (v1) Network

This repository provides an implementation of the Integrated Gradients methods on the Inception (v1) network Inception (v1) object recognition network.

Integrated Gradients is a method for attributing a deep network's prediction to its input features. It was proposed by this paper published at ICML 2017. In a nutshell, the idea is to examine the gradients of inputs obtained by interpolating on a straightline path between the input at hand and a baseline input, and then aggregate these gradients together. The resulting values form an attribution of the prediction to the input features. In an object recognition network, such attributions could tell us which pixels of the image were responsible for a certain label being picked

The method is widely applicable, requires no modification to the original network and is extremely simple to implement. Additionally, the method is backed by an axiomatic jusfication and has some nice mathematical properties. We recommend reading the paper for more details.

This repository provides an implementation of integrated gradients along with methods for visualizing them.

Running the code

The code for generating and visualizing integrated gradients is in a single Jupyter notebook --- attributions.ipynb.

To run the notebook, please follow the following instructions.

  • Clone this repository

    git clone https://github.com/ankurtaly/Attributions
    
  • In the same directory, run the Jupyter notebook server.

    jupyter notebook
    

    Instructions for installing Jupyter are available here. Please make sure that you have TensorFlow, NumPy, and PIL.Image installed for Python 2.7.

  • Open attributions.ipynb and run all cells.

Visualizations

Below are some visualizations of interior gradients (as a GIF) and integrated gradients for some images from the ImageNet object recognition dataset. For comparison, we also show a visualization of the gradients at the actual image.

Image: 6864d7789068273e

6864d7789068273e

Image: e60dfdf262c5c74f

e60dfdf262c5c74f

Image: 35655d94a4557fbb

35655d94a4557fbb

Image: bda7f59b986d42c0

bda7f59b986d42c0

Image: 96bb6e948866e5b5

96bb6e948866e5b5

Image: 80c64f2e27f8784a

80c64f2e27f8784a

:gImage: b19f875f181025d3

b19f875f181025d3

Image: 2f401b18be02d7fe

2f401b18be02d7fe

Image: 92445d6529368418

92445d6529368418

Image: ba1011c8f9633a49

ba1011c8f9633a49

Image: 3721d654514bc885

3721d654514bc885

Image: 12ec21fa7003eae5

12ec21fa7003eae5

Image: 82262660db12ad85

82262660db12ad85

Image: b2ab69fbb052b435

b2ab69fbb052b435

Image: 9a7e268c95022a1c

9a7e268c95022a1c

Image: 023d8b91c64faf4b

023d8b91c64faf4b

Image: 7f12674c6943381d

7f12674c6943381d

Image: 7bcfe0265ad6a2b5

7bcfe0265ad6a2b5

Image: 518a1c0660c5e32e

518a1c0660c5e32e

Image: e9c7c07cb5730dac

e9c7c07cb5730dac

integrated-gradients's People

Contributors

ankurtaly avatar

Watchers

J avatar paper2code - bot 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.