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

Add split_channels parameter to LayerGradCam.attribute #1086

Closed
wants to merge 3 commits into from

Conversation

dzenanz
Copy link
Contributor

@dzenanz dzenanz commented Dec 7, 2022

This allows examination of each channel's contribution. That is useful if channels are something other than standard RGB, for example multi-spectral input, potentially with many spectral channels.

@facebook-github-bot
Copy link
Contributor

Hi @dzenanz!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 7, 2022

I signed CLA. Is some manual recheck invocation required?

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 14, 2022

This PR is rather small and simple. Any chance someone will review, and maybe merge it?

@NarineK
Copy link
Contributor

NarineK commented Dec 14, 2022

@dzenanz, @vivekmig will look into it. Sorry for the delay.

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 16, 2022

@vivekmig ping!

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 20, 2022

I would still like to have this merged.

@NarineK
Copy link
Contributor

NarineK commented Dec 20, 2022

@split_channels, do you mind adding a test case for split_channels ? We have test cases for LayerGradCam you can add another test case for split_channels feature.

torch.sum(summed_grad * layer_eval, dim=1, keepdim=True)
for summed_grad, layer_eval in zip(summed_grads, layer_evals)
)
if split_channels:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it is useful when relu_attributions == True because otherwise we can also sum returned value of the attributions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split_channels is independent of relu_attributions. They can be applied independently.

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 20, 2022

I will add a test case, probably tomorrow.

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 22, 2022

The first force-push does a plain rebase.

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 22, 2022

I added a test, and it passes on my computer. Please re-review.

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 22, 2022

The second force-push fixes linting errors.

@facebook-github-bot
Copy link
Contributor

@NarineK has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 23, 2022

I can't see the details of failure for "Facebook Internal - Builds & Tests".

This allows examination of each channel's contribution.
That is useful if channels are something other than standard RGB,
for example multi-spectral input, potentially with many spectral channels.
@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 29, 2022

The last force push is a plain rebase on master.

@facebook-github-bot
Copy link
Contributor

@NarineK has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@NarineK merged this pull request in cc5f468.

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

Successfully merging this pull request may close these issues.

None yet

3 participants