Giter Club home page Giter Club logo

barisgecer / ganfit Goto Github PK

View Code? Open in Web Editor NEW
621.0 50.0 65.0 19.1 MB

Project Page of 'GANFIT: Generative Adversarial Network Fitting for High Fidelity 3D Face Reconstruction' [CVPR2019]

Home Page: http://openaccess.thecvf.com/content_CVPR_2019/html/Gecer_GANFIT_Generative_Adversarial_Network_Fitting_for_High_Fidelity_3D_Face_CVPR_2019_paper.html

License: GNU General Public License v3.0

Python 100.00%
3d-face-reconstruction generative-adversarial-network differentiable-rendering face-recognition cvpr2019 identity-features texture 3dface

ganfit's Introduction

arXiv Prepring

[CVPR 2019]

arXiv Prepring

[TPAMI 2021]

Baris Gecer 1,2, Stylianos Ploumpis 1,2, Irene Kotsia 3, & Stefanos Zafeiriou 1,2
1 Imperial College London
2 FaceSoft.io
3 University of Middlesex


  • 📌 GANFit now has a faster (called FastGANFit) and a more stable (called GANFit++) versions. See our TPAMI paper for the details
  • 📌 Evaluation code of GANFit and FastGANFit on MICC Florence dataset is now available (see below for instructions)
  • 📌 Unfortunately the reconstruction code of these studies has been commercialized, so we cannot share it with anyone. However, if you send some images, we can send back our results for comparison in academic publications.
  • 📌 We opened another texture-shape model to public with is very similar to GANFit texture model, you can apply for its license here TBGAN.

Abstract

In the past few years a lot of work has been done towards reconstructing the 3D facial structure from single images by capitalizing on the power of Deep Convolutional Neural Networks (DCNNs). In the most recent works, differentiable renderers were employed in order to learn the relationship between the facial identity features and the parameters of a 3D morphable model for shape and texture. The texture features either correspond to components of a linear texture space or are learned by auto-encoders directly from in-the-wild images. In all cases, the quality of the facial texture reconstruction of the state-of-the-art methods is still not capable of modelling textures in high fidelity. In this paper, we take a radically different approach and harness the power of Generative Adversarial Networks (GANs) and DCNNs in order to reconstruct the facial texture and shape from single images. That is, we utilize GANs to train a very powerful generator of facial texture in UV space. Then, we revisit the original 3D Morphable Models (3DMMs) fitting approaches making use of non-linear optimization to find the optimal latent parameters that best reconstruct the test image but under a new perspective. We optimize the parameters with the supervision of pretrained deep identity features through our end-to-end differentiable framework. We demonstrate excellent results in photorealistic and identity preserving 3D face reconstructions and achieve for the first time, to the best of our knowledge, facial texture reconstruction with high-frequency details.

GANFit

Detailed overview of the proposed approach. A 3D face reconstruction is rendered by a differentiable renderer (shown in purple). Cost functions are mainly formulated by means of identity features on a pretrained face recognition network (shown in gray) and they are optimized by flowing the error all the way back to the latent parameters (p_s, p_e, p_t, p_c, p_i, shown in green) with gradient descent optimization. End-to-end differentiable architecture enables us to use computationally cheap and reliable first order derivatives for optimization thus making it possible to employ deep networks as a generator (i.e,. statistical model) or as a cost function.

FastGANFit

Overview of the approach with regression network. The network is end-to-end connected with the differentiable renderer and the lost functions of GANFit. It benefits from the activations of all layers of a pretrained face recognition network and detection of a hourglass landmark detector.The network is trained similar to GANFit optimization: 1) alignment 2) full objective. The only difference is that now the regression network is being optimized instead of the trainable latent parameters of GANFit.

