face_enhancement.md 2.3 KB
Newer Older
W
wangna11BD 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# Face Enhancement

## 1. face enhancement introduction

Blind face restoration (BFR) from severely degraded face images in the wild is a very challenging problem. Due to the high illness of the problem and the complex unknown degradation, directly training a deep neural network (DNN) usually cannot lead to acceptable results. Existing generative adversarial network (GAN) based methods can produce better results but tend to generate over-smoothed restorations. Here we provide the [GPEN](https://arxiv.org/abs/2105.06070) model. GPEN was proposed by first learning a GAN for high-quality face image generation and embedding it into a U-shaped DNN as a prior decoder, then fine-tuning the GAN prior embedded DNN with a set of synthesized low-quality face images. The GAN blocks are designed to ensure that the latent code and noise input to the GAN can be respectively generated from the deep and shallow features of the DNN, controlling the global face structure, local face details and background of the reconstructed image. The proposed GAN prior embedded network (GPEN) is easy-to-implement, and it can generate visually photo-realistic results. Experiments demonstrated that the proposed GPEN achieves significantly superior results to state-of-the-art BFR methods both quantitatively and qualitatively, especially for the restoration of severely degraded face images in the wild.

## How to use

### face enhancement

The user could use the following command to do face enhancement and select the local image as input:

```python
import paddle
from ppgan.faceutils.face_enhancement import FaceEnhancement

faceenhancer = FaceEnhancement()
img = faceenhancer.enhance_from_image(img)
```

W
wangna11BD 已提交
21 22
Note: please convert the image to float type, currently does not support int8 type.

W
wangna11BD 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
### Train (TODO)

In the future, training scripts will be added to facilitate users to train more types of GPEN.

## Results

![1](https://user-images.githubusercontent.com/79366697/146891109-d204497f-7e71-4899-bc65-e1b101ce6293.jpg)

## Reference

```
@inproceedings{inproceedings,
author = {Yang, Tao and Ren, Peiran and Xie, Xuansong and Zhang, Lei},
year = {2021},
month = {06},
pages = {672-681},
title = {GAN Prior Embedded Network for Blind Face Restoration in the Wild},
doi = {10.1109/CVPR46437.2021.00073}
}

```