Skip to content

[Feature Request] UltraHDFix Pipeline (method from imaginAIry) #12

@iwr-redmond

Description

@iwr-redmond

Version 14 of Bryce Drennan's imaginAIry package conceived of a very helpful way to abstract away the details of going from SD15 resolution to full hires images using ControlNet:

  1. Define resolutions for easy retrieval by the user (utils/named_resolutions.py)
  2. Generate a low-resolution "composition" image (api/generate_refiners.py#L218)
  3. Use the Tile ControlNet to turn this low-resolution starting point into the final image (api/generate_refiners.py#L260). (Note that in ImaginAIry, 'details' is an alias for control_v11f1e_sd15_tile (see config.py#L345).

Looking at constants.py in the current dev branch, you have already set up Tile-capable ControlNets for all three supported architectures. This would allow stablepy to replicate this user-friendly upscaling method easily.

I propose a new pipeline ultrahdfix (or similar) to do as follows:

  1. Calculate the correct minimum resolution for the relevant model - 512px for SD15, 1024px for SDXL and FLUX - and generate a correctly scaled image per the user request, e.g. FHD [1920x1080] = 512x288
  2. Do the initial generation, optionally with detailfix (TileCN does well with details when upscaling, at least in SD15)
  3. Use ESRGAN to do the initial upscale for the original composition image, allowing the ControlNet model to focus entirely on detailing. (This may need to be done multiple times if the scale factor is greater than 4x; in the example it is 3.75).
  4. Send the upscaled PIL composition image, prompts (SD) / prompt (FLUX), Loras (SD/FLUX) and embeddings (SD) to the relevant ControlNet for the model architecture.
  5. Crop the final PIL image to exactly match the correct resolution if required (ESRGAN can sometimes be a few pixels out).
  6. Provide the final PIL image to the user, with an option to retrieve the composition image for comparison.

As in the source program, the proposed helper pipeline would chain these preexisting steps together to make model-agnostic ultra high-resolution image generation as simple as possible for the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions