Blinue / Magpie

An all-purpose window upscaler for Windows 10/11.
GNU General Public License v3.0
8.91k stars 474 forks source link

Adding static model support for ONNX build #965

Open beike623 opened 1 month ago

beike623 commented 1 month ago

Discussed in https://github.com/Blinue/Magpie/discussions/844

Originally posted by **Blinue** March 10, 2024 This discussion was created from the release onnx-preview1.

I am using the onnx build for real-time antialiasing. Some models I have created only allow for static onnx builds instead of the dynamic required for magpie. These models have a better image quality with acceptable speed. Would it be possible to add support for static models in the future?

Blinue commented 1 month ago

I don’t understand why the linking method would affect the functionality of onnxruntime. Is there any documentation on this?

beike623 commented 1 month ago

To clarify, certain upscale architectures include dysample or other features that can't be converted to onnx without specifying a static shape. This is referenced in the wiki for converting pth to onnx with neosr: https://github.com/muslll/neosr/wiki/Model-Conversion. These models I mentioned can be converted to onnx and used in other upscaling software including Chainner, but they don't seem to work with Magpie. Magpie seems to only support onnx models that are dymanic, supporting the following: "Input and output dimensions must be [-1, 3, -1, -1], with data format NCHW.". A static model may have a different shape, for example: (1, 3, 256, 256). Other software, including Chainner, seem to upscale the image in tiles (256x256 in this case) and stitch them together to create the upscaled image. I was hoping that magpie would start supporting static onnx models like Chainner does, which would allow for more advanced upscaling arches to be supported.

GitHub
Model Conversion
neosr is a framework for training real-world single-image super-resolution networks. - muslll/neosr