Skip to content
class

RandomSizedBBoxSafeCrop

extends_NoParamsTransform[Empty]_BBoxAwareCrop
RandomSizedBBoxSafeCrop(height: int, width: int, erosion_rate: float = 0.0, interpolation: int | str = 1, p: float = 1.0)

Box-safe crop then resize to a fixed output size (Albumentations RandomSizedBBoxSafeCrop).

Composes BBoxSafeRandomCrop with a fixed-size Resize: first draws a window that fully contains every box (eroded by erosion_rate), then rescales the cropped patch to (height, width). This is the canonical training-time crop for detection / instance-segmentation pipelines where the model expects a fixed input resolution.

Parameters

heightint
Output height in pixels after the resize.
widthint
Output width in pixels after the resize.
erosion_ratefloat= 0.0
Forwarded to the inner box-safe window — see BBoxSafeRandomCrop.
interpolationint or str= 1
Resize mode; accepts reference-framework integer / name aliases (0=nearest, 1=bilinear, etc.).
pfloat= 1.0
Probability of applying the transform.

Examples

>>> import lucid.utils.transforms as T
>>> tf = T.RandomSizedBBoxSafeCrop(height=512, width=512, p=1.0)

Used by 1

Constructors

2
dunder

__init__

→None
__init__(height: int, width: int, erosion_rate: float = 0.0, interpolation: int | str = 1, p: float = 1.0)
dunder

__call__

→object
__call__(inputs: object)

Instance methods

1
fn

make_params

→Emptyfrom _NoParams
make_params(img: Tensor)

Dunder methods

1