Skip to content

wakamenori/txt2imghd-colab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open In Colab

Introduction

This notebook is basically a Colab version of txt2imghd and also NSFW disabled.
I take some codes from the original repo and made it work on Colab. It's easy for people who has no coding background to use it.

txt2imghd generates high-resolution images using txt2img and img2img.

txt2imghd is a port of the GOBIG mode from progrockdiffusion applied to Stable Diffusion, with Real-ESRGAN as the upscaler.
It creates detailed, higher-resolution images by first generating an image from a prompt, upscaling it, and then running img2img on smaller pieces of the upscaled image, and blending the result back into the original image.

(quoted from original repo)

How it works

  1. Generate an image from a prompt using txt2img. Or load a image file.
  2. Scale up the image using Real-ESRGAN.
  3. Run img2img on smaller pieces of the up-scaled image.
  4. Blend the result back into the upscaled image.

Detailed explanation

Step.1 Generate an image from a prompt using txt2img

Let's say you generate an image in pixel size of 512x512 using txt2img. Original image

Step.2 Scale up the image using Real-ESRGAN

Scale up the image to 1024x1024. up-scaled

Step.3 Run img2img on smaller pieces of the up-scaled image

Chop up-scaled image into slices in pixel size of original image.
In this example, up-scaled image will be chopped into 9 images in pixel size of 512x512.
Then run img2img on every small images with the same prompt for original image.
This process generates more detailed and cleaner images compared to just up scaling the image img2img-1 img2img-2

Step4. Blend the result back into the upscaled image.

Finally, blend the slices of images back into the upscaled image.
txt2imghd txt2imghd_diff

Step.3 and Step.4 again

If you select SCALEUP_RATIO 4x or 8x and checked SCALEUP_STEP_BY_STEP, Step.3 and Step.4 runs again.
up scale 1024x1024 image to 2048x2048, and chop up-scalled image into 36 pieces then run img2img on every 36 images, then blend them back

CUDA out of memory try these

Not to run out memory,

  • Smaller size of the image
  • Lower SCALEUP_RATIO
  • Uncheck FP32
  • Uncheck GFPGAN

Credits

Colab

Reddit

Github

About

A port of GOBIG for Stable Diffusion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 83.9%
  • Python 16.1%