Programming

Image upscaling: increase the size and resolution of photos

Image upscaling: increase the size and resolution of photos

With the term upscaling it refers to the technique used to increase the resolution or size of an image without losing too much quality or detail. This technique is especially useful when you want to enlarge an image without having to recreate it from scratch or lose sharpness.

When you increase the size of an image, quality loss occurs because the original image contains fewer pixels than what you intended. There resolution of an image is defined by the number of pixels that compose it. As the size increases, the number of pixels used increases. THE pixel must be created somehow because the number of pixels that distinguish the starting image is not sufficient to describe the details at higher resolutions.

Upscaling: how to add missing pixels in a resized image

There are several methods for increase the size of an image. L’interpolation it is a technique used to estimate the values โ€‹โ€‹of missing or extra pixels based on the surrounding existing pixels. Since the details of the original image are limited, interpolation can lead to a loss of definition and sharpness. Especially when the size of the starting image is increased significantly.

To achieve a better result in image upscaling, more advanced algorithms have been developed using theartificial intelligence and the machine learning to try to reconstruct the missing details and make the image more realistic. The obtainable results vary significantly from one algorithm to another and obviously also greatly depend on the resolution and quality of the original image. Modern upscaling algorithms are getting better and better, allowing for results that often border on perfection in the resizing to the top of photos and images.

GFP-GAN: The best tool for image upscaling

After implementing an algorithm for improve image quality displayed on web pages, Microsoft has also integrated Video Super Resolution into Edge. It is a tool capable of automatic upscaling of video content loaded by the browser. The process rests on the use of dedicated video cards Recently made NVidia or AMD.

Focusing on resizing photos and images, the market today offers a large number of tools that help with increase the resolution of the images. However, not all of them offer the desired results.

GFP-GAN (Generative Facial Prior โ€“ Generative Adversarial Network) remains one of the best tools ever, an open source project that anyone can use and that was born from an academic study published in June 2021.

Where does the name GFP-GAN come from

The acronym GAN highlights the use of an architecture of artificial neural network in order to generate new information that has characteristics similar to the training data. These networks are called precisely Generative Adversarial Network because two distinct neural networks (generator and discriminator) are simultaneously trained and put into mutual competition. The generator is responsible for generating new data that looks like the training data; the discriminator takes care of distinguishing between the real data and those created by the generator.

During the process of training, the generator tries to improve more and more the quality of the generated data to fool the discriminator; the discriminator tries to become more and more adept at distinguishing between real and generated data. This competition leads to continuous improvement of performance of both networks.

A well-trained GAN is obviously also very useful for managing upscaling needs because it becomes essential for generare i pixel missing in image resizing. Not only. The acronym GFP refers to the fact that the system is also adept at restoring true-to-life detail on people’s faces. The training activity carried out by the authors made it possible to guarantee a good balance between realism e fidelity.

How to increase the size of any image enhancing the details and quality of the photo

GFP-GAN, as highlighted at the beginning, is a project open source. This means that anyone can use it and even manage the upscaling of images and photos directly on the own hardware. Even locally or, as they say, on-premises.

The “subtitle” of the GFP-GAN project is face restoration because it was born with the precise aim of enhancing i face details during upscaling activities, without loss of information. Indeed, trying to preserve and, if possible, enhance the somatic characteristics of each subject. As an added “bonus”, GFP-GAN improves the overall quality of any photo by deleting artifactscorrecting subtle details and out-of-focus elements.

On the GFP-GAN GitHub page, information is published to install the application by making a clone of the repository. By default GFP-GAN needs Python e PyTorch (open source library for the machine learning and the deep learning mainly developed by Meta); optionally an NVidia video card and the CUDA Toolkit.

Various are published on the same page modelswhich can be used to refine the behavior of GFP-GAN, and the instructions to possibly carry out further training phases (training).

How to try upscaling with GFP-GAN now without installing anything

In the meantime, our suggestion is to open the GFP-GAN demo web page and then log in with a GitHub user account (button Sign In With GitHub).

Upscaling foto con GFP-GAN

Doing so unlocks the ability to click the tile Drop a file or click to select to select the image a low resolution to enlarge. Alternatively, you can drag-and-drop a file into the same box on the web page or capture an image using webcam. As we know, in fact, the PC webcam is poor compared to that of the smartphone: GFP-GAN makes it clear what is the quality of the result obtainable with this tool.

The drop down menu Version allows you to choose the template to use while Rescaling factor it should be used to choose the size of the image you want to obtain. By opting for a factor of 2, you get a final image twice the size of the original. You can of course freely increase the upscaling factor however bearing in mind that, depending on the quality of the starting image, the resized one could in some cases appear unacceptable.

Upscaling factor

In the example in the figure, starting from a low resolution image (300 x 450 pixels), specifying an upscaling factor of 5 we obtained the image on the right, in just 2 seconds of processing (750 x 1125 pixels).

Also look at this example: a family photo, visibly deteriorated, is not only enlarged in terms of size thanks to GFP-GAN but even artificial intelligence manages to remove all the problems present in the original.

Leave a Reply

Your email address will not be published. Required fields are marked *