Skip to content

[1710] Gradcam eval#1734

Merged
wyli merged 6 commits intoProject-MONAI:masterfrom
rijobro:gradcam_eval
Mar 10, 2021
Merged

[1710] Gradcam eval#1734
wyli merged 6 commits intoProject-MONAI:masterfrom
rijobro:gradcam_eval

Conversation

@rijobro
Copy link
Copy Markdown
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.

rijobro added 6 commits March 9, 2021 17:47
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
Signed-off-by: Richard Brown <[email protected]>
@rijobro rijobro requested review from Nic-Ma and wyli March 10, 2021 10:54
Copy link
Copy Markdown
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