RandomSolarize¶ class torchvision.transforms.v2.RandomSolarize(threshold: float, p: float = 0.5)[原始碼]¶ 以給定的機率對影像或影片進行 Solarize(曝光過度/底片效果),透過反轉高於某個閾值的所有畫素值來實現。 如果 img 是 Tensor,期望其格式為 […, 1 or 3, H, W],其中 … 表示可以有任意數量的前導維度。如果 img 是 PIL Image,期望其模式為 “L” 或 “RGB”。 引數: threshold (float) – 等於或高於此值的所有畫素都將被反轉。 p (float) – 影像被 Solarize 的機率。預設值為 0.5 使用 RandomSolarize 的示例 變換示例 變換示例 transform(inpt: Any, params: Dict[str, Any]) → Any[原始碼]¶ 自定義變換需要重寫的方法。 參見 如何編寫自己的 v2 變換