RandomPosterize¶
- class torchvision.transforms.v2.RandomPosterize(bits: int, p: float = 0.5)[原始碼]¶
以給定的機率,透過減少每個顏色通道的位數,將影像或影片進行色調分離 (posterize)。
如果輸入是
torch.Tensor,其型別應為 torch.uint8,且期望具有 […, 1 or 3, H, W] 的形狀,其中 … 表示任意數量的前導維度。如果 img 是 PIL Image,則期望其模式為 “L” 或 “RGB”。使用
RandomPosterize的示例