class
RandomSizedBBoxSafeCrop
extends
_NoParamsTransform[Empty]_BBoxAwareCropRandomSizedBBoxSafeCrop(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
heightintOutput height in pixels after the resize.
widthintOutput width in pixels after the resize.
erosion_ratefloat= 0.0Forwarded to the inner box-safe window — see
BBoxSafeRandomCrop.interpolationint or str= 1Resize mode; accepts reference-framework integer / name
aliases (
0=nearest, 1=bilinear, etc.).pfloat= 1.0Probability of applying the transform.
Examples
>>> import lucid.utils.transforms as T
>>> tf = T.RandomSizedBBoxSafeCrop(height=512, width=512, p=1.0)