Monte Carlo Dropout as Uncertainty predection

I am pretty new to Python and this board so I am not sure, if I am at the right place for my question since it doesn't include any code. If not so, please give my a hint for a better way/place to ask.

I am struggling with using Monte Carlo Dropouts for determine Uncertainty for my image classificator using ResNet18.

I have read several papers to this topic and I am still kinda confused about this topic.

I know already to use dropout like

def dropout2d(input, p=0.5, training=True, inplace=False):

multiply times for getting a variance which can be interpreted as the uncertainty. I am pretty sure, that I already understood how MC-Dropout works in general.

So coming to my questions:

Do I use MC-dropout while training or testing and why? I feel like I have read different ways.

I have searched for a coding example from the dropouts but didn't find anything. Do you know Paper/ example code/ searchlink for a proper code?

Is

nn.dropout2d(imput, p=x, ...) the right way to use dropout for a image classificator?

Thanks for your help.

Topic dropout python

Category Data Science


Monte Carlo Dropouts (MCDO) is used during the prediction / inference phase to provide an estimate of uncertainty for the model's predictions.

Regular dropout during the training phase is a regularization technique.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.