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)[源代码]¶
“SSD: Single Shot MultiBox Detector” 中的“Zoom out”变换。
此变换会随机填充图像、视频、边界框和掩码,从而产生放大效果。输出的空间尺寸将从原始尺寸随机采样,最多可达
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
的示例