From 6a72c567cca921888d28c9f723b18e284f271bdf Mon Sep 17 00:00:00 2001 From: Anindya Maiti Date: Mon, 25 Sep 2023 16:44:57 -0500 Subject: [PATCH] Update 'README.md' --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 7c67b16..f165073 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,29 @@ Some technical background: ![](images/cn-sd.png) +## AI Upscaling + +Since VRAM on GPUs is limited, use one that fits your need. + +### Context-based Upscaling (Suitable on GPUs, Better Quality) + +Most universal is [Real-ERSGAN](https://github.com/xinntao/Real-ESRGAN). A1111 already has this and several other upscalers. + +### Generic AI Upscaling (Suitable on CPUs, Lower Quality) + +Most universal is [EDSR](https://huggingface.co/eugenesiow/edsr-base). Sample python code to run on CPU: +``` +from super_image import EdsrModel, ImageLoader +from PIL import Image +import requests + +url = 'https://paperswithcode.com/media/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg' +image = Image.open(requests.get(url, stream=True).raw) + +model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=2) # scale 2, 3 and 4 models available +inputs = ImageLoader.load_image(image) +preds = model(inputs) + +ImageLoader.save_image(preds, './scaled_2x.png') # save the output 2x scaled image to `./scaled_2x.png` +ImageLoader.save_compare(inputs, preds, './scaled_2x_compare.png') # save an output comparing the super-image with a bicubic scaling +``` \ No newline at end of file