添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
有腹肌的香烟  ·  Microchip Classic·  1 年前    · 
逆袭的凉面  ·  在 Python ...·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

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

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.