Giter Club home page Giter Club logo

albumentations_examples's Introduction

Notebooks

If you found errors in the notebooks, please create:

  1. Pull request with the fix or
  2. Submit an issue to the main repository of Albumentations

Usage examples

For detailed examples, see notebooks.

from albumentations import (
    HorizontalFlip, ShiftScaleRotate, CLAHE, RandomRotate90,
    Transpose, ShiftScaleRotate, Blur, OpticalDistortion, GridDistortion, HueSaturationValue,
    GaussNoise, MotionBlur, MedianBlur,
    RandomBrightnessContrast, Flip, OneOf, Compose
)
import numpy as np

def strong_aug(p=0.5):
    return Compose([
        RandomRotate90(),
        Flip(),
        Transpose(),
        GaussNoise(),
        OneOf([
            MotionBlur(p=0.2),
            MedianBlur(blur_limit=3, p=0.1),
            Blur(blur_limit=3, p=0.1),
        ], p=0.2),
        ShiftScaleRotate(shift_limit=0.0625, scale_limit=0.2, rotate_limit=45, p=0.2),
        OneOf([
            OpticalDistortion(p=0.3),
            GridDistortion(p=0.1)
        ], p=0.2),
        OneOf([
            CLAHE(clip_limit=2),
            RandomBrightnessContrast(),
        ], p=0.3),
        HueSaturationValue(p=0.3),
    ], p=p)

image = np.ones((300, 300, 3), dtype=np.uint8)
mask = np.ones((300, 300), dtype=np.uint8)
whatever_data = "my name"
augmentation = strong_aug(p=0.9)
data = {"image": image, "mask": mask, "whatever_data": whatever_data, "additional": "hello"}
augmented = augmentation(**data)
image, mask, whatever_data, additional = augmented["image"], augmented["mask"], augmented["whatever_data"], augmented["additional"]

Augmentations examples

MultiplicativeNoise

  1. Original image
  2. MultiplicativeNoise(multiplier=0.5, p=1)
  3. MultiplicativeNoise(multiplier=1.5, p=1)
  4. MultiplicativeNoise(multiplier=[0.5, 1.5], per_channel=True, p=1)
  5. MultiplicativeNoise(multiplier=[0.5, 1.5], elementwise=True, p=1)
  6. MultiplicativeNoise(multiplier=[0.5, 1.5], elementwise=True, per_channel=True, p=1)

MultiplicativeNoise image

ToSepia

  1. Original image
  2. ToSepia(p=1)

ToSepia image

ChannelDropout

  1. Original image
  2. ChannelDropout(channel_drop_range=(1, 1), fill_value=0, p=1)
  3. ChannelDropout(channel_drop_range=(1, 1), fill_value=0, p=1)
  4. ChannelDropout(channel_drop_range=(1, 1), fill_value=0, p=1)
  5. ChannelDropout(channel_drop_range=(1, 1), fill_value=0, p=1)
  6. ChannelDropout(channel_drop_range=(1, 1), fill_value=0, p=1)
  7. ChannelDropout(channel_drop_range=(2, 2), fill_value=0, p=1)
  8. ChannelDropout(channel_drop_range=(2, 2), fill_value=0, p=1)
  9. ChannelDropout(channel_drop_range=(2, 2), fill_value=0, p=1)

ChannelDropout image

ChannelShuffle

  1. Original image
  2. ChannelShuffle(p=1)
  3. ChannelShuffle(p=1)
  4. ChannelShuffle(p=1)

ChannelShuffle image

ToGray

  1. Original image
  2. ToGray(p=1)

ToGray image

InvertImg

  1. Original image
  2. InvertImg(p=1)

InvertImg image

VerticalFlip

  1. Original image
  2. VerticalFlip(p=1)

VerticalFlip image

HorizontalFlip

  1. Original image
  2. HorizontalFlip(p=1)

HorizontalFlip image

Flip

  1. Original image
  2. Flip(p=1)
  3. Flip(p=1)
  4. Flip(p=1)

Flip image

RandomGridShuffle

  1. Original image
  2. RandomGridShuffle(grid=(3, 3), p=1)
  3. RandomGridShuffle(grid=(5, 5), p=1)
  4. RandomGridShuffle(grid=(7, 7), p=1)

RandomGridShuffle image

Blur

  1. Original image
  2. Blur(blur_limit=(7, 7), p=1)
  3. Blur(blur_limit=(15, 15), p=1)
  4. Blur(blur_limit=(50, 50), p=1)
  5. Blur(blur_limit=(100, 100), p=1)
  6. Blur(blur_limit=(300, 300), p=1)

Blur image

albumentations_examples's People

Contributors

benihime91 avatar bloodaxe avatar creafz avatar dipet avatar dskkato avatar juanma9613 avatar rgaiacs avatar sergiopaniego avatar ternaus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.