Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytorch Upscale Image node tiling issue #2461

Closed
Darkenlord1 opened this issue Jan 13, 2024 · 3 comments · Fixed by #2487
Closed

Pytorch Upscale Image node tiling issue #2461

Darkenlord1 opened this issue Jan 13, 2024 · 3 comments · Fixed by #2487
Labels
bug Something isn't working

Comments

@Darkenlord1
Copy link

Information:

  • Chainner version: [0.21.0]
  • OS: [Windows 10]

Description
Trying to simple process images through model, however, with tile set to anything lower than 4096 it gives errors at some large images. Workflow preview attached.
image

Logs
Error log from interface:

Error

An error occurred in a pytorch Upscale Image node:



Input values:
• Image: RGB Image 3900x4680
• Model: Value of type 'spandrel.__helpers.model_descriptor.ImageModelDescriptor'
• Tile Size: Auto (estimate)
• Separate Alpha: No

logs.zip

@Darkenlord1 Darkenlord1 added the bug Something isn't working label Jan 13, 2024
@joeyballentine
Copy link
Member

Thanks for reporting and for providing logs. Definitely looks like there's something wrong with the tiling code there. The issue is that the end result tile does not match the size we would expect. We will look into it.

@Darkenlord1
Copy link
Author

And also with 4096 too, if image larger than that, it fails.

Error

An error occurred in a pytorch Upscale Image node:



Input values:
• Image: RGB Image 3900x4678
• Model: Value of type 'spandrel.__helpers.model_descriptor.ImageModelDescriptor'
• Tile Size: 4096
• Separate Alpha: No

@RunDevelopment
Copy link
Member

Found the issue. It's specific to ESRGAN models, kinda. So the issue is that the image size you have results in awkward tile sizes. In particular, it results in tiles with an odd width or height. It seems that, 1x and 2x ESRGAN models do not like that, and always output images with even sizes. E.g. if you give it a 5x16px image, it will return a 8x16px image.

In my testing, output image sizes are always a multiple of 4 (rounded up). So 1x ESRGAN models change the output size the most, and 4x models don't change it at all.

The reason we are only seeing this bug now is that the new tiling code strictly enforces the assumptions it makes about tiles. So the issue isn't with the tiling code, but the upscaling code and spandrel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants