RandomSolarize¶ 類 torchvision.transforms.RandomSolarize(threshold, p=0.5)[原始碼]¶ 以給定的機率隨機地對影像進行負片處理,方法是將所有高於閾值的畫素值反轉。如果 img 是 Tensor,則期望其格式為 […, 1 或 3, H, W],其中 … 表示它可以有任意數量的前導維度。如果 img 是 PIL Image,則期望其模式為 “L” 或 “RGB”。 引數: threshold (float) – 所有等於或高於此值的畫素都將被反轉。 p (float) – 影像被負片處理的機率。預設值為 0.5 使用 RandomSolarize 的示例 轉換示例 轉換示例 forward(img)[原始碼]¶ 引數: img (PIL Image 或 Tensor) – 要進行負片處理的影像。 返回值: 隨機負片處理後的影像。 返回型別: PIL Image 或 Tensor