3Dcnn false positive model debugging (8)

Pytorch's training mode and test mode switch
when using, remember to switch according to the actual situation:
model.train()
model.eval()

General training time:

net = NoduleNet()
net = net.cuda ()
cudnn.benchmark = True
net = DataParallel(net)
net.train()

When testing:

net = NoduleNet()
net = net.cuda ()
net = DataParallel(net)
net.eval()

For the different Batch Normalization and Dropout method modes of the model during training and testing, it is necessary to switch.

But under the same data in my test, different test results will still be different. Although it fluctuates within a certain range, it is still uncomfortable.

https://blog.csdn.net/kangk_521/article/details/81225787 This blog let me know that it turned out to be during evaluation. Because of the existence of dropout, some intermediate results will be randomly lost every time it runs, which leads to the final The results are different. I don’t quite understand the method he gave

  http://www.cnblogs.com/king-lps/p/8570021.html The blog post says that eval is evaluation mode, and train is training mode. Only when there is a Dropoutsum BatchNormin the model will it have an effect. Because dropout and BN are both turned on during training, and in general, dropout is turned off during testing. The parameters in BN are also the parameters reserved during training, so you should enter the evaluation mode during testing. But according to his statement, the test result should not change.

Guess you like

Origin blog.csdn.net/qq_36401512/article/details/89714923