ava_punksmash
ava_punksmash

Reputation: 407

gaussianblur transform not found in torchvision.transforms

I have written the following data augmentation pipeline for Pytorch:

transform = transforms.Compose([
            transforms.RandomResizedCrop(224),
            transforms.RandomHorizontalFlip(),
            transforms.GaussianBlur(11, sigma=(0.1, 2.0)),
            transforms.ToTensor(),
            transforms.Normalize(mean, std)
        ])

But running the above code gives me the following error:

AttributeError: module 'torchvision.transforms' has no attribute 'GaussianBlur'

Is GaussianBlur a new feature that has not been included in torchvision yet? Or is it just my torchvision version that is too old?

I found it in the following documentation page: torchvision.transforms

Here are my packages versions:

torch                    1.6.0+cu101
torchvision              0.7.0+cu101

Upvotes: 2

Views: 8321

Answers (2)

Oladimeji Mudele
Oladimeji Mudele

Reputation: 63

You update your pytorch to version 1.7.

conda update --all should work (if you use anaconda distribution).

Upvotes: 0

trialNerror
trialNerror

Reputation: 3563

On this documentation page, you can look for features on the different versions of pytorch (change version in the upper left corner). It appears that GaussianBlur did not exist in pytorch 1.6, and was added in 1.7. Your code should work with the latest version.

If interested, here is the relevant merge commit : https://github.com/pytorch/vision/pull/2658

Upvotes: 2

Related Questions