chaiNNer-org / chaiNNer

A node-based image processing GUI aimed at making chaining image processing tasks easy and customizable. Born as an AI upscaling application, chaiNNer has grown into an extremely flexible and powerful programmatic image processing application.
https://chaiNNer.app
GNU General Public License v3.0
4.44k stars 278 forks source link

Automatic crop or resize when upscaling using Waifu2x's ncnn model #2486

Open kevin98761234 opened 7 months ago

kevin98761234 commented 7 months ago

Information:

Description https://github.com/nihui/waifu2x-ncnn-vulkan/releases When upscaling using the waifu2x-ncnn-vulkan model, the output image is incorrectly sized. 1x will crop by 28px and 2x will shrink by 36px.

Logs croptest28px chaiNNer-croptest main.log croptest.chn.zip

joeyballentine commented 7 months ago

This is actually an issue with the model technically. They should have put the padding they do inside what gets traced rather than expecting it to get done in preprocessing. To do this ourselves we'd need to have a good way to detect waifu2x models.

It would be much more worthwhile (imo) to just add support for waifu2x to spandrel which would therefore support converting those models to NCNN correctly

kevin98761234 commented 7 months ago

Looks like there was a problem with the model as you indicated. Just to be sure, I also tried the onnx model with 20.2, but the result is the same, outputting an incorrectly sized image. https://github.com/nagadomi/nunif/releases/tag/0.0.0

If Waifu2x is supported in the future, I would expect it.

RunDevelopment commented 7 months ago

It would be much more worthwhile (imo) to just add support for waifu2x to spandrel

Please make an issue that points to waifu2x PyTorch code.