Skip to main content

Torchvision Complementary tool to perform batch and GPU data augmentations.

Reason this release was yanked:

Chunking transforms is not well handled.

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 sample or on batches.

It enriches Torchvision (v2) that has been implemented over Pytorch and Pillow to, among other things, perform data augmentations. 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 its transforms are meant to be used in place of Torchvision. It is based on the code base of Torchvision and therefore follows the same nomenclature as Torchvision with functional augmentations and transforms class wrappers. However, Torchaug does not support transforms on Pillow images.

More details can be found in the documentation.

To be sure to retrieve the same data augmentations as Torchvision, the components are tested to match Torchvision outputs. We made a speed comparison here.

If you find any unexpected behavior or want to suggest a change please open an issue.

How to use

  1. Install Torchaug.
pip install torchaug
  1. Import data augmentations from the torchaug.transforms package just as for Torchvision.
from torchaug.transforms import (
    RandomColorJitter,
    RandomGaussianBlur,
    SequentialTransform
)


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

For a complete list of transforms please see the documentation.

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, please update the documentation.

Credits

We would like to thank the authors of Torchvision for generously opening their source code. Portions of Torchaug were originally taken from Torchvision, which is released under the BSD 3-Clause License. Please see their repository and their BSD 3-Clause License for more details.

LICENSE

Torchaug is licensed under the CeCILL-C license.

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.4.1.tar.gz (80.7 kB view details)

Uploaded Source

Built Distribution

torchaug-0.4.1-py3-none-any.whl (105.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torchaug-0.4.1.tar.gz
Algorithm Hash digest
SHA256 d2088b5b80d64da00763bd01d3e43ef91ea453d3af458dcca94971d910993eec
MD5 49682359c36f214234843e72d924c9a1
BLAKE2b-256 7378177eab81b82d1ae9fc5bd02499181b24dc391c18036de8461c6b25bd0bd0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for torchaug-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e0352eade3dc9996881744838901ae2fbf0d381d20d0c1cb7db580c46044d68
MD5 b1b0bccbea6c41b9d2d9cce519294ba5
BLAKE2b-256 f67cab1126574f4ce09375e38d105a19649b551da12468196188ae5174785f17

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