Items
Items are containers for data. An Image holds an image, and Keypoints holds point coordinates. Call a transform with tfm(item) and use itemdata to unwrap the result.
Why wrap data in an item?
For one, the item structs may contain metadata that is useful for some transformations. More importantly, though, by wrapping data in an item type, the meaning of the data is separated from the representation, that is, the concrete type.
An Array{Integer, 2} could represent an image, but also a multi-class segmentation mask. Is Array{Float32, 3} a 3-dimensional image or a 2-dimensional image with the color channels expanded?
Separating the representation from the data's meaning resolves those ambiguities.
Spatial items
Spatial items represent images, segmentation masks, keypoints, and bounding boxes.
Image{N, T}represents anN-dimensional image.Trefers to the element type of the array thatImagewraps, usually a color. When projecting images, proper interpolation methods are used to reduce artifacts like aliasing.MaskBinary{N}andMaskMulti{N, T}likewise representN-dimensional segmentation masks. Unlike images, nearest-neighbor interpolation is used for projecting masks.Keypoints{N}represents landmarks as an array ofSVector{N}.BoundingBoxandPolygonwrap keypoints to represent a single box or polygon. These items use array dimension order, so points are(y, x)in 2D.BoundingBoxesholds a collection of 2D boxes and optional labels. Each column of its coordinate matrix holds one box in(x, y)order. Usebox_convertto switch between corner, corner-and-size, and center-and-size coordinates.
Spatial items have spatial bounds, which projective transformations use. The Gallery shows how to apply transformations to images and keypoints together.
Other items
ArrayItemwraps any array. It is what the preprocessing transformations produce, for exampleImageToTensorturns anImageinto anArrayItem.ImageBatchwraps collated images and their classification labels for batch mixing.TabularItemrepresents one row of a table, to be used with the row transformations described under Preprocessing.
Visualizing items
showitems visualizes spatial items, and showgrid arranges the visualizations of many items in a grid. The Gallery uses both throughout.
Use showitems((image, mask)) to check alignment after a transformation. Set maskalpha to adjust the default opacity of 0.5 and maskbackground to skip a label such as 1 for a multiclass mask or false for a binary mask. showgrid accepts the same options for grids of image and mask pairs.
To define your own item, see Defining items.