Skip to content
class

Downscale

extendsPhotometricTransform[ScaleParam]
Downscale(scale_min: float = 0.25, scale_max: float = 0.25, p: float = 0.5)

Downscale then upscale to lose high-frequency detail (Albumentations Downscale).

Samples a scale factor uniformly from [scale_min, scale_max], resizes the image to that fraction of its original (H, W) via nearest-neighbour, then resizes back to the original size — a cheap way to simulate sensor / JPEG block-level degradation.

Parameters

scale_minfloat= 0.25
Lower bound of the downscale factor.
scale_maxfloat= 0.25
Upper bound of the downscale factor (set equal to scale_min for a deterministic factor).
pfloat= 0.5
Probability of applying the transform.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.Downscale(p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)

Used by 1

Constructors

1
dunder

__init__

→None
__init__(scale_min: float = 0.25, scale_max: float = 0.25, p: float = 0.5)

Instance methods

1
fn

make_params

→ScaleParam
make_params(img: Tensor)

Sample per-call random parameters for Downscale.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

ScaleParam

Carries scale — the downscale factor sampled uniformly from [scale_min, scale_max].

Dunder methods

1