holocron.transforms¶
holocron.transforms provides PIL and PyTorch tensor transformations.
Resize
¶
Resize(size: tuple[int, int], mode: ResizeMethod = SQUISH, pad_mode: str = 'constant', **kwargs: Any)
Bases: Resize
Implements a more flexible resizing scheme.

from holocron.transforms import Resize pil_img = ... tf = Resize((224, 224), mode="pad") resized_img = tf(pil_img)
| PARAMETER | DESCRIPTION |
|---|---|
size
|
the desired height and width of the image in pixels |
mode
|
the resizing scheme ("squish" is similar to PyTorch, "pad" will preserve the aspect ratio and pad)
TYPE:
|
pad_mode
|
padding mode when
TYPE:
|
kwargs
|
the keyword arguments of
TYPE:
|
Source code in holocron/transforms/interpolation.py
RandomZoomOut
¶
Bases: Module
Implements a size reduction of the orignal image to provide a zoom out effect.

from holocron.transforms import RandomZoomOut pil_img = ... tf = RandomZoomOut((224, 224), scale=(0.3, 1.)) resized_img = tf(pil_img)
| PARAMETER | DESCRIPTION |
|---|---|
size
|
the desired height and width of the image in pixels |
scale
|
the range of relative area of the projected image to the desired size |
kwargs
|
the keyword arguments of
TYPE:
|