JuliaImages / JuliaImages/juliaimages.github.io

explain the column-major orientation convention

Open
#143 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

best practice
Dominant language
Julia
Stars
33
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Not sure if this is documented somewhere, but the column-major orientation seems to cause some confusion and is abused somehow.

One such example is that Flux follows the same convention from Pytorch and Tensorflow, calling it WHCN order, while almost the whole community uses permutedims(channelview(X), (2, 3, 1)) to convert the data. Yes, this is more friendly to memory layout than permutedims(..., (3, 2, 1)), but it is actually HWCN order. Even the Flux community isn't fully aware of this, e.g., https://github.com/JuliaML/MLDatasets.jl/pull/34

We may also need to compare other image-processing libraries; by default, MATLAB to follow the same column-major order while numpy, on the other hand, takes row-major order.

Thanks @pauljurczak for raising this issue in #142

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with this issue, the referenced discussion in #142, and the MLDatasets.jl pull request #34. Compare the stated column-major and row-major conventions across Julia/Flux, PyTorch, TensorFlow, MATLAB, and NumPy, then document the orientation and permutation terminology clearly enough to resolve the WHCN versus HWCN confusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, matlab, numpy, pytorch, tensorflow
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.