How to Use ESRGAN: Free AI Tool to Upscale Unlimited Images

How to Use ESRGAN A Free AI Tool to Upscale Images

ESRGAN (Enhanced Super-Resolution Generative Adversarial Network) is a free AI tool that provides a perception-driven approach for single image super-resolution that is able to produce photorealistic images.

It upscales images, which means it increases the resolution of an image. It is a fantastic tool that’ll bring life to your old photos.

Those nostalgic memories that were captured on old cameras, whose images, as compared to current standard quality, are blurry and seem to lack information, can now be upscaled and relived with the help of ESRGAN.

ESRGAN is also often used as a component in AI image generators to save time and resources when generating images. For example, generating a 512x512px image and upscaling it to 1024×1024 can be a lot less computationally intensive than generating a 1024x1024px image.

In this article we’ll cover how you can upscale any image using ESRGAN in Google Colab.

Google Colab is a free service hosted by Google that provides an environment within which you can create and share documents that contain live code, equations, visualizations and text. It’s like Google Docs, but for Python code. You don’t need to download anything and you can use Google Colab from any computer or phone with an internet connection.

This is a beginner-friendly guide, and you won’t need any programming knowledge at all. If you’d like a quick and beginner-friendly intro on using Google Colab and it’s benefits check out our related tutorial.

tl;dr AI News Section Preview
tl;dr AI News Section Preview

Sidenote: AI art tools are developing so fast it’s hard to keep up.

We set up a newsletter called tl;dr AI News.

In this newsletter we distill the information that’s most valuable to you into a quick read to save you time. We cover the latest news and tutorials in the AI art world on a daily basis, so that you can stay up-to-date with the latest developments.

Check tl;dr AI News

Getting ESRGAN onto Google Colab

To access the ESRGAN Google Colab notebook, click the following link: https://colab.research.google.com/drive/1k2Zod6kSHEvraybHl50Lys0LerhyTMCo?usp=sharing

[powerkit_alert type=”info” dismissible=”false” multiline=”false”]
You can also find additional information on ESRGAN here: https://github.com/xinntao/Real-ESRGAN
[/powerkit_alert]

The following is what you’ll see when you access the ESRGAN Google Colab notebook.

word image 12769 2 2

Setting up The Notebook for Faster Processing

We need to make sure that Colab is using GPU.

Usually Google allocates GPU by for your Colab notebook by default, but still, it’s better to check in advance.

To do this, in the Colab menu, click Runtime > Change runtime type.

word image 12769 3 2

A small popup will appear. Under Hardware accelerator there’s a dropdown. Male sure GPU is selected and click Save.

word image 12769 4 2

Now we are all ready to upscale our images.

Running the Program Cells

Run All

Now we’ll just have to run all of the code cells. To do this easily go into the menu again Runtime > Run all. This will make every code cell to run, one after the other.

word image 12769 5 2

Google will give you a warning. Click Run anyway. This notebook is safe. It’s good to be careful when running other Google Colab notebooks, however.

word image 12769 6 2

The numbered cells will start running.

word image 12769 7 2

Upload Your Image

After the second cell runs for 10-20 seconds, it will give you an option to choose/upload an image.

word image 12769 8 1 e1663698542490

After you choose the image, all of the below cells will start to run.

word image 12769 9 1

Visualize Before / After Results

You can view the input and upscaled image side by side.

Download Results

Now the upscaled image zip file will be downloaded when the 5th cell runs.

word image 12769 12 1

You can open the zip file and find the jpg upscaled image.

word image 12769 13 1

Downloading via The Google Colab File Browser

Still if you want to view the result and the 5th cell could not execute properly, you can access the upscaled image in Google Colab’s file browser, on the left:

 

Upscale Multiple Images

You can upload and upscale multiple images at once like shown below.

Troubleshooting

Error “slow_conv2d_cpu” not implemented for ‘Half’

If you’re getting the following error Error "slow_conv2d_cpu" not implemented for 'Half', try the following:

  1. In the 3. Inference cell you’ll see the line:
    !python inference_realesrgan.py -n RealESRGAN_x4plus -i upload --outscale 3.5 --face_enhance

    word image 12769 22

  2. Just add --fp32 after the upload statement and then run all the cells again (step-1). This will turn it into:
    !python inference_realesrgan.py -n RealESRGAN_x4plus -i upload --outscale 3.5 --face_enhance

    word image 12769 23

 

Conclusion

In this tutorial we learned how to use ESRGAN via Google Colab to easily upscale one or more images for free. If you encounter any issues feel free to leave a comment and we’ll get back to you as soon as possible.

Resources

 

0 Shares:
Subscribe
Notify of
guest
Receive notifications when your comment receives a reply. (Optional)
Your username will link to your website. (Optional)

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
You May Also Like