inception_v3
requires an input of (299, 299)
while other models requires an input of (224, 224).
Due to adaptive pooling used in some models,
they can run on varying sized intput without throwing errors
(but the results are usually not correct).
You have to resize/crop an image to be the right input size
(and then other necessary transformations, e.g., to_tensor
Tips on Torchvision
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
https://pytorch.org/docs/stable/torchvision/index.html
Tensor Transformations in TorchVision
Comments¶
Transformations in
torchvision.transforms
work on images, tensors (representing images) and possibly on numpy arrays (representing images). However, a transformation (e.g.,ToTensor
) might work differently on different input types. So you'd be clear about what exactly a transformation function does. A good practice is to always convert your non-tensor input data to tensors using the transformationToTensor