Skip to content

rohit7044/3DGANTex

Repository files navigation

3D Face Reconstruction with StyleGAN3-based Multi-View Images and 3DDFA based Mesh Generation


3D model generation from a single image is a challenging task due to the lack of texture information and limited training data. This model proposes a novel approach for texture estimation from a single image using a generative adversarial network (StyleGAN3) and 3D Dense Face Alignment (3DDFA). The method begins by generating multi-view faces using the latent space of StyleGAN3 using Restyle encoder. Then 3DDFA generate a high-resolution texture map and map it to 3D model that is consistent with the estimated face shape.

GitHub license Maintenance

workflow

Requirements

  1. Ubuntu 22.04
  2. Python 3.8
  3. PyTorch(2.0 works great)
  4. OpenCV
  5. Dlib
  6. Cython
  7. Cmake

StyleGAN3 Encoder

Download the pretrained encoder from the following links and keep it on pretrained_model folder

Encoder Description
ReStyle-pSp Human Faces ReStyle-pSp trained on the FFHQ dataset over the StyleGAN3 generator.
ReStyle-e4e Human Faces ReStyle-e4e trained on the FFHQ dataset over the StyleGAN3 generator.

Usage

  1. Clone the Repo:
git clone https://github.com/rohit7044/3DGANTex 
  1. Download both the pretrained models mentioned above
  2. Build the cython version of NMS, Sim3DR, and the faster mesh render on the main directory
sh ./TDDFA_build.sh
  1. Open 3D-GANTex.py and make the changes mentioned on the code inside
  2. Finally after making the changes, upon running the code you will get multi_view,texture map and 3d model and it will be saved in output_data

Special Thanks

Important Note

  1. The 3D face model has uv texture embedded but it only shows the texture on Meshlab and Open3D
  2. Weak results on images with glasses.
  3. Better to take portrait image that has only the face like the example mentioned in input_data directory.

About

3DGANTex: 3D Face Reconstruction with StyleGAN3-based Texture Synthesis from Multi-View Images

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published