ImageAugmentationLayer
ImageAugmentationLayer[{h,w}]
represents a net layer that applies random image transformations to produce images of height h and width w.
Details and Options
- ImageAugmentationLayer operates on images represented as c0×h0×w0 arrays.
- ImageAugmentationLayer does random cropping and other transformations.
- ImageAugmentationLayer[…][input] explicitly computes the output from applying the layer.
- ImageAugmentationLayer[…][{input1,input2,…}] explicitly computes outputs for each of the inputi.
- When given a NumericArray as input, the output will be a NumericArray.
- ImageAugmentationLayer is typically used inside NetChain, NetGraph, etc.
- The following optional parameters can be included:
-
"ReflectionProbabilities" {0,0} probabilities for vertical and horizontal reflection - ImageAugmentationLayer exposes the following ports for use in NetGraph etc.:
-
"Input" a c0×h0×w0 array "Output" a c0×h×w array - When it cannot be inferred from other layers in a larger net, the option "Input"->{c,h0,w0} can be used to fix the input dimensions of ImageAugmentationLayer.
- ImageAugmentationLayer only randomly transforms the input during training. During evaluation, ImageAugmentationLayer resizes the input by taking the center crop, unless NetEvaluationMode->"Train" is specified when applying the layer.
- Options[ImageAugmentationLayer] gives the list of default options to construct the layer. Options[ImageAugmentationLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[ImageAugmentationLayer[…]] gives a report about the layer.
- Information[ImageAugmentationLayer[…],prop] gives the value of the property prop of ImageAugmentationLayer[…]. Possible properties are the same as for NetGraph.
Examples
open allclose allBasic Examples (2)
Create an ImageAugmentationLayer whose output dimensions are {n,80,80}:
Create an ImageAugmentationLayer that takes an image of size 128×128 and returns an image crop of size 80×80:
Apply the layer to an image, obtaining the center crop:
Apply the layer to an image, specifying that training behavior be used:
Options (1)
"ReflectionProbabilities" (1)
Create an ImageAugmentationLayer that randomly reflects an image about the vertical axis with probability 0.9 during training:
Possible Issues (1)
Currently, any randomness invoked by NetEvaluationMode->"Train" is not affected by SeedRandom and BlockRandom:
Compare with BlockRandom generating random reals:
Text
Wolfram Research (2017), ImageAugmentationLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageAugmentationLayer.html.
CMS
Wolfram Language. 2017. "ImageAugmentationLayer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageAugmentationLayer.html.
APA
Wolfram Language. (2017). ImageAugmentationLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageAugmentationLayer.html