RandomZoomOut¶
- class torchvision.transforms.v2.RandomZoomOut(fill: Union[int, float, Sequence[int], Sequence[float], None, dict[Union[type, str], Union[int, float, collections.abc.Sequence[int], collections.abc.Sequence[float], NoneType]] = 0, side_range: Sequence[float] = (1.0, 4.0), p: float = 0.5)[源码]¶
“Zoom out” 变换来自 “SSD: Single Shot MultiBox Detector”。
此变换会随机填充图像、视频、边界框和掩码,从而产生放大效果。输出的空间大小将从原始大小随机采样到通过
side_range
参数配置的最大大小。r = uniform_sample(side_range[0], side_range[1]) output_width = input_width * r output_height = input_height * r
如果输入是
torch.Tensor
或TVTensor
(例如Image
、Video
、BoundingBoxes
等),则它可以具有任意数量的前导批次维度。例如,图像可以具有[..., C, H, W]
的形状。边界框可以具有[..., 4]
的形状。- 参数:
使用
RandomZoomOut
的示例