Skip to main content

A modernized library for image corruptions based on ImageNet-C

Project description

corrupt_tta

corrupt_tta is a modernized Python library for applying image corruptions, based on the original ImageNet-C benchmark. It has been rewritten to use modern APIs (OpenCV, Scikit-Image, NumPy) and removes outdated dependencies like Wand (ImageMagick).

Installation

pip install corrupt_tta

Usage

import numpy as np
from PIL import Image
from corrupt_tta import corrupt

# Load an image
img = np.array(Image.open("example.jpg"))

# Apply a corruption (e.g., Gaussian Noise with severity 3)
corrupted_img = corrupt(img, severity=3, corruption_name="gaussian_noise")

# Save or display the result
Image.fromarray(corrupted_img.astype(np.uint8)).save("corrupted.jpg")

Available Corruptions

  • Noise: gaussian_noise, shot_noise, impulse_noise, speckle_noise
  • Blur: gaussian_blur, glass_blur, defocus_blur, motion_blur, zoom_blur
  • Weather: fog, frost, snow
  • Digital: contrast, brightness, saturate, jpeg_compression, pixelate, elastic_transform

Feedack

Much of this was written by an LLM agent. If you find bugs, please email: yashmali0326@gmail.com

Citation

If you find this useful in your research, please consider citing the original paper:

@article{hendrycks2019robustness,
  title={Benchmarking Neural Network Robustness to Common Corruptions and Perturbations},
  author={Dan Hendrycks and Thomas Dietterich},
  journal={Proceedings of the International Conference on Learning Representations},
  year={2019}
}

If you wish to reference this specific implementation, you may also cite:

@software{corrupt_tta,
  title = {corrupt_tta: Modernized ImageNet-C Corruptions Implementation},
  author = {Yash Mali},
  year = {2025},
  url = {https://github.com/YashM8/robustness}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

corrupt_tta-0.1.6.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

corrupt_tta-0.1.6-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file corrupt_tta-0.1.6.tar.gz.

File metadata

  • Download URL: corrupt_tta-0.1.6.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for corrupt_tta-0.1.6.tar.gz
Algorithm Hash digest
SHA256 4cf82b37dba030ba72f6a5a8e1e3ee91c1d99870d70c8d4d436eb7ca68cefef7
MD5 95187e4029be0ea3660b74553f86c2ff
BLAKE2b-256 259ebb52f8612aa02ff1701c04429a17ebccebb85958e83b19c603982ed946c7

See more details on using hashes here.

File details

Details for the file corrupt_tta-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: corrupt_tta-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for corrupt_tta-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f56bfa8cd139c865097316d9d5d1b0a6c9fccd2ade89a4912915e6f666481a66
MD5 73aa55310aec2f8333aa42721faeb4cf
BLAKE2b-256 5bdaf113d5b9df93e4d9ad9e47f3b3d347bb2efffdae49f089fd557c54529f84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page