Permalink
Browse files

Add SaltAndPepper, Salt, Pepper, CoarseSaltAndPepper, CoarseSalt, Coa…

…rsePepper
  • Loading branch information...
aleju committed Oct 1, 2017
1 parent e653f41 commit 196d1a1a5f56649fc309cea156c864b5f9eedadc
View
@@ -51,6 +51,12 @@ The images below show examples for most augmentation techniques (values written
![Dropout per channel](images/examples_dropout_2.jpg?raw=true "Dropout per channel")
![CoarseDropout p=0.2](images/examples_coarsedropout.jpg?raw=true "CoarseDropout p=0.2")
![CoarseDropout p=0.2, per channel](images/examples_coarsedropout_2.jpg?raw=true "CoarseDropout p=0.2, per channel")
![SaltAndPepper](images/examples_saltandpepper.jpg?raw=true "SaltAndPepper")
![Salt](images/examples_salt.jpg?raw=true "Salt")
![Pepper](images/examples_pepper.jpg?raw=true "Pepper")
![CoarseSaltAndPepper p=0.2](images/examples_coarsesaltandpepper.jpg?raw=true "CoarseSaltAndPepper p=0.2")
![CoarseSalt p=0.2](images/examples_coarsesalt.jpg?raw=true "CoarseSalt p=0.2")
![CoarsePepper p=0.2](images/examples_coarsepepper.jpg?raw=true "CoarsePepper p=0.2")
![ContrastNormalization](images/examples_contrastnormalization.jpg?raw=true "ContrastNormalization")
![ContrastNormalization per channel](images/examples_contrastnormalization_2.jpg?raw=true "ContrastNormalization per channel")
![Grayscale](images/examples_grayscale.jpg?raw=true "Grayscale")
@@ -141,8 +141,14 @@ def draw_per_augmenter_images():
(0, "AdditiveGaussianNoise\n(per channel)", [("scale=%.2f*255" % (scale,), iaa.AdditiveGaussianNoise(scale=scale * 255, per_channel=True)) for scale in [0.025, 0.05, 0.1, 0.2, 0.3]]),
(0, "Dropout", [("p=%.2f" % (p,), iaa.Dropout(p=p)) for p in [0.025, 0.05, 0.1, 0.2, 0.4]]),
(0, "Dropout\n(per channel)", [("p=%.2f" % (p,), iaa.Dropout(p=p, per_channel=True)) for p in [0.025, 0.05, 0.1, 0.2, 0.4]]),
(0, "CoarseDropout\n(p=0.2)", [("size_percent=%.2f" % (size_percent,), iaa.CoarseDropout(p=0.2, size_percent=size_percent, min_size=2)) for size_percent in [0.3, 0.2, 0.1, 0.05, 0.02]]),
(3, "CoarseDropout\n(p=0.2)", [("size_percent=%.2f" % (size_percent,), iaa.CoarseDropout(p=0.2, size_percent=size_percent, min_size=2)) for size_percent in [0.3, 0.2, 0.1, 0.05, 0.02]]),
(0, "CoarseDropout\n(p=0.2, per channel)", [("size_percent=%.2f" % (size_percent,), iaa.CoarseDropout(p=0.2, size_percent=size_percent, per_channel=True, min_size=2)) for size_percent in [0.3, 0.2, 0.1, 0.05, 0.02]]),
(0, "SaltAndPepper", [("p=%.2f" % (p,), iaa.SaltAndPepper(p=p)) for p in [0.025, 0.05, 0.1, 0.2, 0.4]]),
(0, "Salt", [("p=%.2f" % (p,), iaa.Salt(p=p)) for p in [0.025, 0.05, 0.1, 0.2, 0.4]]),
(0, "Pepper", [("p=%.2f" % (p,), iaa.Pepper(p=p)) for p in [0.025, 0.05, 0.1, 0.2, 0.4]]),
(0, "CoarseSaltAndPepper\n(p=0.2)", [("size_percent=%.2f" % (size_percent,), iaa.CoarseSaltAndPepper(p=0.2, size_percent=size_percent, min_size=2)) for size_percent in [0.3, 0.2, 0.1, 0.05, 0.02]]),
(0, "CoarseSalt\n(p=0.2)", [("size_percent=%.2f" % (size_percent,), iaa.CoarseSalt(p=0.2, size_percent=size_percent, min_size=2)) for size_percent in [0.3, 0.2, 0.1, 0.05, 0.02]]),
(0, "CoarsePepper\n(p=0.2)", [("size_percent=%.2f" % (size_percent,), iaa.CoarsePepper(p=0.2, size_percent=size_percent, min_size=2)) for size_percent in [0.3, 0.2, 0.1, 0.05, 0.02]]),
(0, "ContrastNormalization", [("alpha=%.1f" % (alpha,), iaa.ContrastNormalization(alpha=alpha)) for alpha in [0.5, 0.75, 1.0, 1.25, 1.50]]),
(0, "ContrastNormalization\n(per channel)", [("alpha=(%.2f, %.2f)" % (alphas[0], alphas[1],), iaa.ContrastNormalization(alpha=alphas, per_channel=True)) for alphas in [(0.4, 0.6), (0.65, 0.85), (0.9, 1.1), (1.15, 1.35), (1.4, 1.6)]]),
(0, "Grayscale", [("alpha=%.1f" % (alpha,), iaa.Grayscale(alpha=alpha)) for alpha in [0.0, 0.25, 0.5, 0.75, 1.0]]),
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -15,7 +15,7 @@
def main():
parser = argparse.ArgumentParser(description="Check augmenters visually.")
parser.add_argument('--only', default=None, help="If this is set, then only the results of an augmenter with this name will be shown.", required=False)
parser.add_argument('--only', default=None, help="If this is set, then only the results of an augmenter with this name will be shown. Optionally, comma-separated list.", required=False)
args = parser.parse_args()
images = [
@@ -92,6 +92,12 @@ def main():
iaa.Invert(p=0.5, name="Invert"),
iaa.Invert(p=0.5, per_channel=True, name="InvertPerChannel"),
iaa.ContrastNormalization(alpha=(0.5, 2.0), name="ContrastNormalization"),
iaa.SaltAndPepper(p=0.05, name="SaltAndPepper"),
iaa.Salt(p=0.05, name="Salt"),
iaa.Pepper(p=0.05, name="Pepper"),
iaa.CoarseSaltAndPepper(p=0.05, size_percent=(0.01, 0.1), name="CoarseSaltAndPepper"),
iaa.CoarseSalt(p=0.05, size_percent=(0.01, 0.1), name="CoarseSalt"),
iaa.CoarsePepper(p=0.05, size_percent=(0.01, 0.1), name="CoarsePepper"),
iaa.Affine(
scale={"x": (0.8, 1.2), "y": (0.8, 1.2)},
translate_px={"x": (-16, 16), "y": (-16, 16)},
@@ -167,7 +173,7 @@ def main():
augmenters.append(iaa.Sometimes(0.5, [aug.copy() for aug in augmenters], name="Sometimes"))
for augmenter in augmenters:
if args.only is None or augmenter.name == args.only:
if args.only is None or augmenter.name in [v.strip() for v in args.only.split(",")]:
print("Augmenter: %s" % (augmenter.name,))
grid = []
for image, kps in zip(images, keypoints):

0 comments on commit 196d1a1

Please sign in to comment.