yamle.third_party.imagenet_c.corruptions module
This file contains code for the ImageNet-C corruptions, adapted from the original code available at hendrycks/robustness. The adaptation includes:
Variable image size (not fixed to 256x256).
Removal of FSGM (Fast Sign Gradient Method).
Changes to the Motion blur implementation, avoiding the use of the Wand library.
-
yamle.third_party.imagenet_c.corruptions.disk(radius, alias_blur=0.1, dtype=<class 'numpy.float32'>)[source]
-
yamle.third_party.imagenet_c.corruptions.plasma_fractal(mapsize=256, wibbledecay=3)[source]
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.
-
yamle.third_party.imagenet_c.corruptions.clipped_zoom(img, zoom_factor)[source]
-
yamle.third_party.imagenet_c.corruptions.gaussian_noise(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.shot_noise(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.impulse_noise(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.speckle_noise(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.gaussian_blur(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.glass_blur(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.defocus_blur(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.motion_blur(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.zoom_blur(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.fog(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.frost(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.snow(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.spatter(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.contrast(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.brightness(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.saturate(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.jpeg_compression(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.pixelate(x, img_size, severity=1)[source]
-
yamle.third_party.imagenet_c.corruptions.elastic_transform(x, img_size, severity=1)[source]