Vision: [feature proposal] Adding Gaussian Noise Augmentation to Transforms

Created on 9 Jan 2019  路  8Comments  路  Source: pytorch/vision

cc: @fmassa

needs discussion

Most helpful comment

Yeah this can be done using lambda transforms, like

i = torch.zeros(bs,channels, dim1, dim2).data.normal_(mean, std)

But to make things more easy for users , i thought it is good to add this as a part of primitive transforms.

All 8 comments

Hi,

Does this mean adding a gaussian noise to the image, like x + torch.randn_like(x)?

yep sort of like this !! @fmassa

Let me think a bit more about this, as this can be achieved in a one-liner with LambdaTransform.

Yeah this can be done using lambda transforms, like

i = torch.zeros(bs,channels, dim1, dim2).data.normal_(mean, std)

But to make things more easy for users , i thought it is good to add this as a part of primitive transforms.

@fmassa what's your take should we do this ?

t = T.Compose([T.Lambda(lambda x : x + torch.randn_like(x))])
this works as expected. I think its safe to close this for now and later revisit if requested. Right?

I believe that randn_like generates a uniform distribution... Not a Guassian distribution...

@dlmacedo randn_like is supposed to generate a gaussian distribution, as it calls randn. If that's not the case, it's a bug in PyTorch

Was this page helpful?
0 / 5 - 0 ratings

Related issues

feiyangsuo picture feiyangsuo  路  3Comments

Wadaboa picture Wadaboa  路  3Comments

chinglamchoi picture chinglamchoi  路  3Comments

zhang-zhenyu picture zhang-zhenyu  路  3Comments

datumbox picture datumbox  路  3Comments