SameSizeTensorValues
- class hybrid_learning.datasets.transforms.dict_transforms.SameSizeTensorValues(mode='up_bilinear')[source]
Bases:
DictTransform
Up- or down-scale the tensor mask values of a dictionary to all have the same size. The
mode
determines whether and how it is up- or downscaled to the largest/smallest occurring size. Mask tensor sizes are interpreted as([batch_size[, num_channels],] height, width)
. In case the mask has more than one channel, each channel is resized separately.Public Data Attributes:
Settings to reproduce the instance.
Inherited from : py: class:DictTransform
Settings to reproduce the instance.
Inherited from : py: class:Transform
IDENTITY_CLASS
The identity class or classes for composition / addition.
Settings to reproduce the instance.
Public Methods:
apply_to
(annotations)Up- or downscale the values of annotations to the same size according to
mode
.Inherited from : py: class:DictTransform
apply_to
(annotations)Up- or downscale the values of annotations to the same size according to
mode
.Inherited from : py: class:Transform
apply_to
(annotations)Up- or downscale the values of annotations to the same size according to
mode
.Special Methods:
__init__
([mode])Inherited from : py: class:DictTransform
__call__
(annotations)Call method modifying a given dictionary.
Inherited from : py: class:Transform
__repr__
()Return repr(self).
__eq__
(other)Return self==value.
__copy__
()Return a shallow copy of self using settings.
__add__
(other)Return a flat composition of
self
withother
.__radd__
(other)Return a flat composition of
other
andself
.__call__
(annotations)Call method modifying a given dictionary.
- Parameters
mode (Literal['up_bilinear', 'down_max']) –
- apply_to(annotations)[source]
Up- or downscale the values of annotations to the same size according to
mode
. Note that for efficiency reasons annotations is modified in-place!
- mode: Literal['up_bilinear', 'down_max']
Up- or downscaling mode. Allowed values:
up_{interpolation}
: upscaling to largest size using{interpolation}
;the interpolation mode must be one of the options for
torch.nn.functional.interpolate()
; equivalent toOnValues(Resize(max_size))
down_max
: down-scaling via max-pooling