Skip to content
class

CropAndPad

extends_NoParamsGeometricTransform[Empty]
CropAndPad(px: int = 0, value: float = 0.0, p: float = 1.0)

Crop (negative) or pad (positive) every side by px pixels.

A simplified Albumentations CropAndPad supporting a single int px applied to all four sides.

Parameters

pxint= 0
Positive pads, negative crops, on every side.
valuefloat= 0.0
Pad fill (for positive px).
pfloat= 1.0
No description.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.CropAndPad(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__(px: int = 0, value: float = 0.0, p: float = 1.0)

Instance methods

1
fn

make_params

→Emptyfrom _NoParams
make_params(img: Tensor)

Dunder methods

1