Skip to content

Evizero/Augmentor.jl

Repository files navigation

Augmentor

License Docs-stable Docs-dev pkgeval unittest codecov

Augmentor.jl is a fast Julia library designed to make the process of image augmentation more convenient, less error-prone, and easier to reproduce. It offers a simple way to build flexible augmentation pipelines. For our purposes, an augmentation pipeline can be understood as a sequence of operations for which the parameters can (but need not) be random variables.

When augmenting, Augmentor.jl uses multiple heuristics to generate efficient tailor-made code for the concrete user-specified augmentation pipeline. In particular, Augmentor tries to avoid the need for any intermediate images and aims to compute the output image directly from the input in one single pass.

Overview

Augmentor.jl provides many augmentation operations such as rotations, flipping, blurring, and more. See the documentation for the complete list of available operations.

The package uses the |> operator to compose operations into a pipeline.

Prepared pipelines are applied to images by calling one of the higher-level functions: augment, augment!, or augmentbatch!.

The full documentation is available at evizero.github.io/Augmentor.jl/.

Example

julia> pl = ElasticDistortion(6, scale=0.3, border=true) |>
            Rotate([10, -5, -3, 0, 3, 5, 10]) |>
            ShearX(-10:10) * ShearY(-10:10) |>
            CropSize(28, 28) |>
            Zoom(0.9:0.1:1.2)
5-step Augmentor.ImmutablePipeline:
 1.) Distort using a smoothed and normalized 6×6 grid
 2.) Rotate by θ  [10, -5, -3, 0, 3, 5, 10] degree
 3.) Either: (50%) ShearX by ϕ  -10:10 degree. (50%) ShearY by ψ  -10:10 degree.
 4.) Crop a 28×28 window around the center
 5.) Zoom by I  {0.9×0.9, 1.0×1.0, 1.1×1.1, 1.2×1.2}

julia> augment(img, pl)

For more examples, see the documentation.

Contributing

Contributions are greatly appreciated!

To report a potential bug or propose a new feature, please file a new issue. Pull requests are always welcome. However, to make sure the PR gets accepted, it is generally preferred when it follows a particular issue to which it refers.

Citing Augmentor

If you use Augmentor for academic research and wish to cite it, please use the following paper.

Marcus D. Bloice, Christof Stocker, and Andreas Holzinger, Augmentor: An Image Augmentation Library for Machine Learning, arXiv preprint arXiv:1708.04680, https://arxiv.org/abs/1708.04680, 2017.

Acknowledgments

A Python version of the package is also being developed as a sister project and is available at mdbloice/Augmentor

To provide most of the operations, Augmentor.jl makes heavy use of many packages. To name a few: