trw.transforms.transforms_normalize
¶
Module Contents¶
Classes¶
Normalize a tensor image with mean and standard deviation. |
Functions¶
|
- trw.transforms.transforms_normalize._transform_normalize(feature_name, feature_value, mean, std)¶
- class trw.transforms.transforms_normalize.TransformNormalize(mean, std, criteria_fn=None)¶
Bases:
trw.transforms.transforms.TransformBatchWithCriteria
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
criteria_fn – function applied on each feature. If satisfied, the feature will be transformed, if not the original feature is returned
- Returns
A normalized batch such that the mean is 0 and std is 1 for the selected features