Anjalla
Anjalla

Reputation: 11

What does torchvision.transforms.Resize(size, interpolation=2) actually do?

Does it add to the image if too small or crop if too big or just stretch the image to the desired size?

Upvotes: 0

Views: 3970

Answers (2)

jodag
jodag

Reputation: 22244

Resize stretches the image to span the new size. It samples from the original image using the provided interpolation method.

Upvotes: 0

hola
hola

Reputation: 612

When you set interpolation=2, then you are using Bilinear interpolation, ti can be either used for upsampling or down sampling. In the case of upsampling you are doing something like enter image description here

There are several types of upsampling and down-sampling, but bilinear one uses a combination of the neighbouring pixels to cimpute the new pixel.

Look to this links for more informations: link1; link2

Upvotes: 1

Related Questions