-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return image tensors in WH format #34
Conversation
Didn't check the code changes. I'm a little confused and I think you're suggesting the opposite. The whole JuliaImages are using column-major order, i.e., HW format
Removing it is fine, but there should be deprecations since this name is exported. |
So Knet and Flux use WHCN, while Images uses HW. MLDatasets does WHCN although its docstrings say HWCN. What should I do here, just fix the docstring? |
I think the docstring is correct, because unlike other languages, in julia julia> x = reshape(1:16, 2, 8)./16
2×8 Array{Float64,2}:
0.0625 0.1875 0.3125 0.4375 0.5625 0.6875 0.8125 0.9375
0.125 0.25 0.375 0.5 0.625 0.75 0.875 1.0
julia> first(eachrow(x)) == x[1, :]
true |
wait, looking again at the docstring |
Yeah, perhaps some emphasis on the layout difference would be sufficient. P.S. I tried to not use WH/HW because I find myself always confused 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no review to add, I don't do images.
I trust people who do to review this better than I
could
Most downstream packages such as Flux, Knet, and the Images ecosystem, assume the image tensors to be in WH format for greyscale and in WHC format for rgb.
Our SVHN2 dataset is consistent with julia ecosystem, while MNIST, FashionMNIST, CIFAR10 and CIFAR100 return images HW format. This is annoying at the very least, but most importantly it is the potential source of very hard to detect bugs.
Therefore this PR does the following:
convert2features
since it's just a reshape into a vector (or a matrix for a batch of images)