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)
- Generate an image from a prompt using txt2img. Or load a image file.
- Scale up the image using Real-ESRGAN.
- Run img2img on smaller pieces of the up-scaled image.
- Blend the result back into the upscaled image.
Let's say you generate an image in pixel size of 512x512 using txt2img.
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
Finally, blend the slices of images back into the upscaled image.
If you select
SCALEUP_RATIO
4x or 8x and checkedSCALEUP_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
Not to run out memory,
- Smaller size of the image
- Lower
SCALEUP_RATIO
- Uncheck
FP32
- Uncheck
GFPGAN
Colab
Github