bethgelab / imagecorruptions

Python package to corrupt arbitrary images.
https://pypi.org/project/imagecorruptions/
Apache License 2.0
409 stars 64 forks source link

Most corruptions fail on Cifar dataset with size 32 x 32 x 3 #21

Open Kishaan opened 2 years ago

Kishaan commented 2 years ago

I'm trying to create corrupted version of Cifar-10 train set and I noticed that this library fails for most of the corruptions. I have attached example images of some noises at severity level 5 where the object in the image is barely visible anymore.

Screenshot from 2022-09-19 13-25-26 Screenshot from 2022-09-19 13-25-03 Screenshot from 2022-09-19 13-24-53 Screenshot from 2022-09-19 13-29-45

And here's the code I'm using to create them:

for corruption_name in ['motion_blur', 'gaussian_noise', 'snow',
                        'pixelate', 'shot_noise', 'impulse_noise', 'defocus_blur',
                        'glass_blur', 'zoom_blur', 'frost', 'fog',
                        'brightness', 'contrast', 'elastic_transform', 'jpeg_compression',
                        'speckle_noise', 'gaussian_blur', 'spatter', 'saturate']:
    print(corruption_name)
    img = img.astype('uint8')
    corrupted_img = corrupt(img, corruption_name=corruption_name, severity=5)
    plt.figure(figsize=(2,2))
    plt.imshow(corrupted_img)
    plt.show()

I remember reading that this library supports images as small as 32x32. Am I missing something?