简体   繁体   English

Pytorch预训练的RESNET18模型

[英]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.

相关问题 如何加载预训练的 PyTorch model? - How to load a pre-trained PyTorch model? 访问 PyTorch 模块 - ResNet18 - Accessing PyTorch modules - ResNet18 Tensorflow:加载预先训练的ResNet模型时出错 - Tensorflow: Error while loading pre-trained ResNet model 将输入输入到 resnet18 onnx model(Resnet18 部署用于 object 视频文件中的检测) - Feeding input to resnet18 onnx model (Resnet18 deployment for object detction in video file) 使用预先训练的ImageNet模型进行PyTorch传输学习 - PyTorch transfer learning with pre-trained ImageNet model 是什么让 pytorch 中的预训练 model 错误分类图像 - What makes a pre-trained model in pytorch misclassify an image 从最后一个隐藏层提取特征 Pytorch Re.net18 - Extract features from last hidden layer Pytorch Resnet18 如何使用 Pytorch 中的预训练权重修改具有 4 个通道作为输入的 resnet 50? - how to modify resnet 50 with 4 channels as input using pre-trained weights in Pytorch? 具有两个预训练的ResNet 50的暹罗神经网络-测试模型时的奇怪行为 - Siamese neural network with two pre-trained ResNet 50 - strange behavior while testing model 重新训练预先训练好的ResNet-50型号,使用tf slim进行分类 - Re-train pre-trained ResNet-50 model with tf slim for classification purposes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM