Torchvision.transforms has no attribute of ColorJitter?

Hey guys,

I used torchvision.transforms.ColorJitter to do data augmentation. The codes are as below:
data_transform = transforms.Compose([
transforms.ColorJitter(brightness=0.1,constrast=0.1,saturation=0.1,hue=0.1),
transforms.ToTensor(),
transforms.Normalize([pixel_mean, pixel_mean, pixel_mean], [pixel_std, pixel_std, pixel_std])
])
But it gave the error of 'AttributeError: ‘module’ object has no attribute ‘ColorJitter’'
My Pytorch version is 0.2.0_4. Any help? Thanks in advance

The method is not available in 0.2 http://pytorch.org/docs/0.2.0/torchvision/transforms.html. (note the version selector on top left of doc page.) It should be in 0.3 and master according to the doc.

1 Like

Thanks @SimonW. It works after upgrading Pytorch to 0.3

1 Like