Closed IvanHCenalmor closed 2 months ago
unfortunately your proposed solution maybe_singleton = axis == "b" or axis == "c"
would be wrong for any channel axis with more than one channel...
It is possible to improve the library to detect trivial SizeReference
s and know that this particular channel axis may be a singleton axis, but as move to using model spec v0_5 which allows to specify a size reference per axis, an updated model should simply hardcode the number of output channels (if, as usually is the case, they are not dependent on the input size).
So I encourage you to update wild-whale instead to avoid this problem and load 2d data correctly with a singleton batch and singelton channel axis.
Aaaa okey, I thought that then it was assessed with the shape or something similar. Then, it's true that it doesn't make sense for cases with more than one axis. Okey then maybe the solution of updating the wild-whale
seems the most straightforward one.
Hi @FynnBe!
I am working in the notebook to load, fine-tune and export models from the BMZ.
I manage it to work for the
affable-shark
model :hugs: (which has the format version v0.5), but now I was trying withwild-whale
(which has the format version v0.4) and I am getting a different performance on the prediction function. I found what was causing this difference, but I don't know if my proposal is a good solution.To put you on context, the image I'm passing for prediction has the shape
(1024,1024),
without any batch or channel axis on the original.tif
file. The input axes foraffable-shark
are:While the axes on
wild-shale
are:The code that I'm using for the prediction is:
I now that this difference is due to the different format versions and everything works until loading, but when making the prediction I get the following error on
wild-whale
:After some debugging I realized that on
wild-whale
themaybe_singleton
attribute on thechannel
axis was set toFalse
, while onaffable-shark
is set toTrue
. I found on the code that the function assigning this value is create onAxisInfo
.More specifically, the line which is assigning that
False
value is this one. As it is astring
axis and channel is represented as 'c' and not 'b',maybe_singleton
is set toFalse
. But in this case, the channel axis is a singleton where there is only one channel. Would this new line work?I have tried like this on my local version of the core library and like that wild-whale is capable of predicting the (1024,1024) image without any issue.
Is this a good solution or would it change a lot the performance on other old models?