An open source tool is available on GitHub with which faces can be restored from old photos: Generative Facial Prior (GFP) is the name of the tool developed in China, and it is a machine learning model of the Generative Adversarial Network (GAN) type. According to the project description, GFP-GAN offers “practical algorithms for the realistic reconstruction of faces” in images.
GFP-GAN is open source software licensed under the Apache License 2.0 and comes from a development team at ARC Lab, where ARC stands for Applied Research Center. Behind it is the Chinese social media provider Tencent, which founded the laboratory in 2019 and claims to be doing media-relevant AI research with it.
Under the hood: image generation in several phases
The Canadian computer scientist and AI master’s student Louis Bouchard has taken a close look at the underlying technology and presents the tool on his channel “What’s AI” on YouTube: While conventional methods for restoring old photos have so far used an AI model that Measures differences between generated photos and originals, the new technology apparently combines information from two complementary AI models and supplements missing details in a photo-realistic way.
According to Bouchard, the new approach uses a pre-trained version of an AI model, which divides the process of image generation into several phases. With the technology, the identity of people can be better preserved in photos than before – among other things, because special attention is paid to facial features such as the eye area and mouth. The new technology is not perfect either, so particularly old or damaged photos are given new details that they did not originally contain. Depending on the state of preservation, the reconstructed representations could then look significantly different than the people in the original.
GitHub repository and online demos available
There is a Colab demo for the project as well as online demos at Huggingface, Replicate and BaseTen, among others. If you want to operate GFP-GAN yourself, you need Python version 3.7 or higher, PyTorch version 1.7 or higher. The ARC Lab team also recommends installing Anaconda or Miniconda. Optionally, the model can be operated with NVIDIA GPU and CUDA, operation should be possible under Windows as well as under Linux. The GitHub repository provides installation notes, training tips, and a quick inference.
If you want to try the tool, you can use a web application called BaseTen to upload images for optimization in the browser or load the source code from the GitHub repository and integrate the model into your own applications.