peal.data.transformations.Normalization¶
- class peal.data.transformations.Normalization[source]¶
Bases:
objectPer-channel
(x - mean) / stdnormalization with an exact inverse.meanandstdare stored as[C, 1, 1]tensors so the transform broadcasts over[C, H, W]images and[B, C, H, W]batches alike and moves to the input’s device on every call.- Parameters:
Methods
Undo the normalization.
- __call__(sample)[source]¶
Normalize
sample.- Parameters:
sample (
torch.Tensor) – Image[C, H, W]or batch[B, C, H, W].- Returns:
(sample - mean) / stdwith the same shape.- Return type:
- invert(batch)[source]¶
Undo the normalization.
- Parameters:
batch (
torch.Tensor) – Normalized image or batch.- Returns:
batch * std + meanwith the same shape.- Return type: