Access to ImageNet-C corruption functions
Project description
ImageNet-C Corruption Functions
With this package, it is possible to corrupt an image with ImageNet-C corruptions.
These functions are exposed with the function corrupt
.
Try
from imagenet_c import corrupt
corrupt(<image>, corruption_number=0)
The corrupt
function looks like
def corrupt(x, severity=1, corruption_name=None, corruption_number=-1):
"""
:param x: image to corrupt; a 224x224x3 numpy array in [0, 255]
:param severity: strength with which to corrupt x; an integer in [0, 5]
:param 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
:param 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 x corrupted by a corruption function at the given severity; same shape as input
"""
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
imagenet_c-0.0.1.tar.gz
(2.1 MB
view hashes)
Built Distribution
Close
Hashes for imagenet_c-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a60435f4742ac3cb4d5dbbea587d295773ca9d00f0b54a6abd422ba61d6e3d19 |
|
MD5 | c761c84598f5c3af62b0715ffd25e8f5 |
|
BLAKE2b-256 | ded1c1914f6d648fd73d830e034754cc20db788d1b607108c0b5a44c1e522f21 |