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
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() and LetterBox() 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 the LetterBox() and Resize() 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() and LetterBox() 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 a CenterCrop() 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 Shape node to get the original input shape, Slice to extract the height and width individually, Concat to generate a (height, width)-tuple and feed that into a new final Resize node. 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!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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
Shape
node to get the original input shape,Slice
to extract the height and width individually,Concat
to generate a(height, width)
-tuple and feed that into a new finalResize
node. 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
Beta Was this translation helpful? Give feedback.
All reactions