16/09/2023

Restoring Old Photos using AI

By snorlaxprime

I stumble across the open source Face restoration using AI. So naturally tempted to try this on and the results are quite stellar.

Here are the steps to install the open source installation, note that you will need to have the following pre-requisite:

  • Python >= 3.7
  • PyTorch >= 1.7

Choose your favourite OS to install the above, and then head to the following website https://github.com/TencentARC/GFPGAN and follow their installation instructions

Step 1. Clone the Repo

git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN

Step 2. Install the dependency package

# Install basicsr - https://github.com/xinntao/BasicSR
# We use BasicSR for both training and inference
pip install basicsr

# Install facexlib - https://github.com/xinntao/facexlib
# We use face detection and face restoration helper in the facexlib package
pip install facexlib

pip install -r requirements.txt
python setup.py develop

# If you want to enhance the background (non-face) regions with Real-ESRGAN,
# you also need to install the realesrgan package
pip install realesrgan

If all goes well, you should see the following results that realesrgan is successfully installed

Step 3. Download the pre-trained model

wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -P experiments/pretrained_models

Step 4. Process the images

Now you can process the image you want to process into the input folder and in this example I am using the default folder which is “inputs/whole_imgs” and you will find the output at “results” folder

python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2

Conclusion

This one is worth looking as as some of the results are quite stunning. However there are also a few photos that looks different from what I remembered but this is due to the very distorted quality of the source photo itself, which makes the restoration harder.

Here are some of the good ones

And the one that are not so good, due to the original quality, I will let you be the judge

And special mention about the following that is supposed to be me but doesn’t look like me at all, but I wouldn’t mind