trw.transforms.normalize

Module Contents

Functions

normalize_numpy(array, mean, std)

Normalize a tensor image with mean and standard deviation.

normalize_torch(array, mean, std)

Normalize a tensor image with mean and standard deviation.

normalize(array, mean, std)

Normalize a tensor image with mean and standard deviation.

trw.transforms.normalize.normalize_numpy(array, mean, std)

Normalize a tensor image with mean and standard deviation.

Given mean: (M1,…,Mn) and std: (S1,..,Sn) for n channels, this transform will normalize each channel of the input torch.Tensor, input[channel] = (input[channel] - mean[channel]) / std[channel]

Parameters
  • array – the numpy array to normalize. Expected layout is (sample, filter, d0, … dN)

  • mean – a N-dimensional sequence

  • std – a N-dimensional sequence

Returns

A normalized tensor such that the mean is 0 and std is 1

trw.transforms.normalize.normalize_torch(array, mean, std)

Normalize a tensor image with mean and standard deviation.

Given mean: (M1,…,Mn) and std: (S1,..,Sn) for n channels, this transform will normalize each channel of the input torch.Tensor, input[channel] = (input[channel] - mean[channel]) / std[channel]

Parameters
  • array – the torch array to normalize. Expected layout is (sample, filter, d0, … dN)

  • mean – a N-dimensional sequence

  • std – a N-dimensional sequence

Returns

A normalized tensor such that the mean is 0 and std is 1

trw.transforms.normalize.normalize(array, mean, std)

Normalize a tensor image with mean and standard deviation.

Given mean: (M1,…,Mn) and std: (S1,..,Sn) for n channels, this transform will normalize each channel of the input torch.Tensor, input[channel] = (input[channel] - mean[channel]) / std[channel]

Parameters
  • array – the torch array to normalize. Expected layout is (sample, filter, d0, … dN)

  • mean – a N-dimensional sequence

  • std – a N-dimensional sequence

Returns

A normalized tensor such that the mean is 0 and std is 1