class
ResizeShortestEdge
extends
_MaxSizeResizeResizeShortestEdge(min_size: int, max_size: int, interpolation: str | Interpolation | int = Interpolation.BILINEAR, p: float = 1.0)Reference detection resize: shortest side to min_size, capped.
Applies the single scale factor
so the shorter side reaches min_size unless that would push the
longer side past max_size, in which case the longer side is what
binds. This is what GeneralizedRCNNTransform does, and it is not
expressible as SmallestMaxSize followed by LongestMaxSize —
the latter rescales unconditionally and would undo the first stage.
Parameters
min_sizeintTarget length of the shorter side.
max_sizeintHard cap on the longer side.
Image resampling mode.
pfloat= 1.0Probability of applying the transform.
Examples
>>> import lucid, lucid.utils.transforms as T
>>> tf = T.ResizeShortestEdge(min_size=16, max_size=32)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 16, 16)
The shortest side goes to min_size unless that would push the
longest past max_size, in which case the longest one is what
binds — which is the rule a detector's batching depends on.