Quickstart
Import the library:
using DataAugmentation
using TestImages: testimageLoad your data:
image = testimage("lighthouse")
Create an item that contains the data you want to augment:
item = Image(image)Image{2, ColorTypes.RGB{FixedPointNumbers.N0f8}}() with bounds Bounds(1:512×1:768)Create a transform:
tfm = CenterResizeCrop((128, 128))Sequence{Tuple{DataAugmentation.CroppedProjectiveTransform{ScaleKeepAspect{2}, Tuple{Crop{2, DataAugmentation.FromCenter}}}, PinOrigin}}((DataAugmentation.CroppedProjectiveTransform{ScaleKeepAspect{2}, Tuple{Crop{2, DataAugmentation.FromCenter}}}(ScaleKeepAspect{2}((128, 128)), (Crop{2, DataAugmentation.FromCenter}((128, 128), DataAugmentation.FromCenter(), (0, 0)),)), PinOrigin()))Call the transform on the item, then unwrap its data.
titem = tfm(item)
timage = itemdata(titem)
Pass a tuple such as tfm((item, mask)) to share the transform's random state across aligned items.
Next steps
- Items explains what can be wrapped in an item.
- Transformations shows how to compose transformations and randomize them, and lists the available ones.
- The Gallery shows what the spatial transformations do.
- Pipelines puts them together for images, segmentation masks, keypoints, bounding boxes, and volumes.
- Using with Flux feeds augmented batches to a model.