When making the inference files for DA3 yesterday, I couldn’t figure out how to instruct the node to do the resizing internally.
The model expects 1022x1022 inputs. But the .json file doesn’t seem to have any parameter to pass this instruction on. And the Resize section of the node ui is disabled. In the documentation says, that this is only enabled if the model requires a fixed size. But how does Flame know that, if you don’t tell it?
I did search the forums and the help for a hint of an undocumented json parameter about tile size, or overwriting the hint if the model requires a fixed size. I tried variations of padding and keep aspect ratio, but that didn’t fix it.
Anyone know? Or maybe @frenetj can share if this exists?
The inference works if the input is already resized to 1022x1022, but throws and error otherwise which is hinting at a shape mismatch.
Hey Jan. Flame uses the height and width parameters of the specified input’s shape (batch_size,num_channels,height,width) to determine if a resize is needed. If your model’s input shape looks like (1,3,1022,1022), Flame will make sure to resize the input to 1022x1022. If it looks like (1,3,-1,-1), it won’t do any resizing (but it will pad the input as needed according to the specified padding).
If you have a link to the ONNX model, we can take a look at it and get back to you.
From what I saw in the notes, the shape has to be a multiple of 14. I tried setting the padding in the .json file to 14 to see if that would address it (as in dynamic size), but didn’t solve it.
Hi Jan, with the changes I made to export_onnx.py (see attached file), you should be able to export a static-size model. Just add --static to your command.
Reconverted the model with the new export code. It does in fact work now without external resize node. Interestingly enough though it seems to have had a negative effect on the results (even though the resize parameters are the same between the Inference node and the external resize node).
So this requires further investigation…. Could be the peculiarities of cropping and resolution. Will need to construct a comparison that rules that out. But even if so, good to know what plays a role here.
out of the box static model (small, so less quality than large model is expected)
Make sure to set the “keepAspectRatio” token to false in the json file to have the inference node resize in “Fit to fill” mode and get the maximum resolution out of the model.