Giter VIP home page Giter VIP logo

augmax's Introduction

Augmax

PyPI version Documentation Status

Augmax is an image data augmentation framework supporting efficiently-composable transformations with support for JAX function transformations. Its strengths are efficient execution of complex augmentation pipelines and batched data augmentation on the GPU/TPU via the use of jax.jit and jax.vmap.

In existing data augmentation frameworks, each transformation is executed separately, leading to many unnecessary memory reads and writes that could be avoided. In contrast, Augmax tries its best to fuse transformations together, so that these data-intensive operations are be minimized.

Getting Started

Augmax aims to implement an API similar to that of Albumentations. An augmentation pipeline is defined as a sequence of transformations, which are then randomly applied to the input images.

import jax
import augmax

transform = augmax.Chain(
  augmax.RandomCrop(256, 256),
  augmax.HorizontalFlip(),
  augmax.Rotate(),
)

image = ...

rng = jax.random.PRNGKey(27)

transformed_image = transform(rng, image)

Batch-wise Augmentation on the GPU

Leveraging the JAX infrastructure, it is possible to greatly accelerate data augmentation by using Just-in-Time compilation (jax.jit), which can execute the code on the GPU, as well as batched augmentation (jax.vmap).

Augmenting a single image on the GPU

transformed_image = jax.jit(transform)(rng, image)

Augmenting an entire batch of images on the GPU

sub_rngs = jax.random.split(rng, images.shape[0])
transformed_images = jax.jit(jax.vmap(transform))(sub_rngs, images)

augmax's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

leonhardfeiner

augmax's Issues

Semantics of `RandomCrop`

I have a few questions that AFAIU are not covered in the documentation,

  • What happens if the requested width/height are larger than the input image?
  • If the requested width/height is less than the input image, will the returned image lie outside the strict borders of the input? If so, what sort of padding is done?
  • If the requested width/height are exactly equal to the input image, does it reduce to the identity function?

I also consulted the albumentations API docs, but they didn't have much more information. So just putting these questions out into the ether...

Git tags for releases?

Would it be possible to get git tags for releases? I can see that the latest version is 0.2.2 according to pypi, but in order to build from source I'm not sure which commit that corresponds to. Having releases tagged helps when packaging augmax for other package managers, eg. nixpkgs.

Example Syntax Error

Small issue, front page of GitHub, on
Augmenting an entire batch of images on the GPU page,

sub_rngs = jax.random.split(rng, images.shape[0])
transformed_images = jax.jit(jax.vmap(transform))(sub_rng, images)

The last sub_rng should be changed to sub_rngs .
Thanks!

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.