Issue in using trained model in inference code


I have the best model trained on my dataset and have the validation error and record the true positive list of validation data at the end.

Then, I use the trained model in inference code and use validation set (instead on test set) to see if I get same true positive list. But I don’t! Some of true positives are missed.

What would be the problem? The model is not perfectly stable.

Did you make sure to call model.eval() before the evaluation step?
This will make sure to set all modules to eval, e.g. nn.Dropout won’t drop units and nn.BatchNorm will use the running estimates instead of the batch statistics.