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.2.tar.gz
(2.1 MB
view details)
Built Distribution
File details
Details for the file imagenet_c-0.0.2.tar.gz
.
File metadata
- Download URL: imagenet_c-0.0.2.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25693d1f41ffb1c4481f9b9ba5016c9d5045ced767e4e9e151fdf9badfe657f5 |
|
MD5 | 2b303ea8f16c1a3e48a0b75e02c72366 |
|
BLAKE2b-256 | 5199011ba6a91bd8b8ca79d8f5b99b44415bab5b1758faf799cb1d43b5260f81 |
File details
Details for the file imagenet_c-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: imagenet_c-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6832b635d05984a570893d9cbfcf16376a0c421d141e896aff760fc907d0ce7 |
|
MD5 | 5b4f6d194be2b27842ea4b0abd4a4df6 |
|
BLAKE2b-256 | 85b4c63d8d1b7dbc6c0877d29e8c616e1f5525754b642dec0d674751df32bd93 |