Torchvision's ColorJitter support of uint8 images?

Does ColorJitter transform support torch.uint8 tensor images?

I found a similar question but for torch.int16 tensor images: ColorJitter Transformation for 16-bit images?

Yes, this seems to work:

transform = transforms.ColorJitter(brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5)
x = torch.randint(0, 256, (3, 224, 224), dtype=torch.uint8)
out = transform(x)

I confirm, it seems to work. I was worried about the scale of brightness and other parameters. Does it need to be scaled to 255 or not… Gotta read the code :slight_smile:

F.adjust_brightness expects a float as seen here using this description:

brightness_factor (float): How much to adjust the brightness. Can be any non negative number. 0 gives a black image, 1 gives the original image while 2 increases the brightness by a factor of 2.