hanspinckaers / nonlinear-color-aug

We often use linear color transformation (like most implementations of contrast, brightness jitter). These transformations are potentially quickly learned by a neural network, especially networks with normalization layers. This repository implements non-linear color augmentations (like gamma-correction and the S-curves in Photoshop).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-linear color augmentations

We often use linear color transformation (like most implementations of contrast, brightness jitter). These transformations are potentially quickly learned by a neural network, especially networks with normalization layers. This repository implements non-linear color augmentations (like gamma-correction and the S-curves in Photoshop).

I cannot claim any benefits as I didn't perform any testing experiments yet.

RGB mapping curves

Randomly generated example curves showing how the RGB channels would get mapped to different values.

This repository is a PyTorch implementation of https://github.com/deepmind/multidim-image-augmentation

Example (see notebook)

Original

Example image

Image taken from the GlaS dataset.

Color augmentations:

Example augmented image

Usage

from coloraug import NonLinearColorJitter
transform = NonLinearColorJitter()
augmented_image = transform(image)

Or inside a torchvision.transform:

transforms.Compose([
        transforms.CenterCrop(10),
        NonLinearColorJitter(),
        transforms.ToTensor(),
    ])

About

We often use linear color transformation (like most implementations of contrast, brightness jitter). These transformations are potentially quickly learned by a neural network, especially networks with normalization layers. This repository implements non-linear color augmentations (like gamma-correction and the S-curves in Photoshop).

License:MIT License


Languages

Language:Jupyter Notebook 99.8%Language:Python 0.2%