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 Monte-Carlo Dropout #49

Merged
merged 22 commits into from
Oct 18, 2023
Merged

Conversation

badrmarani
Copy link
Collaborator

@badrmarani badrmarani commented Oct 12, 2023

This PR fixes #40. The main changes are:

  • Create a new baseline.
  • Find a solution to apply dropout in eval mode.
  • Add tests.
  • Add a tutorial to explain how to use the baseline.
  • Add the reference to the documentation.
  • Add the parameter enable_last_layer_dropout to enable last-layer dropout.
  • Extend this method to VGG and WideResNet.

@badrmarani badrmarani linked an issue Oct 12, 2023 that may be closed by this pull request
6 tasks
@o-laurent o-laurent self-requested a review October 12, 2023 11:05
@o-laurent o-laurent self-assigned this Oct 12, 2023
@o-laurent o-laurent added the enhancement New feature or request label Oct 12, 2023
@o-laurent
Copy link
Contributor

Hi! Thanks for the great work, again!

I'll have a more thorough look at it next week. I've skimmed your PR and am just wondering how we could adapt your baseline to the different variants of MC Dropout. It may be a question worth considering, given your interest in its variants!

Then, there is also the question of the number of inference passes. I agree that it is more optimal to avoid the for loop and increase the batch size, but it may lead, in some cases, to increased VRAM needs (for instance, with 1000 passes?). We could let the user select the test batch size if wanted (that could be reduced to 1, for instance, if we want to compute the mean on many passes). It seems to be the simplest solution, but it is not completely safe & it adds a new parameter to the CLI.

Copy link
Contributor

@o-laurent o-laurent left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I will make some modifications, but having it in the library is great. If you want, you can join the Discord server whose link I added in the readme of the dev branch!

auto_tutorials_source/tutorial_mc_dropout.py Outdated Show resolved Hide resolved
torch_uncertainty/models/resnet/std.py Outdated Show resolved Hide resolved
torch_uncertainty/models/resnet/std.py Show resolved Hide resolved
torch_uncertainty/models/wideresnet/std.py Outdated Show resolved Hide resolved
@o-laurent o-laurent changed the title Add Monte-Carlo Dropout ✨ Add Monte-Carlo Dropout Oct 18, 2023
@o-laurent o-laurent requested a review from alafage October 18, 2023 15:09
@o-laurent
Copy link
Contributor

I had to make a few changes to avoid errors. Merging now.

@o-laurent o-laurent merged commit cbf6c56 into ENSTA-U2IS-AI:dev Oct 18, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ Add an MCDropout Baseline
2 participants