CHW_to_HWC#
module : eotorchloader.transform.tensor
- class CHW_to_HWC(img_only: bool = False, mask_only: bool = False)#
Convert (image, mask) sample from channel first to channel last order
depending on the input format or the output sample format is it often needed to convert array or tensor data from channel last order (HWC) to channel first order. For exemple PIL or matplotlib use channel last order for RVB images and pytorch training and rasterio use mainly channel first order.
Note
Input (image, mask) should already be in CHW.
- Parameters
img_only (str) – Apply transform only to image
mask_only (List(Int)) – Apply transform only to mask
see HWC_to_CHW