HWC_to_CHW#

module : eotorchloader.transform.tensor

class HWC_to_CHW(img_only: bool = False, mask_only: bool = False)#

Convert (image, mask) sample from channel last to channel first 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 HWC.

Parameters
  • img_only (str) – Apply transform only to image

  • mask_only (List(Int)) – Apply transform only to mask

see CHW_to_HWC