RobustART.noise.utils.imagenet_c package

Submodules

RobustART.noise.utils.imagenet_c.corruptions module

class RobustART.noise.utils.imagenet_c.corruptions.MotionImage(image=None, blob=None, file=None, filename=None, pseudo=None, background=None, colorspace=None, depth=None, extract=None, format=None, height=None, interlace=None, resolution=None, sampling_factors=None, units=None, width=None)

Bases: wand.image.Image

motion_blur(radius=0.0, sigma=0.0, angle=0.0)

Apply a Gaussian blur along an angle direction. This simulates motion movement.

See

Example of motion_blur.

Parameters
  • radius (numbers.Real) – Aperture size of the Gaussian operator.

  • sigma (numbers.Real) – Standard deviation of the Gaussian operator.

  • angle (numbers.Real) – Apply the effect along this angle.

New in version 0.5.4.

RobustART.noise.utils.imagenet_c.corruptions.brightness(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.clipped_zoom(img, zoom_factor)
RobustART.noise.utils.imagenet_c.corruptions.contrast(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.defocus_blur(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.disk(radius, alias_blur=0.1, dtype=<class 'numpy.float32'>)
RobustART.noise.utils.imagenet_c.corruptions.elastic_transform(image, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.fgsm(x, source_net, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.fog(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.frost(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.gaussian_blur(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.gaussian_noise(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.glass_blur(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.impulse_noise(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.jpeg_compression(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.motion_blur(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.pixelate(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.plasma_fractal(mapsize=256, wibbledecay=3)

Generate a heightmap using diamond-square algorithm. Return square 2d array, side length ‘mapsize’, of floats in range 0-255. ‘mapsize’ must be a power of two.

RobustART.noise.utils.imagenet_c.corruptions.saturate(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.shot_noise(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.snow(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.spatter(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.speckle_noise(x, severity=1)
RobustART.noise.utils.imagenet_c.corruptions.zoom_blur(x, severity=1)

Module contents

RobustART.noise.utils.imagenet_c.corrupt(x, severity=1, corruption_name=None, corruption_number=- 1)
Parameters
  • x – image to corrupt; a PIL image

  • severity – strength with which to corrupt x; an integer in [0, 5]

  • corruption_name – specifies which corruption function to call;

must be one of ‘gaussian_noise’, ‘shot_noise’, ‘impulse_noise’, ‘defocus_blur’,

‘glass_blur’, ‘motion_blur’, ‘zoom_blur’, ‘snow’, ‘frost’, ‘fog’, ‘brightness’, ‘contrast’, ‘elastic_transform’, ‘pixelate’, ‘jpeg_compression’, ‘speckle_noise’, ‘gaussian_blur’, ‘spatter’, ‘saturate’; the last four are validation functions

Parameters

corruption_number – the position of the corruption_name in the above list;

an integer in [0, 18]; useful for easy looping; 15, 16, 17, 18 are validation corruption numbers :return: the image in numpy corrupted by a corruption function at the given severity; same shape as input