Smallest max size
Rescale such that the minimum side is equal to the given maximum size

Parameters

Minimum size of smallest side

The parameter that specifies the length of the maximum size that is to be used to resize minimum side of the image.
The aspect ratio of the original image is preserved.

Advanced option

Interpolation

The algorithm to be used for the resizing of the image. For more information regarding the interpolation, you can see it here .
1
import albumentations as albu
2
from PIL import Image
3
import numpy as np
4
โ€‹
5
โ€‹
6
transform =albu.SmallestMaxSize(max_size=1024, interpolation=1,p=1)
7
#default interpolation is INTER_LINEAR
8
โ€‹
9
โ€‹
10
image = np.array(Image.open('/some/image/file/path'))
11
image = transform(image=image)['image']
12
โ€‹
13
โ€‹
14
# Now the image is preprocessed and ready to be accepted by the model
15
โ€‹
Copied!

Further Resources

โ€‹
Last modified 3mo ago