peal.data.transformations.SetChannels¶
- class peal.data.transformations.SetChannels[source]¶
Bases:
objectConvert a tensor image to a fixed number of channels.
Multi-channel inputs are averaged to one channel when
channels == 1; single-channel inputs are tiled whenchannels > 1; anything else is returned unchanged (no other conversions are attempted).- Parameters:
channels (
int) – Desired number of channels.
Methods
- __call__(sample)[source]¶
Adjust the channel count of
sample.- Parameters:
sample (
torch.Tensor) – Image of shape[C, H, W].- Returns:
Image of shape
[channels, H, W]when a conversion applied, otherwisesampleitself.- Return type: