Upscaler Pipelines
Last updated
Last updated
Upscaling is also one of the most common use cases of Automatic 1111. You can increase the resolution of images using AI upscalers like Esrgan models or Real Esrgan, preserving the quality and main features of the original image while also being able to increase the resolution, focus, and quality.
With Auto 1111 SDK, you can use any Esrgan upscaler with our Esrgan Pipeline. These weights will have to be downloaded by you from the internet. You can find many different types of upscalers on https://openmodeldb.info/. Here's how you can use them with Auto 1111 SDK.
Choose an upscaler and download its weights. In this example, I will choose the Universal Upscaler v2: https://openmodeldb.info/models/4x-UniversalUpscalerV2-Sharp
Load the pytorch (pth) weights file and initialize an Esrgan Pipeline object.
Load an initial image that you wish to upscale
Upscale the image
The scale is the factor by which how much you want to increase the resolution of an image. If you pass a 512x512 image through the upscaler with a scale of 4, it will return a 2048x2048 AI-upscaled image.
The output type will be a PIL object. The pipeline will only generate 1 upscaled image. Here are the results of the Universal Upscaler V2 with a scale of 4:
Real Esrgan upscaler is an enhancement to the original Esrgan upscaler and it performs better for more realistic images. With Auto 1111 SDK, you can use both download RealEsrgan pipeline weights and run the upscaling process within a few lines of code. Here's how:
First download the specific type of upscaling model you want. You can choose from the following 6 types of Real Esrgan upscalers:
R-ESRGAN General 4xV3
R-ESRGAN General WDN 4xV3
R-ESRGAN AnimeVideo
R-ESRGAN 4x+ Anime 6B
R-ESRGAN 4x+
R-ESRGAN 2x+
for example:
This will download the file and store it in the local path, "upscaler.pth".
Define/initialize the upscaling object:
Upscale the image:
Here are the results of this pipeline when I upscale it by factor of 4: