RandomAutocontrast¶ class torchvision.transforms.RandomAutocontrast(p=0.5)[来源]¶ 以给定的概率随机自动对比给定图像的像素。如果图像是 torch Tensor,则预期具有 […, 1 或 3, H, W] 形状,其中 … 表示任意数量的前导维度。如果 img 是 PIL 图像,则预期为 “L” 或 “RGB” 模式。 参数: p (float) – 图像被自动对比的概率。默认值为 0.5 使用 RandomAutocontrast 的示例 变换的图示 变换的图示 forward(img)[来源]¶ 参数: img (PIL 图像 或 Tensor) – 要自动对比的图像。 返回: 随机自动对比的图像。 返回类型: PIL 图像或 Tensor