Skip to main content

Torchvision Complementary tool to perform batch and GPU data augmentations.

Reason this release was yanked:

Wrapper handle transforms wrongly.

Project description

Efficient vision data augmentations for CPU/GPU per-sample/batched data.

Under active development, subject to API change

PyPI python PyPI version documentation codecov License

Torchaug

Introduction

Torchaug is a data augmentation library for the Pytorch ecosystem. It is meant to deal efficiently with tensors that are either on CPU or GPU and either per-samples or on batches.

It seeks to improve Torchvision performance that has been implemented over Pytorch and Pillow to, among other things, perform data augmentations. However, because it has been implemented first with per-sample CPU data augmentations in mind, it has several drawbacks to make it efficient:

  • For data augmentations on GPU, some CPU/GPU synchronizations cannot be avoided.
  • For data augmentations applied on batch, the randomness is sampled for the whole batch and not each sample.

Torchaug removes these issues and is meant to be used complimentary with Torchvision. It follows the same nomenclature as Torchvision with functional augmentations and transforms class wrappers. It is split into two packages:

  • transforms for per-sample data augmentations
  • batch_transfroms for batched data augmentations.

More details can be found in the documentation.

To be sure to retrieve the same data augmentations as Torchvision, it has been tested on each of its components to match Torchvision outputs.

How to use

  1. Install a Pytorch >= 2.0 environment.

  2. Install Torchaug.

pip install torchaug
  1. Import data augmentations either from torchaug.transforms or torchaug.batch_transforms packages. To ease with handling multiple sequential augmentations, wrappers have been defined.
from torchaug.transforms import (
    ImageWrapper,
    RandomColorJitter,
    RandomGaussianBlur
)
from torchaug.batch_transforms import (
    BatchImageWrapper,
    BatchRandomColorJitter,
    BatchRandomHorizontalFlip
)

transform = ImageWrapper(
    [RandomColorJitter(...), RandomGaussianBlur(...)],
)

batch_transform = BatchImageWrapper(
    [BatchRandomColorJitter(...), BatchRandomHorizontalFlip(...)],
    inplace=True
)

How to contribute

Feel free to contribute to this library by making issues and/or pull requests. For each feature you implement, add tests to make sure it works. Also, make sure to update the documentation.

LICENSE

This project is under the Apache license 2.0.

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

torchaug-0.3.0.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

torchaug-0.3.0-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file torchaug-0.3.0.tar.gz.

File metadata

  • Download URL: torchaug-0.3.0.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for torchaug-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a046badb910c13937ab026bb404933777d94983b7ccadc501a0696b1812a61f8
MD5 51fe9e25bb8dea1188642d68edac154c
BLAKE2b-256 470709c1450475f323418c5b313d8da87de9973123358fa329b4b7d0ff25036a

See more details on using hashes here.

File details

Details for the file torchaug-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: torchaug-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for torchaug-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c226c9ea4db67a326e8e368cda49d3cea956c0de3decf08385aa60e38160c1a
MD5 041228bfd290468751181d4780ea60e2
BLAKE2b-256 41c62f25c9aeda5e8002c0efe3e466d5dfaa3d6fc50f13a128525d80c54abf2e

See more details on using hashes here.

Supported by

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