RandomSolarize¶ class torchvision.transforms.RandomSolarize(threshold, p=0.5)[原始碼]¶ 以指定的機率隨機對圖片進行 Solarize 處理,方法是反轉所有高於閾值的像素值。如果 img 是一個 Tensor,則預期為 […, 1 或 3, H, W] 格式,其中 … 表示它可以有任意數量的 leading dimension。如果 img 是 PIL Image,則預期為 “L” 或 “RGB” 模式。 參數: threshold (float) – 所有等於或高於此值的像素都會被反轉。 p (float) – 圖片被 Solarize 的機率。預設值為 0.5 使用 RandomSolarize 的範例 轉換的說明 轉換的說明 forward(img)[原始碼]¶ 參數: img (PIL Image 或 Tensor) – 要進行 Solarize 處理的圖片。 傳回: 隨機 Solarize 的圖片。 傳回類型: PIL Image 或 Tensor