apchenstu / Facial_Details_Synthesis

[ICCV2019 Oral] Photo-Realistic Facial Details Synthesis from Single Image
MIT License
628 stars 131 forks source link

This is the code repo for Facial Details Synthesis From Single Input Image. [Paper] [Supplemental Material] [Video]

This repository consists of 5 individual parts: DFDN, emotionNet, landmarkDetector, proxyEstimator and faceRender.

We would like to thank each of the related projects for their great work.

Facial Details Synthesis

Anpei Chen, Zhang Chen, Guli Zhang, Ziheng Zhang, Kenny Mitchell, Jingyi Yu

We present a single-image 3D face synthesis technique that can handle challenging facial expressions while recovering fine geometric details. Our technique employs expression analysis for proxy face geometry generation and combines supervised and unsupervised learning for facial detail synthesis. On proxy generation, we conduct emotion prediction to determine a new expression-informed proxy. On detail synthesis, we present a Deep Facial Detail Net (DFDN) based on Conditional Generative Adversarial Net (CGAN) that employs both geometry and appearance loss functions. For geometry, we capture 366 high-quality 3D scans from 122 different subjects under 3 facial expressions. For appearance, we use additional 163K in-the-wild face images and apply image-based rendering to accommodate lighting variations. Comprehensive experiments demonstrate that our framework can produce high-quality 3D faces with realistic details under challenging facial expressions.

Features

Set up environment

  1. Install windows version of Anaconda Python3.7 and pytorch
  2. [Optional] Install tensorflow and keras if you want to use emotion prior (emotionNet)

Released version

  1. Download the released package.

    Release v0.1.0 [Google Drive, OneDrive]

  2. Download models and pre-trained weights.

    DFDN checkpoints [Google Drive, OneDrive] unzip to ./DFDN/checkpoints

    landmark models [Google Drive, OneDrive] unzip to ./landmarkDetector

    [Optional] emotionNet checkpoints [Google Drive, OneDrive] unzip to ./emotionNet/checkpoints

  3. Install BFM2017

    • Install eos-py by pip install --force-reinstall eos-py==0.16.1

    • Download BFM2017 and copy model2017-1_bfm_nomouth.h5 to ./proxyEstimator/bfm2017/

    • Run python convert-bfm2017-to-eos.py to generate bfm2017-1_bfm_nomouth.bin in ./proxyEstimator/bfm2017/ folder

  4. Have fun!

Usage

Compiling

We suggest you directly download the released package for convenience. If you are interested in compiling the source code, please go through the following guidelines.

  1. First, clone the source code,

    git clone https://github.com/apchenstu/Facial_Details_Synthesis.git --recursive

  2. cd to the root of each individual model then start compiling,

    landmarkDetector

    • Executing the download_libraries.ps1 and download_models.ps1 with PowerShell script.
    • Open OpenFace.sln using Visual Studio and compile the code.

      After compiling, the excuse file would located in /x64/Release/FaceLandmarkImg.exe

    textureRender

    • install with

      mkdir build && cd build
      cmake -A X64 -D CMAKE_PREFIX_PATH=../thirds ../src
      • Open textureRender.sln using Visual Studio and compile the code.

      After compiling, the excuse file would located in Release/textureRender.exe

    proxyEstimator

    • install vcpkg

    • install package under vcpkg folder: ./vcpkg install opencv boost --triplet x64-windows

    • Install with,

      mkdir build && cd build
      cmake .. -A X64 -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake
    • Open eos.sln using Visual Studio and compile the code.

      After compiling, the excuse file would located in Release/eso.exe

      For more details, please refer to this repo.

    faceRender

    • Install with

      mkdir build && cd build
      cmake -A X64 -D CMAKE_PREFIX_PATH=../thirds ../src
      • Open hmrenderer.sln using Visual Studio and compile the code.

      After compiling, the excuse file would located in build\Release

      Note: The visualizer currently only supports mesh + normalMap, but will also support displacementMap in the near future.

      After compiling, please download DFDN checkpoints, unzip to ./DFDN/checkpoints. Then you are free to use.

Others

On the way .....

Q & A

  1. Proxy result is different with showing in the paper?

    It's because the released version are using a lower resolution input and a different expression dictionary, which are more robust in general case. Please try this if you want to obtain similar results as in the paper.

Citation

If you find this code useful to your research, please consider citing:

@inproceedings{chen2019photo,
  title={Photo-Realistic Facial Details Synthesis from Single Image},
  author={Chen, Anpei and Chen, Zhang and Zhang, Guli and Mitchell, Kenny and Yu, Jingyi},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision},
  pages={9429--9439},
  year={2019}
}