Dense 3D face alignment in milliseconds on a laptop CPU
Reconstructs a dense 3D face mesh from a single image in milliseconds on CPU, with enough output formats to satisfy a VFX pipeline.

What it does
3DDFA_V2 takes a single face image and regresses 3D Morphable Model parameters to reconstruct a dense mesh of over 38,000 points. It projects results back to 2D sparse or dense landmarks, estimates head pose, generates depth maps and UV textures, and serializes everything to .ply or .obj. The repo bundles the FaceBoxes detector and a lightweight C++/Cython renderer, keeping detection-to-mesh generation in one place.
The interesting bit
The authors optimized for CPU latency, not just accuracy. Switching the backbone to ONNXRuntime drops 3DMM parameter regression to roughly 1.35 ms per face on a mid-range MacBook Pro, though face detection still eats about 15 ms for a 720p frame. That split matters: in tracking mode, you can skip detection on every frame and lean on the ultra-fast regression to keep a webcam demo smooth.
Key highlights
- Dense reconstruction outputs more than 38,000 facial points, plus pose, depth, PNCC, and UV texture maps.
- ONNXRuntime support and a 0.5-width MobileNet option push CPU inference below 2 ms for the core regression step.
- Bundles a custom Cython renderer and FaceBoxes detector, replacing the older Dlib dependency.
- Ships with Colab and Gradio demos for quick browser experiments.
- Exports meshes to standard
.plyand.objformats.
Caveats
- Tracking is brittle: the authors note it relies on simple alignment and fails if the head pose exceeds 90° or motion is too fast.
- Eye landmarks suffer from training-data bias; the 300W-LP dataset contains few closed-eye images, so blinking or shut eyes look off.
- Windows builds require extra legwork for the Cython NMS and renderer components.
Verdict
Grab this if you need a lightweight, research-backed 3D face mesh for CPU-bound applications like webcam effects or head-pose estimation. Skip it if you need production-grade tracking robustness or accurate eye closure out of the box.
Frequently asked
- What is cleardusk/3DDFA_V2?
- Reconstructs a dense 3D face mesh from a single image in milliseconds on CPU, with enough output formats to satisfy a VFX pipeline.
- Is 3DDFA_V2 open source?
- Yes — cleardusk/3DDFA_V2 is open source, released under the MIT license.
- What language is 3DDFA_V2 written in?
- cleardusk/3DDFA_V2 is primarily written in Python.
- How popular is 3DDFA_V2?
- cleardusk/3DDFA_V2 has 3.1k stars on GitHub.
- Where can I find 3DDFA_V2?
- cleardusk/3DDFA_V2 is on GitHub at https://github.com/cleardusk/3DDFA_V2.