Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

imax

tests PyPI version Open In Colab

Image augmentation library for Jax.

sample_images

Installation

pip install imax

Usage

from jax import random
import jax.numpy as jnp
from PIL import Image
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid

from imax import transforms, color_transforms, randaugment

# Setup
random_key = random.PRNGKey(32)
random_key, split_key = random.split(random_key)
image = jnp.asarray(Image.open('./test.jpeg').convert('RGBA')).astype('uint8')

# Geometric transforms:
transform = transforms.rotate(rad=0.7)  # create transformation matrix
transformed_image = transforms.apply_transform(image,    # apply transformation
                                               transform,
                                               mask_value=jnp.array([0, 0, 0, 255]))

# multiple transformations can be combined through matrix multiplication
# this makes multiple sequential transforms much faster
multi_transform = transform @ transform @ transform
multi_transformed_image = transforms.apply_transform(image,
                                                     multi_transform,
                                                     mask_value=-1)

# Color transforms:
adjusted_image = color_transforms.posterize(image, bits=2)

# Randaugment:
randomized_image = randaugment.distort_image_with_randaugment(
    image,
    num_layers=3,   # number of random augmentations in sequence
    magnitude=10,   # magnitude of random augmentations
    random_key=split_key
)

# Show results:
results = [transformed_image, multi_transformed_image, adjusted_image, randomized_image]
fig = plt.figure(figsize=(10., 10.))
grid = ImageGrid(fig, 111,
                 nrows_ncols=(2, 2),
                 axes_pad=0.1)

for ax, im in zip(grid, results):
    ax.axis('off')
    ax.imshow(im)
plt.show()

Release files for imax 0.0.1b11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imax 0.0.1b11
File Size Uploaded
imax-0.0.1b11.tar.gz 20.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for imax 0.0.1b11
File Interpreter ABI Platform
imax-0.0.1b11-py3-none-any.whl Python 3 none any Details

Total release size:40.9 kB

Release files / imax-0.0.1b11.tar.gz

Download URL imax-0.0.1b11.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3f31d9b00825dbde36fab254bf78e525c8c4bc0ab022d1d8769202216bdbfc67
BLAKE2b-256 checksum
How to use checksums
a14e64945ab4f06ab870a3dbb94a3259428eafd1d502c767dc5b6d5598a54169
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / imax-0.0.1b11-py3-none-any.whl

Download URL imax-0.0.1b11-py3-none-any.whl
Size 20.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e791215523e269d985770d0500e35c3bd5fd4cad06b3474b29988df4485b62ac
BLAKE2b-256 checksum
How to use checksums
dc7bd6608631d87a9e9aad54c9eb9dcb8c66a9f540213a5cc38934736720b1bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page