Test image batch size is one the test accuracy is very low

I run the Tutorials code.http://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html#sphx-glr-beginner-transfer-learning-tutorial-py

When is use test batch size in one. The result is not good.

dataloaders = {x: torch.utils.data.DataLoader(image_datasets, batch_size=1,
shuffle=True, num_workers=4)

model_ft.load_state_dict(torch.load(“./models/model_.pkl”))
visualize_model(model_ft)

torch.save(model_ft.state_dict(),“./models/model_.pkl”)

Figure_2-1

The tutorial should really do model_ft.eval() before testing… It’s using BN layers so batch size do matter when in training mode.

Edit: just submitted an issue for this https://github.com/pytorch/tutorials/issues/203. I’ll do a PR tomorrow.

Thank you! It help a lot!

fyi https://github.com/pytorch/tutorials/pull/205