Git Product home page Git Product logo

cfchen-duke / protopnet Goto Github PK

View Code? Open in Web Editor NEW
332.0 332.0 122.0 110.33 MB

This code package implements the prototypical part network (ProtoPNet) from the paper "This Looks Like That: Deep Learning for Interpretable Image Recognition" (to appear at NeurIPS 2019), by Chaofan Chen* (Duke University), Oscar Li* (Duke University), Chaofan Tao (Duke University), Alina Jade Barnett (Duke University), Jonathan Su (MIT Lincoln Laboratory), and Cynthia Rudin (Duke University) (* denotes equal contribution).

License: Other

Jupyter Notebook 8.27% Python 91.73%

protopnet's People

Contributors

cfchen-duke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

protopnet's Issues

Torch warning after warm-up epochs: `lr_scheduler.step()` before `optimizer.step()`

After completing the warm-up epochs, Torch prints the following warning:

lib/python3.9/site-packages/torch/optim/lr_scheduler.py:131: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate
warnings.warn("Detected call of lr_scheduler.step() before optimizer.step(). "

Augmenting Dataset

For anyone recreating this, the img_aug.py file should have this alteration to work correctly I think?

for i in range(len(folders)):
    fd = folders[i]
    tfd = '../../../../' + target_folders[i]

when before it was...

for i in range(len(folders)):
    fd = folders[i]
    tfd = target_folders[i]

Package Requirements

Hello,
Would it be possible to share the versions for the packages needed to run the project? I am having trouble figuring out which version to use for each one (Python, Pytorch, Numpy, OpenCV and Augmentor).

Thank you in advance.

100% accuracy on CUB with VGG-19

Hi,

I am not sure if there is anything wrong with the training. ProtoPNet is able to achieve 100% accuracy (push an no_push) on CUB_200 with VGG-19 backbone around 10 epochs. However, the paper said that the best accuracy is 78.0 ± 0.2. I am using the settings.py for model training.

Could anyone help with this?

model.eval() in local_analysis.py

First of all, thank you for sharing the source code of this inspiring work. It's really appreciated!

After training the model, the results I was getting making predictions with local_analysis.py didn’t match the accuracy calculated by the method test() in train_and_test.py.

Please correct if I am wrong, but I believe it’s because in local_analysis.py, model.eval() is missing after loading the model.

Reproducibility

Does anyone reproduce the accuracy that is claimed in the paper?

Pre-trained models?

Dear authors,

Thank you so much for releasing the code of this fascinating work!
Is there any chance you could also release the pre-trained ProtoPNet models used in your paper?

This would be very useful for us and the community, I believe. Thanks!

Anh

Pretrained weights

Hi,

Thank you for the repo :)

I am interested in your work, and I was wondering if you plan on releasing any pre-trained models ?

Thanks,
Elias

How is the baseline resnet34 model trained?

Dear authors,

may I ask how did you train the baseline resnet34 model to reach 82 acc in CUB-2000-2011 as reported in the paper?

I used cropped images and pretrained res34 but can still only reach 70...

Thanks a lot for any possible hint in advance!

Augmentor Error

I tried to reproduce this code. However, an error occurred in "img_aug.py". The error is listed as follows.

raise IndexError("There are no images in the pipeline. "
IndexError: There are no images in the pipeline. Add a directory using add_directory(), pointing it to a directory containing images.

DEAULT TEST ACCURACY IS SO LOW

Hi there,

I have followed the instruction and intended to reproduce the result. However, after 100 epochs, even though the training accuracy has around 99% but the testing accuracy is never over 1%. Any suggestions or tips? It is quite odd for me.

Thank you very much.

Augmentor error on rotate

The rotate step of the pipeline throws an error on the image "Ring_Billed_Gull_0100_52779.jpg"

  File "lib/python3.9/site-packages/Augmentor/Operations.py", line 843, in do
     image = image.crop((int(round(E)), int(round(A)), int(round(X - E)), int(round(Y - A))))
  File "lib/python3.9/site-packages/PIL/Image.py", line 1206, in crop
     raise ValueError("Coordinate 'lower' is less than 'upper'")
ValueError: Coordinate 'lower' is less than 'upper'

Replacing the call to rotate on line 23 with rotate_without_crop fixes the problem:

p.rotate_without_crop(probability=1, max_left_rotation=15, max_right_rotation=15)

The model cannot handle a single picture

The work is very interesting.

The work is very interesting. I follow the tutorial to train the model. When I use local_analysis.py, I get an error in the model where the picture cannot be input.

image

The error code is here:
image

At the same time, normalize cannot process a single picture.

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.