File size: 2,766 Bytes
f1b4a64
 
 
 
 
 
 
 
 
 
 
f903e88
 
 
 
7d7fc62
 
f1b4a64
f903e88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aac785b
 
47cab30
 
 
 
aac785b
 
f903e88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
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](imgs/teaser.png)
**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](https://facesthroughtime.github.io/) [Dataset](https://forms.gle/MnPp83XDsMJabUXs6) [Paper](https://arxiv.org/abs/2210.06642)

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
```python
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
```python
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.