nagadomi / nunif

Misc; latest version of waifu2x; 2D video to stereo 3D video conversion
MIT License
1.58k stars 142 forks source link

The "browser" version of your website converts SMALL images into solid black. #183

Closed shuttittuppitt closed 3 months ago

shuttittuppitt commented 4 months ago

This bug report concerns the following website. (Your other website does not have this problem.) https://unlimited.waifu2x.net/

My problem is that for certain images, it will only 'convert' them into solid BLACK images. (It does resize them if I try to do that with them, but 4x of solid black is still solid black.) This happens whether I use "Noise reduction" by itself, resize without noise reduction, or resize with noise reduction. I've also tried all 4 of the "Models", but the result is always the same.

The problem (seems) to only happen if the image is small. As an example (which I'm attaching to this bug report), I've experienced this problem with an image that is 72×50 pixels. Anyway, I finally found out that what causes this problem is that with small images, the problem happens unless "Tile size" equals 64. All of the other tile sizes cause this problem (with small images). This is especially bizarre, since I was using an (android) tablet that has 8 GB of RAM, plus it can handle bigger images without any problems no matter what tile size I use.

Kiss Me Kate (resize to 500p)

nagadomi commented 4 months ago

Confirmed. I will transfer this issue to https://github.com/nagadomi/nunif/issues

nagadomi commented 4 months ago

At this point, this seems to be a bug in onnx runtime. The result of Pad(mode=reflect) has uninitialized values for areas that are larger than twice the original size. onnx_reflect_pad

This problem will occur when the input image size(width or height) is less than half of Tile size.

nagadomi commented 3 months ago

Fixed. The above reflection padding problem has been reported many times in the onnxruntime repository but has not been fixed, so I changed to use replication padding instead of reflection padding.