Shape or similar steps to propagate arbitrary input sizes and resize output correspondingly? #862
Unanswered
Julian W. (nohype)
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I hope this is the right place for my question and apologies in advance should this question simply be stupid.
TL;DR: Having a
Resize()andLetterBox()step in the preprocessing of an arbitrarily sized input image, how would I add the postprocessing to go from a fixed-size output of the original model back to the (arbitrary) input size (i.e. undo theLetterBox()andResize()steps)?I'm a newbie to all things ML and started using image segmentation models with onnxruntime successfully so far. Now I've been trying to use onnxruntime-extensions to include necessary pre/post processing in those models and I was successful in having the extended model take an input image of arbitrary size, use
Resize()andLetterBox()as you can see below for preprocessing.The model output is still a fixed size though. My question is how I would set up the postprocessing to take the fixed size output (shape [144, 256]), undo the
LetterBox()step (somehow propagate the padding and use aCenterCrop()step?) and then resize to the original input's size (propagate the arbitrary original input size)?It seems to resize to the original size, I should be able to use a
Shapenode to get the original input shape,Sliceto extract the height and width individually,Concatto generate a(height, width)-tuple and feed that into a new finalResizenode. I wouldn't know how to add those nodes to the model here though.As for reversing the
LetterBox()step, I don't really have an idea.Thanks a lot for any help, hints, advice, pointers to resources or code to look at!
Kind regards
All reactions