Skip to main content

3D face reconstruction from a single image

Project description

Unrestricted Facial Geometry Reconstruction Using Image-to-Image Translation - Official PyTorch Implementation

Binder PyPI version License: MIT

[Arxiv] [Video]

Evaluation code for Unrestricted Facial Geometry Reconstruction Using Image-to-Image Translation. Finally ported to PyTorch!

Recent Updates

2020.10.27: Added STL support

2020.05.07: Added a wheel package!

2020.05.06: Added myBinder version for quick testing of the model

2020.04.30: Initial pyTorch release

What's in this release?

The original pix2vertex repo was composed of three parts

  • A network to perform the image to depth + correspondence maps trained on synthetic facial data
  • A non-rigid ICP scheme for converting the output maps to a full 3D Mesh
  • A shape-from-shading scheme for adding fine mesoscopic details

This repo currently contains our image-to-image network with weights and model to PyTorch and a simple python postprocessing scheme.

  • The released network was trained on a combination of synthetic images and unlabeled real images for some extra robustness :)


Installation from PyPi

    $ pip install pix2vertex

Installation from source

    $ git clone
    $ cd pix2vertex.pytorch
    $ python install


The quickest way to try p2v is using the reconstruct method over an input image, followed by visualization or STL creation.

 import pix2vertex as p2v
 from imageio import imread

 image = imread(<some image file>)
 result, crop = p2v.reconstruct(image)

# Interactive visualization in a notebook

# Static visualization using matplotlib
p2v.vis_depth_matplotlib(crop, result['Z_surface'])

# Export to STL
p2v.save2stl(result['Z_surface'], 'res.stl')

For a more complete example see the reconstruct_pipeline notebook. You can give it a try without any installations using our binder port.

Pretrained Model

Models can be downloaded from these links:

If no model path is specified the package automagically downloads the required models.


  • <input type="checkbox" checked="" disabled="" /> Port Torch model to PyTorch
  • <input type="checkbox" checked="" disabled="" /> Release an inference notebook (using K3D)
  • <input type="checkbox" checked="" disabled="" /> Add requirements
  • <input type="checkbox" checked="" disabled="" /> Pack as wheel
  • <input type="checkbox" checked="" disabled="" /> Ported to MyBinder
  • <input type="checkbox" checked="" disabled="" /> Add a simple method to export a stl file for printing
  • <input type="checkbox" disabled="" /> Port the Shape-from-Shading method used in our matlab paper
  • <input type="checkbox" disabled="" /> Write a short blog about the revised training scheme


If you use this code for your research, please cite our paper Unrestricted Facial Geometry Reconstruction Using Image-to-Image Translation:

  title={Unrestricted Facial Geometry Reconstruction Using Image-to-Image Translation},
  author={Sela, Matan and Richardson, Elad and Kimmel, Ron},

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pix2vertex, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size pix2vertex-1.0.4-py3-none-any.whl (13.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pix2vertex-1.0.4.tar.gz (14.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page