Shortcuts

随机水平翻转

class torchvision.transforms.v2.RandomHorizontalFlip(p: float = 0.5)[source]

以给定的概率水平翻转输入。

如果输入是torch.TensorTVTensor(例如Image视频BoundingBoxes等), 它可以有任意数量的前导批次维度。例如, 图像可以有[..., C, H, W]形状。边界框可以有[..., 4]形状。

Parameters:

p (float, 可选) – 输入被翻转的概率。默认值为0.5

使用 RandomHorizontalFlip 的示例:

开始使用 transforms v2

Getting started with transforms v2

变换的图示

Illustration of transforms

Transforms v2: 端到端目标检测/分割示例

Transforms v2: End-to-end object detection/segmentation example

如何使用CutMix和MixUp

How to use CutMix and MixUp

如何编写自己的v2转换

How to write your own v2 transforms

如何编写你自己的TVTensor类

How to write your own TVTensor class