yamle.third_party.imagenet_c.extra module#

class yamle.third_party.imagenet_c.extra.RandomImageNoise(size, minimum, maximum, mean, std, noise='uniform')[source]#

Bases: object

This class creates an image where each pixel is uniformly distributed between 0 and 255.

Parameters:
  • size (Tuple[int, int, int]) – The size of the image. The shape is (channels, height, width).

  • minimum (torch.Tensor) – The minimum value of each pixel per channel.

  • maximum (torch.Tensor) – The maximum value of each pixel per channel.

  • mean (torch.Tensor) – The mean value of each pixel per channel.

  • std (torch.Tensor) – The standard deviation of each pixel per channel.

  • noise (str) – The type of noise to use. Can be one of uniform or gaussian. Default: uniform.

class yamle.third_party.imagenet_c.extra.RandomTabularNoise(size, minimum, maximum, mean, std, noise='uniform')[source]#

Bases: object

This class creates a tabular noise where each feature is uniformly sampled between min and max.

Parameters:
  • size (Tuple[..., int]) – The size of the tabular noise. The shape is (features).

  • minimum (torch.Tensor) – The minimum value of each feature.

  • maximum (torch.Tensor) – The maximum value of each feature.

  • mean (torch.Tensor) – The mean value of each feature.

  • std (torch.Tensor) – The standard deviation of each feature.

  • noise (str) – The type of noise to use. Can be one of uniform or gaussian. Default: uniform.