{ "cells": [ { "cell_type": "markdown", "source": [ "Augmentor has warpped some commonly used basic operations so that you can use to build the augmentation\n", "pipeline. The `internal` column is what you'd probably do outside of `Augmentor`." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "| Category | internal | Augmentor |\n", "| --- | --- | --- |\n", "| Conversion | `T.(img)` | `ConvertEltype(T)` |\n", "| Information Layout | `ImageCore.channelview` | `SplitChannels` |\n", "| Information Layout | `ImageCore.colorview` | `CombineChannels` |\n", "| Information Layout | `Base.permutedims` | `PermuteDims` |\n", "| Information Layout | `Base.reshape` | `Reshape` |" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "It is not uncommon that machine learning frameworks require the data in a specific form and layout.\n", "For example many deep learning frameworks expect the colorchannel of the images to be encoded in\n", "the third dimension of a 4-dimensional array. Augmentor allows to convert from (and to) these\n", "different layouts using special operations that are mainly useful in the beginning or end of a\n", "augmentation pipeline." ], "metadata": {} }, { "outputs": [ { "output_type": "execute_result", "data": { "text/plain": "true" }, "metadata": {}, "execution_count": 1 } ], "cell_type": "code", "source": [ "using Augmentor\n", "using ImageCore\n", "\n", "# 300×400 Matrix{RGB{N0f8}, 2} => 300×400×3 Array{Float32, 3}\n", "img = testpattern(RGB, ratio=0.5)\n", "img_in = augment(img, SplitChannels() |> PermuteDims(2, 3, 1) |> ConvertEltype(Float32))\n", "\n", "# 300×400×3 Array{Float32, 3} => 300×400 Matrix{RGB{N0f8}, 2}\n", "img_out = augment(img_in, ConvertEltype(N0f8) |> PermuteDims(3, 1, 2) |> CombineChannels(RGB))\n", "\n", "img_out == img" ], "metadata": {}, "execution_count": 1 }, { "cell_type": "markdown", "source": [ "## References" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "---\n", "\n", "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" ], "metadata": {} } ], "nbformat_minor": 3, "metadata": { "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.7.3" }, "kernelspec": { "name": "julia-1.7", "display_name": "Julia 1.7.3", "language": "julia" } }, "nbformat": 4 }