ITransform

Image transform that maps a tensor to a tensor.

Instance members

NameDescription
this.apply arg1

Compose

Compose multiple transforms into a single pipeline.

FunctionDescription
apply transforms xApply transforms sequentially.

apply

apply transforms x

Apply transforms sequentially.

Parameters

  • transforms : ITransform list
  • x : Tensor

Returns Tensor


Normalize

Channel-wise normalization: (xμ)/σ(x - \mu) / \sigma. Input: [C,H,W][C, H, W] or [B,C,H,W][B, C, H, W].

Record fields

NameDescription
Mean
Std

Instance members

NameDescription
this.apply x

Normalize module

FunctionDescription
imageNetImageNet normalization preset.

imageNet

imageNet

ImageNet normalization preset.

Returns Normalize


Resize

Resize to the target spatial size using bilinear interpolation. Input: [C,H,W][C, H, W] or [B,C,H,W][B, C, H, W].

Record fields

NameDescription
Height
Width

Instance members

NameDescription
this.apply x

Resize module

FunctionDescription
create height width

create

create height width

Parameters

  • height : int
  • width : int

Returns Resize


RandomHorizontalFlip

Randomly flip the image horizontally with probability p. Input: [C,H,W][C, H, W] or [B,C,H,W][B, C, H, W].

Record fields

NameDescription
P

Instance members

NameDescription
this.apply x

RandomHorizontalFlip module

FunctionDescription
create p
defaultFlip

create

create p

Parameters

  • p : float

Returns RandomHorizontalFlip


defaultFlip

defaultFlip

Returns RandomHorizontalFlip


RandomVerticalFlip

Randomly flip the image vertically with probability p. Input: [C,H,W][C, H, W] or [B,C,H,W][B, C, H, W].

Record fields

NameDescription
P

Instance members

NameDescription
this.apply x

RandomVerticalFlip module

FunctionDescription
create p
defaultFlip

create

create p

Parameters

  • p : float

Returns RandomVerticalFlip


defaultFlip

defaultFlip

Returns RandomVerticalFlip


RandomCrop

Randomly crop the image to the given size. Input: [C,H,W][C, H, W] or [B,C,H,W][B, C, H, W].

Record fields

NameDescription
Height
Width

Instance members

NameDescription
this.apply x

RandomCrop module

FunctionDescription
create height width

create

create height width

Parameters

  • height : int
  • width : int

Returns RandomCrop


CenterCrop

Crop the center region of the image. Input: [C,H,W][C, H, W] or [B,C,H,W][B, C, H, W].

Record fields

NameDescription
Height
Width

Instance members

NameDescription
this.apply x

CenterCrop module

FunctionDescription
create height width

create

create height width

Parameters

  • height : int
  • width : int

Returns CenterCrop


ToGrayscale

Convert an RGB image to grayscale using ITU-R BT.601 weights. Input: [3,H,W][3, H, W] or [B,3,H,W][B, 3, H, W].

Record fields

NameDescription
NumOutputChannels

Instance members

NameDescription
this.apply x

ToGrayscale module

FunctionDescription
create numOutputChannels
single
triple

create

create numOutputChannels

Parameters

  • numOutputChannels : int

Returns ToGrayscale


single

single

Returns ToGrayscale


triple

triple

Returns ToGrayscale


ConvertImageDType

Convert image tensor dtype, scaling between [0, 255] int and [0.0, 1.0] float ranges. Input: any image tensor.

Record fields

NameDescription
TargetDType

Instance members

NameDescription
this.apply x

ConvertImageDType module

FunctionDescription
create dtype

create

create dtype

Parameters

  • dtype : ScalarType

Returns ConvertImageDType