Pytorch 迁移学习预测

Pytorch transfer learning predictions

我一直在关注 pytorch 迁移学习教程,并且按照我自己的数据集的教程,我已经达到了这个

model_conv = train_model(model_conv, criterion, optimizer_conv,
                     exp_lr_scheduler, num_epochs=25)

Epoch 1/1
......
......
......
Epoch 24/24
train Loss: 0.8674 Acc: 0.5784
val Loss: 1.2930 Acc: 0.4583
Training complete in 43m 24s
Best val Acc: 0.486111

教程到此结束,但我不确定如何获得新图像的预测?

任何建议都会很有帮助。 提前致谢。

只需将新图像(与训练数据集中图像的格式相同)提供给模型:

labels = model_conv(new_images)