You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with most of the julia machine learning ecosystem working with image tensors in WHC or WHCN format, maybe it could be convenient to add a string argument to colorview to specify the input tensor format:
x =rand(32, 32, 3, 1000) # batch of images in WHCN format
imgs =colorview(RGB, permutedims(x, (3, 2, 1, 4))) # current
imgs =colorview(RGB, x, "WHCN") # proposed
The text was updated successfully, but these errors were encountered:
The roles of colorview and channelview are to lazily convert between numerical array and array of structs/Colorants. It has no prior information about x if it's a plain array, so adding this feature in ImageCore isn't a good idea to me.
Said that, if x is AxisArray, which are cases we do have prior information about the dims of x, it's okay to support this functionality in ImageAxes, but my guess is that might not make things easier unless the whole processing pipeline is built upon AxisArrays. I mean, if you don't label the dims of x clearly, there's no way to guarantee that it works as expected.
I think we could add signaling types to do this. We need the return type of colorview to be inferrable, though. We could see if constant-propagation works for colorview(RGB, x, :WHCN) but more likely we'd want to define a dummy wrapper type so this is colorview(RGB, WHCN(x)).
It would only be a few lines of code to define WHC and WHCN types. Any others come to mind?
Keep in mind that colorview will never guarantee stridedness etc, because as @johnnychen94 says it's specifically to return a view.
with most of the julia machine learning ecosystem working with image tensors in WHC or WHCN format, maybe it could be convenient to add a string argument to
colorview
to specify the input tensor format:The text was updated successfully, but these errors were encountered: