RandomSolarize¶ class torchvision.transforms.RandomSolarize(threshold, p=0.5)[source]¶ 通过以给定概率反转高于阈值的所有像素值来随机太阳化图像。如果 img 是 Tensor,它应该为 […, 1 或 3, H, W] 格式,其中 … 表示它可以有任意数量的前导维度。如果 img 是 PIL Image,它应该为 “L” 或 “RGB” 模式。 参数: threshold (float) – 所有等于或高于此值的像素将被反转。 p (float) – 图像被太阳化的概率。默认值为 0.5 使用 RandomSolarize 的示例 转换图示 转换图示 forward(img)[source]¶ 参数: img (PIL Image 或 Tensor) – 被太阳化的图像。 返回: 随机太阳化后的图像。 返回类型: PIL 图像或张量