-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup adjusted to version 1.0, README, package renaming
- Loading branch information
Showing
10 changed files
with
51 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
# add-common-image-corruptions | ||
# imagecorruptions | ||
This package provides a set of corruptions that can be applied to images in order to benchmark the robustness of neural networks. These corruptions are not meant to be used as training data augmentation but rather to test the networks against unseen perturbations. For more information have a look at the paper on the original corruption package by Hendrycks and Dietterich: [Benchmarking Neural Network Robustness to Common Corruptions and Surface Variations](https://arxiv.org/abs/1807.01697) | ||
|
||
## Installation and Usage | ||
This package is pip installable via `pip3 install imagecorruptions`. An example of how to use the corruption function is given below: | ||
```python | ||
from imagecorruptions import corrupt | ||
... | ||
corrupted_image = corrupt(image, corruption_name='gaussian_blur', severity=1) | ||
... | ||
``` | ||
Looping over all available corruptions can be done either by name or by index: | ||
```python | ||
# via name | ||
from imagecorruptions import get_corruption_names | ||
for corruption in get_corruption_names(): | ||
for severity in range(5): | ||
corrupted = corrupt(image, corruption_name=corruption, severity=severity+1) | ||
... | ||
|
||
# via number: | ||
for i in range(15): | ||
for severity in range(5): | ||
corrupted = corrupt(image, corruption_number=i, severity=severity+1) | ||
... | ||
``` | ||
|
||
Note that the first 15 image corruptions are the common corruptions (the ones you get via `get_corruption_names()`). If you really wish to use these as data augmentation, there exist four additional validation corruptions which can be accessed via `get_corruption_names('validation')` which should then be used to test the corruption robustness of the trained model. | ||
|
||
## Credit | ||
This package is an extension of the image corruption functions provided by Dan Hendrycks in the repository [corruptions](https://github.com/hendrycks/robustness). The image corruptions implemented by Hendrycks are generalized to work on images with arbitrary image dimensions and aspect ratios. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters