随机垂直翻转¶ class torchvision.transforms.RandomVerticalFlip(p=0.5)[source]¶ 以给定的概率随机垂直翻转给定的图像。 如果图像是torch张量,则期望其具有[…, H, W]形状,其中…表示任意数量的前导维度。 Parameters: p (float) – 图像被翻转的概率。默认值为0.5 使用 RandomVerticalFlip 的示例: 变换的图示 Illustration of transforms forward(img)[source]¶ Parameters: img (PIL Image 或 Tensor) – 要翻转的图像。 Returns: 随机翻转的图像。 Return type: PIL 图像或张量