Skip to main content

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
    """
    ...

Metadata

Release files for imagenet-c 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imagenet-c 0.0.3
File Size Uploaded
imagenet_c-0.0.3.tar.gz 2.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for imagenet-c 0.0.3
File Interpreter ABI Platform
imagenet_c-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 2.1 MB

Release files / imagenet_c-0.0.3.tar.gz

Download URL imagenet_c-0.0.3.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
93f8ed69710615bdaf9e90805b01c2ba8790bba2095c91db874560eca79696f9
BLAKE2b-256 checksum
How to use checksums
1a6dd6ff956c71d055b9e8e65154653b5f2260ec528af56a0bf0fe7833529830
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6

Release files / imagenet_c-0.0.3-py3-none-any.whl

Download URL imagenet_c-0.0.3-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ca49a99e05b9c75370353cb09625af4c70bcb361044776b3b5f51987b10f581
BLAKE2b-256 checksum
How to use checksums
cf0f127176179c8d403cb15a6418c0dfe1b163934517c3fa18a735bf2a24a729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page