SUPIR: Upscaling your Images to next level

upscale and downscale images with supir model

Forget about those older Photoshop techniques where you need editing skills but don't get the perfect resolution at its optimal level. SUPIR (Scaling-UP Image Restoration) based on LoRA and Stable Diffusion XL(SDXL) framework released by XPixel group, helps you to upscale your image in no time.


supir results as output

The model is trained on 20 million high-resolution images, each with descriptive text annotations. It allows you to restore images guided by detailed positive and negative textual prompts.

This is licensed under non-commercial one, you can use this for research purposes only. For in-depth research, you can go through their research papers.


Installation:

1. Install ComfyUI if you are new to it.

2. Update ComfyUI from Manager by choosing "Update ComfyUI".

3. Move to the "ComfyUI/custom_nodes" folder. Navigate to the folder address bar and type "cmd" to open the command prompt. 

clone repository

Clone the repository by typing the following command provided below:

git clone https://github.com/kijai/ComfyUI-SUPIR.git

4. Next, install the dependent libraries using the following command:

For normal ComfyUI users:

pip install -r requirements.txt

For ComfyUI portable users, move inside the "ComfyUI_windows_portable" folder. Open the command prompt and type these commands:

python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-SUPIR\requirements.txt

5. Now, Xformers(helps to faster the render time) will be detected automatically. If you want to install then use this command.

For normal ComfyUI users:

pip install -U xformers --no-dependencies

For ComfyUI portable user:

python_embeded\python.exe -m pip install -U xformers --no-dependencies


download supir pruned models

6. Download the SUPIR pruned models from Kijai's Hugging Face repository. The original raw model (if you want) can be downloaded from Camenduru's repository.

As usual, put them inside "ComfyUI/models/checkpoints" folder.


Workflow:

1. By drag-drop, load the workflow in ComfyUI. You can find the workflow inside your "ComfyUI/custom_nodes/ComfyUI-SUPIR/examples" folder.

2. Upload the blurry image into "Load Image" node. 

3. Choose the SDXL based models(like DreamshaperXL, JuggernautXL etc) from sdxl_model option.

supir scale settings node

3. Choose the relevant models from the SUPIR model loader option. There are two variants:

  • SUPIR-v0F_fp16 - Trained with light degradation configuration.
  • SUPIR-v0Q_fp16 - Trained with default settings. This is for high generalization and produces high image quality in most cases.

Set the "scale by" parameter to do the upscaling like 2x,3x, or 4x. The more pixels you want the longer your processing time will be. It totally depends on your system configuration. For CFG, steps, samplers, and other parameters, select what works best for the SDXL models you use.

3. As officially reported, they are using LLAVA LLM in the background to enhance the overall performance but it can also work without this as well. In case you can include that as well. 

4. Select the floating point type. FP8 works great for Unet as it will help you to reduce VRAM and keep you away to out of memory errors. Use the "tiled_vae" option for VAE. Well, tile sizes can be reduced from 1024 and 512 to 512 and 256 pixels.

After testing, multiple images we came to know that it works better with a human face, and animals. 

Take it in mind, that using the tiled option also reduces VRAM but increases your system RAM.

We tested with 3090 with 24 GB VRAM, the 3x and 4x upscaling was smooth but with 3060 12GB VRAM, it was causing memory error.

5. Finally, click queue to start the rendering.

Conclusion:

As mentioned the SUPIR model is registered under non-commercial license. Enterprises who are interested in commercial purposes should obtain permission from Dr. Jinjin Gu (jinjin.gu@suppixel.ai)