Linardos / SalEMA

Simple vs complex temporal recurrences for video saliency prediction (BMVC 2019)
https://imatge-upc.github.io/SalEMA/
25 stars 11 forks source link

Wrong usage of dropout #6

Closed Kuro96 closed 4 years ago

Kuro96 commented 4 years ago

Hey dude, you've used dropout incorrectly

if self.dropout is True:
    x = dropout2d(x)

nn.Dropout performs different during train and test phase, your code will result in incorrect inference

Linardos commented 4 years ago

Dropout is used during training to prevent co-adaptation of neurons. On test time you just turn it off. So you just set it to True during training and once you want to load the weights for inference you initialize the model with dropout set to False.

Kuro96 commented 4 years ago

If you say so. But I'd rather set default value of --dropout in get_inference_parser() to False. Anyway, your code helped a lot, thx bro

Linardos commented 4 years ago

That's a valid point, I shouldn't expect the user to set it to False himself, I'll change it. I'm glad the code helped anyway.