Skip to content

InterpretDL: Interpretation of Deep Learning Models,基于『飞桨』的模型可解释性算法库

License

Notifications You must be signed in to change notification settings

asdlei99/InterpretDL

 
 

Repository files navigation

中文

InterpretDL: Interpretation of Deep Learning Models based on PaddlePaddle

InterpretDL is short for interpretation of deep learning models.

It is a model interpretation toolkit for PaddlePaddle models.

It provides many useful interpretation algorithms, like LIME, Grad-CAM, IntergratedGradients, etc.

It also contains (and will contain) SOTA and new interpretation algorithms.

InterpretDL is under active construction and all contributions are welcome!

Demo

Interpretation algorithms give a hint of why the black-box model makes this decision.

The following table gives visualizations of several interpretation algorithms applied to the original image with respect to the label "bull_mastiff."

Original Image Integrated Gradients SmoothGrad LIME Grad-CAM

Contents

Installation

It requires the deep learning framework paddlepaddle, recommendation with CUDA support.

Pip installation

pip install interpretdl

# or with baidu mirror
pip install interpretdl -i https://mirror.baidu.com/pypi/simple

Developer installation

git clone https://github.com/PaddlePaddle/InterpretDL.git
# ... fix bugs or add new features
python setup.py install
# welcome to propose pull request and contribute

Documentation

Online link: interpretdl.readthedocs.io.

Or generate the docs locally:

git clone https://github.com/PaddlePaddle/InterpretDL.git
cd docs
make html
open _build/html/index.html

Usage Guideline

All interpreters inherit the abstract class Interpreter, of which interpret(**kwargs) is the function to call.

# an example of SmoothGradient Interpreter.

# import ...

def paddle_model(data):
    class_num = 1000
    model = ResNet50()
    logits = model.net(input=data, class_dim=class_num)
    probs = fluid.layers.softmax(logits, axis=-1)
    return probs

img_path = 'assets/deer.png'
sg = SmoothGradInterpreter(paddle_model, "assets/ResNet50_pretrained")
gradients = sg.interpret(img_path, visual=True, save_path='sg_test.jpg')

More tutorials will be released.

Roadmap

We are planning to create a useful toolkit for offering the model interpretation.

Algorithms

We are planning to implement the algorithms below (categorized into sensitivity interpreters and algorithmic interpreters):

  • LIME
  • FastNormLIME
  • NormLIME
  • LIMEPrior
  • SmoothGrad
  • Occlusion
  • DeepLIFT
  • GradientSHAP
  • GradCAM
  • IntegratedGradients
  • InfluenceFunction
  • ForgettingEvent
  • SGDNoise
  • More ...

Tutorials

We plan to provide at least one example for each interpretation algorithm, and hopefully on different applications, as in CV and NLP.

References of Algorithms

Copyright and License

InterpretDL is provided under the Apache-2.0 license.

About

InterpretDL: Interpretation of Deep Learning Models,基于『飞桨』的模型可解释性算法库

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%