Giter VIP home page Giter VIP logo

understandable-protopnet's Introduction

ProtoPNet: Are Learned Concepts Understandable?

A study on the interpretability of the concepts learned by Prototypical Part Networks (ProtoPNets).

This work exploits the part locations annotations available for two different datasets to provide an objective evalution of the prototypes. An additional diversity regularization is also introduced to produce more diverse concepts.

More details on the implementation can be found in the report.

California Gull class


580 583 585 587 588
Female class


2 3 4 6 7

Get started

  • Clone the repository and install the required dependencies:
    git clone https://github.com/materight/explainable-ProtoPNet.git
    cd explainable-ProtoPNet
    pip install -r requirements.txt
  • Download and prepare the data, either for the Caltech-UCSD Birds-200 or the CelebAMask HQ datasets:
    python prepare_data.py cub200
    python prepare_data.py celeb_a

Train a model

To train a new model on a dataset, run:

python train.py --dataset [data_path] --exp_name [experiment_name]

Additional options can be specified (run the script with --help to see the available ones).

After training, the learned prototypes can be further pruned:

python prune_prototypes.py --dataset [data_path] --model [model_path]

Evaluate learned prototypes

To evaluate a trained model and the learned prototypes, run:

python evaluate.py --model [model_path] {global|local|alignment} --dataset [data_path] 
  • global: retrieve for each prototype the most activated patches in the whole dataset.
  • local: evaluate the model on a subset of samples and generate visualizations for the activated prototypes for each class.
  • alignment: generate plots for the alignment matrix of each class.

Acknowledgments

This implementation is based on the original ProtoPNet repository.

understandable-protopnet's People

Contributors

materight avatar

Watchers

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