[英]Pytorch Pre-trained RESNET18 Model
I have trained a pre-trained RESNET18 model in pytorch and saved it. 我已经在pytorch中训练了预训练的RESNET18模型并保存了它。 While testing the model is giving different accuracy for different mini-batch size.
在测试模型时,对于不同的小批量大小,其精度会有所不同。 Does anyone know why?
有人知道为什么吗?
Yes, I think so. 是的,我想是这样。 RESNET contains batch normalisation layers.
RESNET包含批处理规范化层。 At evaluation time you need to fix these;
在评估时,您需要修复这些问题; otherwise the running means are continuously being adjusted after processing each batch hence giving you different accuracy .
否则,在处理完每批之后,将不断调整运行方式,从而为您提供不同的精度。
Try setting: 尝试设置:
model.eval()
before evaluation. 评估之前。 Note before getting back into training, call
model.train()
. 请注意,在回到训练之前,请调用
model.train()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.