Project DelphiTensors Workshop

The four axis conventions

Read every convention as a sentence:

  • HWC — height × width × colour
  • CHW — colour × height × width
  • NHWC — examples × height × width × colour
  • NCHW — examples × colour × height × width

scikit-image and most image files give you HWC. PyTorch wants NCHW. TensorFlow wants NHWC. None of them is right or wrong; they simply disagree, and you have to know which one you are holding.