how to use onnx models correctly? #455
-
I tried
it resulted in 400x400 => 728 x 728. the image is a bit zoomed in. I guess I need some padding, but how much or is it something else? It seems to work with a padding of 18, but why |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, padding is required. Line 143 in bedce31 For the cunet 2x model, The ONNX model is used in unlimited:waifu2x, so it will probably be helpful as a reference. |
Beta Was this translation helpful? Give feedback.
Yes, padding is required.
nunif/waifu2x/models/cunet.py
Line 143 in bedce31
For the cunet 2x model,
offset=36
. This means 36 pixels are cropped from each edge of the 2x output. To keep the same image area as the original input, all sides of the input should be padded by 18 pixels (18=36px/2x).The ONNX model is used in unlimited:waifu2x, so it will probably be helpful as a reference.
https://github.com/nagadomi/nunif/tree/master/waifu2x/unlimited_waifu2x