faces-through-time / README.md
echen01
fix reqs
47cab30
metadata
title: Faces Through Time
emoji: 🦀
colorFrom: yellow
colorTo: gray
sdk: gradio
sdk_version: 3.33.1
app_file: app.py
pinned: false
license: mit

What's in a Decade? Transforming Faces Through Time

Teaser image What's in a Decade? Transforming Faces Through Time
Eric Ming Chen, Jin Sun, Apoorv Khandelwal, Dani Lischinski, Noah Snavely, Hadar Averbuch-Elor
Eurographics 2023
Webpage Dataset Paper

Abstract: How can one visually characterize people in a decade? In this work, we assemble the Faces Through Time dataset, which contains over a thousand portrait images from each decade, spanning the 1880s to the present day. Using our new dataset, we present a framework for resynthesizing portrait images across time, imagining how a portrait taken during a particular decade might have looked like, had it been taken in other decades. Our framework optimizes a family of per-decade generators that reveal subtle changes that differentiate decades—such as different hairstyles or makeup—while maintaining the identity of the input portrait. Experiments show that our method is more effective in resynthesizing portraits across time compared to state-of-the-art image-to-image translation methods, as well as attribute-based and language-guided portrait editing models.

Demo

Welcome to our demo for Faces Through Time!

Unfortunately, because the Hugging Face demo is CPU only, it takes over 20 minutes. We suggest running it locally, following the instructions below. The results should take 1 minute per image.

Running the Demo Locally

First clone the repo with git lfs. This will also download all required checkpoints. The total repo size is about 10GB.

git lfs install
git clone https://huggingface.co/spaces/emc348/faces-through-time

To run StyleGAN, install the following packages

pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements_local.txt

To run with cuda, change line 3 in configs/global_config.py to

device = "cuda"

To reduce artifacts in the generated images, we suggest turning on the background mask during GAN inversion. This is turned off by default because of Hugging Face speed limitations. In configs/hyperparameters.py, change line 15 to

use_mask = True

To start the demo, run

gradio app.py

The demo will start at http://localhost:7860 on your server. To visualize results, upload an image of a person, and select the input decade. The script will automatically crop and align the input image.