Skip to main content

Efficiently Composable Data Augmentation on the GPU with Jax

Project description

Augmax

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(image, rng)

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)(image, rng)

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))(images, sub_rngs)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

augmax-0.1.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

augmax-0.1.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file augmax-0.1.0.tar.gz.

File metadata

  • Download URL: augmax-0.1.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for augmax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 52d55396bec07f2d9b9d4d041fa4b31079b0bda96d9bd0900d49bfd4504475b3
MD5 693de113b6c89b4d2f9eb6d2f05e90cb
BLAKE2b-256 11340e262041ab61eba87454a0d2a9edb134f2507dd7ba9f67c5b269105f9166

See more details on using hashes here.

File details

Details for the file augmax-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: augmax-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for augmax-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22286203bf17802f169eda211e28d9ba404223ed786b9c12e1b3cbcba0ffaed5
MD5 71b68834a0a409a6abb85a10cdc4941b
BLAKE2b-256 5f3a2266335a08bceefc3c94e4d51babb21f171e17aec5940679702443082406

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page