随机自动对比度¶ class torchvision.transforms.RandomAutocontrast(p=0.5)[source]¶ 以给定的概率随机对给定图像的像素进行自动对比度调整。 如果图像是torch张量,则期望其具有[…, 1或3, H, W]形状,其中…表示任意数量的前导维度。 如果图像是PIL图像,则期望其模式为“L”或“RGB”。 Parameters: p (float) – 图像自动对比的概率。默认值为0.5 使用 RandomAutocontrast 的示例: 变换的图示 Illustration of transforms forward(img)[source]¶ Parameters: img (PIL Image 或 Tensor) – 要进行自动对比度调整的图像。 Returns: 随机自动对比的图像。 Return type: PIL 图像或张量