chaiNNer icon indicating copy to clipboard operation
chaiNNer copied to clipboard

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

Open kevin98761234 opened this issue 1 year ago • 3 comments

Information:

  • Chainner version: 0.21.2-nightly.2024-01-19
  • OS: Windows 10 Version 22H2

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

kevin98761234 avatar Jan 20 '24 19:01 kevin98761234

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

joeyballentine avatar Jan 20 '24 19:01 joeyballentine

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.

kevin98761234 avatar Jan 20 '24 21:01 kevin98761234

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.

RunDevelopment avatar Jan 20 '24 22:01 RunDevelopment