Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code for interpretation #13

Closed
Adasunnylily opened this issue Oct 10, 2023 · 2 comments
Closed

code for interpretation #13

Adasunnylily opened this issue Oct 10, 2023 · 2 comments

Comments

@Adasunnylily
Copy link

hi, is there any code for interpretation to inference, for example, given a single photo, its classification results and top concepts related? The interpretability of the model is achieved by obtaining a set of concepts for each image. Is there specific implementation code available? Is it the method demonstrated in Figure 7 of the paper, where the weights corresponding to concepts in the fully connected (fc) layer are selected?
Thanks a lot!

@YueYANG1996
Copy link
Owner

We didn't have a script for single photo inference, but it should be very easy to write, you just need to initialize the model from checkpoint like this, and following pytorch-lightning's doc to call the forward function of the model to get the logits on all classes, then do the argmax to make the prediction.

For getting class2concepts association from the weight matrix, we have a function in the model here.

@Adasunnylily
Copy link
Author

ok, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants