Solved problem tuning the distribution parameters for CIFAR
This commit is contained in:
parent
17fa3b3e77
commit
0c38b8745d
|
@ -29,6 +29,7 @@ class AddRaleighNoise(object):
|
|||
self.mean = a + np.sqrt((np.pi * b) / 4)
|
||||
|
||||
def __call__(self, tensor):
|
||||
print('(mean={0}, std={1})'.format(self.mean, self.std))
|
||||
return tensor + torch.randn(tensor.size()) * self.std + self.mean
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -85,7 +86,6 @@ class AddUniformNoise(object):
|
|||
if self.mean == 0.0:
|
||||
return tensor * self.mean
|
||||
else:
|
||||
print('(mean={0}, std={1})'.format(self.mean, self.std))
|
||||
return tensor + (torch.randn(tensor.size()) * self.std + self.mean)
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -150,10 +150,10 @@ def get_cifar_loaders(batch_size=128, test_batch_size=1000, perc=1.0):
|
|||
transforms.RandomCrop(32, padding=0),
|
||||
# transforms.Normalize((0.5,), (0.5,)),
|
||||
# AddGaussianNoise(0., 0.25),
|
||||
# AddRaleighNoise(1, 2), # Not worinkg for CIFAR
|
||||
AddRaleighNoise(1, 200), # CIFAR requires big b value
|
||||
# AddErlangNoise(0.0001, 0.0001),
|
||||
# AddExponentialNoise(2),
|
||||
AddUniformNoise(2, 1), # Not working for CIFAR
|
||||
# AddUniformNoise(100, 1), # CIFAR requires big a value
|
||||
# AddInpulseNoise(0.5),
|
||||
])
|
||||
|
||||
|
|
Loading…
Reference in New Issue