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

[1710] Gradcam eval #1734

Merged
merged 6 commits into from
Mar 10, 2021
Merged

[1710] Gradcam eval #1734

merged 6 commits into from
Mar 10, 2021

Conversation

rijobro
Copy link
Contributor

@rijobro rijobro commented Mar 10, 2021

Fixes #1710.

Description

The problem was that for class_idx=None, the argmax was used in training_mode, resulting in different inferred classes compared to eval_mode. Secondly, the model was getting silently updated. Solved by using self.model.eval() but not using with torch.no_grad() or with eval_mode(self.model).

I've added a new test to check that when class_idx=None the inferred model is the same as that using eval_mode.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh --codeformat --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick.

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro requested review from wyli and Nic-Ma March 10, 2021 10:54
Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

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

thanks!

@wyli wyli merged commit d4c201e into Project-MONAI:master Mar 10, 2021
@rijobro rijobro deleted the gradcam_eval branch March 10, 2021 15:45
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

Successfully merging this pull request may close these issues.

GradCam giving inconsistent results
2 participants