MICC FLorence Evaluation Code

  • First, apply for license and download the dataset here
  • Register the Ground Truth meshes from the dataset to a common template:
    • python micc_registration.py [MICC_path] [Registration_path]

    • The manually annotated landmarks are under 'MICC_landmarks' and the path is given by default
  • Estimate your 3D reconstructions based on videos (GANFit uses 5 random image per video), save them as '.obj' files under the same folder structure
  • Run the evaluation code:
    • python micc_evaluation.py [Registration_path] [Reconstruction_path]

    • Evaluation code first align meshes based on landmarks, so landmarks indices should be given as [--template_lms] (default template and corresponding landmarks are given in this repo)
    • Then it runs Rigid-ICP to deal with any misalignment remains without deforming the meshes
    • Finally, the errors are calculated as mean symmetrical point-to-plane distance
  • This evaluation scenario is borrowed from [Unsupervised Training for 3D Morphable Model Regression, Genova et al. CVPR 2018] and implemented by us.
  • Feel free to download the reconstruction results by GANFit++ here (You may run micc_evaluation.py to see its performance).

More Results


Citation

If you find this work is useful for your research, please cite our papers: GANFit, FastGANFit:

@InProceedings{Gecer_2019_CVPR,
author = {Gecer, Baris and Ploumpis, Stylianos and Kotsia, Irene and Zafeiriou, Stefanos},
title = {GANFIT: Generative Adversarial Network Fitting for High Fidelity 3D Face Reconstruction},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}

@article{gecer2021fast,
  title={Fast-GANFIT: Generative Adversarial Network for High Fidelity 3D Face Reconstruction},
  author={Gecer, Baris and Ploumpis, Stylianos and Kotsia, Irene and Zafeiriou, Stefanos P},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
  year={2021},
  publisher={IEEE}
}

ganfit's People

Contributors

barisgecer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ganfit's Issues

How to evaluate florence dataset for my model

Thankyou for providing the code for evaluation.

I am sorry for naive question but what I really can't understand is that of which pictures I have to predict meshes using my model.
If we generate meshes of Indoor-Cooperative, PTZ-Indoor, PTZ-Outdoor and compare it with registered ground truth meshes which are in frontal pose and neutral expression but predicted meshses will contain some pose and expression along with shape. How they are comparable with each other? How the frontal 1 or 2 is comparable with Indoor-Cooperative, PTZ-Indoor or PTZ-Outdoor.
I hope I made my point here.
What should be the file hirerichy of the predicted meshes?

About How to iteratively update the input vector Pt of PGGAN

Thanks for your great works. I have some issues about the input parameter Pt of PGGAN. Whether we need to roughly update the input parameter Pt through minimizing per-pixel Manhattan distance between UV texture of the input 2D image and the output UV texture of PGGAN firstly, then, adjust Pt through the loss of model fitting. In short, do we need a two-step adjustment of Pt. It is appreciated if I can receive your reply.

Texture coordinate

Hi, I want to ask you about how to define the texture coordinate to correspond the 3D vertices with uv texture map, do you know any learning materials about this knowledge point.

Input of the Texture GAN

Hi @barisgecer, thanks for sharing this interesting work! The ideas are novel and the results are very impressive!

In the paper, you train a Texture GAN for with texture parameters (pt) as input generating UV texture maps for each ID with the ground-truth provided in the texture dataset.

After reading the paper, I wonder how to obtain the mentioned texture parameters pt? Is it estimated by 3DMM models? And is it the color value of each vertex or something else?

As a beginner in 3D face topic, I would appreciate it if you could provide more details about it, which would be very helpful to me!

I am looking forward to your reply!

Best regards.

How long is the training time?

This is a really nice work!
I have a question about how much time does model train on an NVIDIA GTX 1080 TI GPU mentioned in paper?
Thank you!

latent parameters

Good job!
i have a question,how to get latent parameters from an image? Is from deep networks?
thanks for your apply

