Artificial intelligence

Machine Learning in Linux: Old Photo Restoration

With the availability of huge amounts of data for research and powerful machines to run your code on with distributed cloud computing and parallelism across GPU cores, Deep Learning has helped to create self-driving cars, intelligent voice assistants, pioneer medical advancements, machine translation, and much more. Deep Learning has become an indispensable tool for countless industries.

Old Photo Restoration is a project that uses deep learning to restore old photos via deep latent space translation. This research project lets you restore old photos that suffer from severe degradation through a deep learning approach. It uses a novel triplet domain translation network by leveraging real photos along with massive synthetic image pairs.

The software is written in Python and published under the MIT license.

Installation

First, clone the project’s GitHub repository with the command:

$ git clone https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life

Now we clone the Synchronized-BatchNorm-PyTorch repository.

$ cd Bringing-Old-Photos-Back-to-Life/Face_Enhancement/models/networks/
$ git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
$ cp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .
$ cd ../../../

$ cd Global/detection_models
$ git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
$ cp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .
$ cd ../../

Download the landmark detection pretrained model.

$ cd Face_Detection/
$ wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
$ bzip2 -d shape_predictor_68_face_landmarks.dat.bz2
$ cd ../

Now download the face checkpoints and global checkpoints pretrained models using wget. Note the face_checkpoints.zip file is a 653MB download, and the global_checkpoints.zip file is a 1.9GB download.

$ cd Face_Enhancement/
$ wget https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/face_checkpoints.zip
$ unzip face_checkpoints.zip
$ cd ../
$ cd Global/
$ wget https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/global_checkpoints.zip
$ unzip global_checkpoints.zip
$ cd ../

Using pip, we install the dependencies. pip is a package manager for Python packages.

$ pip install -r requirements.txt

On our systems, the pip command compiles and installs the packages: PySimpleGUI-4.60.4, dill-0.3.6, dlib-19.24.0, dominate-2.7.0, easydict-1.10, einops-0.6.0, protobuf-3.20.3, and tensorboardX-2.6.

If you want to test the project’s GUI, you’ll also need the python3-tk package installed. On our Ubuntu system, this is installed with the command:

$ sudo apt-get install python3-tk

Next page: Page 2 – In Operation and Summary

Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Please read our Comment FAQ before posting a comment.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Manny
Manny
11 months ago

Hi, Starts and sits there for 2 hours, the second time, the first was also around two hours. Please advise.
manolo@manolo-Inspiron-620:~/Bringing-Old-Photos-Back-to-Life$ python3 GUI.py
Running Stage 1: Overall restoration
/bin/sh: 1: python: not found
/bin/sh: 1: python: not found

Nemo
Nemo
11 months ago
Reply to  Manny

Python>=3.6 is required.