Skip to content
data

Image

Image(data: Tensor)

Wraps a pixel image tensor (C, H, W) or (B, C, H, W).

A lightweight typed marker so multi-target transforms can dispatch on isinstance and route a pixel image differently from a segmentation Mask, a BoundingBoxes target, or a Keypoints target. Single-image pipelines need not wrap — a bare lucid.Tensor is also treated as an image.

Parameters

dataTensor
Pixel image with shape (C, H, W) or (B, C, H, W). Photometric transforms operate on data in place of per-channel statistics; geometric transforms resample with the configured interpolation mode.

Examples

The wrapper that says a tensor is a picture, so a transform knows to
resample it rather than to treat it as labels:
>>> import lucid, lucid.utils.transforms as T
>>> holder = T.Image(lucid.rand(3, 32, 32))
>>> tuple(T.Resize(16, 16)(holder).data.shape)
(3, 16, 16)

Used by 3