ValueError: The glob ganfit_plus/subject_01/Model/frontal1/obj/*.obj yields no assets

python3 micc_evaluation.py --template template.obj --template_lms landmark_ids.pkl ganfit_plus ganfit_reocnstruction

/home/nicolast0604/GANFit/env/lib/python3.6/site-packages/menpo/image/base.py:25: UserWarning: Falling back to scipy interpolation for affine warps
warn("Falling back to scipy interpolation for affine warps")
ID: 1
Traceback (most recent call last):
File "micc_evaluation.py", line 100, in
distances = benchmarker.benchmark(args.reconstruction_path)
File "micc_evaluation.py", line 83, in benchmark
distances[setting_id, scan-1, id-1] = self.calculate_error(fitting_path, gt_path, id, setting, scan, False)
File "micc_evaluation.py", line 56, in calculate_error
org = m3io.import_meshes(self.registration_path + gt_path + 'obj/.obj')[0]
File "/home/nicolast0604/GANFit/env/lib/python3.6/site-packages/menpo3d/io/input/base.py", line 185, in import_meshes
verbose=verbose,
File "/home/nicolast0604/GANFit/env/lib/python3.6/site-packages/menpo/io/input/base.py", line 880, in _import_glob_lazy_list
raise ValueError("The glob {} yields no assets".format(pattern))
ValueError: The glob ganfit_plus/subject_01/Model/frontal1/obj/
.obj yields no assets

About the Texture GAN

Hi @barisgecer, when I am reproducing the texture GAN, I encountered some problems.

The texture GAN's input is a 512-dimension latent vectors, and the arcface's output is also a 512-dimension, does this mean that the output of the Arcface is the input of the GAN? And if this output is the p_t parameter?

What's more, when have trained a texture GAN, the output should be a [512, 512, 3] uvmap, but in Figure 2 of the paper, the output's height and width is not be equal, so what's the output of the texture GAN? And how can the output uvmaps correspond to the 3D vertices so that the colors can be reprojected?

Looking forward to your reply. Thank you so much!

A problem about paper

Hello! I 've read your paper and tried to reproduce your texture generation network with some other dataset(NJU dataset). After training, the generation network is able to produce reasonable results. However, when I try to integrate the network to the optimization pipeline, I find that it's very hard to control the quality of the generated texture since there's no direct constrain on the texture or the latent code. Have you encountered the same problem before? And do you have any idea about how to maintain the generated texture in good quality?

unable to reproduce the result

I am struggle to reproduce the result proposed in the paper.
While in practice, I found the GAN does not work in fact.

I really can not understand what's the purpose of this github as it can offer nothing benifical to the community.

The uv format of GANFIT

Hi, thanks for your work and all the implementation details you shared in the GitHub issue :)

I find lots of follow-up works are built on top of GANFIT, including AvatarMe, AvatarMe++, and FitMe. Are the 3DMM used by these methods share the same topology and UV parameterization as GANFIT? I see the template.obj on the project page of GANFIT, is this the template mesh used by GANFIT and its follow-ups (AvatarMe, AvatarMe++, and FitMe)? Is the this file the uv parameterization of template.obj?

Thanks in advance.

About images of MOFA-test dataset

Hi Baris, thanks for your impressive work. Currently I notice that some works would like to perform evaluation on MOFA-test dataset, mainly on the 7 images showed in GANfit. However, I struggle to find the source of these images. If possible, could you please share these 7 images to me, or tell me where I can download them? Many thanks to your help.

How to get the ground truth and template landmarks

Thanks for sharing the evaluation code. I am trying to evaluate some other ground truth datasets like face warehouse. Just wondering how to manually annotate the template mesh? Is there any tool available for that? Also, it will be helpful if you could provide a sample of how you have generated the landmark files for the ground truths as the ground truth dataset does not have any landmarks provided on it.

About the dataset

Hi @barisgecer, thanks for your brilliant work.

In the paper, you use the Large Scale Face Model for 3DMM shape model and the 4DFAB database.
I want to reproduce this paper, but I can not get access to these two datasets, would you please help me how I can get them?

I am looking forward to your reply!

Best regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.