Giter Site home page Giter Site logo

manyue-zhang / frontend-for-captum Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.81 MB

Based on the papers "Interpretability Beyond Feature Attribution: QuantitativeTestingwithConceptActivationVectors(TCAV)" and Captum's instantiation https://captum.ai/docs/captum_insights, we developed this frontend for the Captum project based on the streamlit framework.

captum deep-learning python streamlit tcav webapp

frontend-for-captum's Introduction

Captumcv frontend for captum for working with computer vision models

This is a frontend for the captum library for working with computer vision models. The frontend is written in streamlit and is used to visualize the results of the captum library.

Introduction

Provide a brief introduction to your project, highlighting its purpose and key features. Explain why users might find it useful or interesting.

Requirements

The code was tested with python 3.10 and ubuntu 20.04

Installation

  1. clone the repository
git clone <repository-url>
  1. Install requirements by running:
python setup.py install

Usage

To start the frontend run the following command:

streamlit run main.py

After that the consol will show the url to the frontend. e.g http://localhost:8501

To attribute a model you need to upload:

  1. Image file
  2. Model file
  3. The model definition file
  4. Custom model loader file

After that you can select the method you want to use and the parameters for the method. Currently supported attribution methods are:

  1. Integrated Gradients
  2. Saliency
  3. TCAV
  4. GradCam
  5. Neuron Conductance
  6. Neuron Guided Backpropagation
  7. Deconvolution

For more documentation visit the captum library

Prediction

To predict the output of the model you can use the predict checkbox. Currently only classification models are supported. If you would like see the labels of the model you can upload a json file with the labels. Fallowing should be the layout of the json file:

{
    "num_classes": 10,
    "classes": [
        "airplane",
        "automobile",
        "bird",
        "cat",
        "deer",
        ...
    ]
}

Writing custom loader

To write a custom loader you need to create a class that inherits from the ImageModelWrapper class. Because the python file is loaded dynamically the class needs to have import and inheritance predifined.

For such example see "resources/ResNet18Loader.py"

In the __init__ method the input shape, target image shape, and normalization parameters need to be provided. For custom normalization the preprocess_image method can to be overwritten.

The resources contains two examples. The corresponding models can be downloaded from here (while link is still available)

Contributing

To contribute to this project please open an issue and if possible a pull request.

License

MIT

frontend-for-captum's People

Contributors

manyue-zhang avatar

Watchers

 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.