YuelangX / Multiview-3DMM-Fitting

Fitting 3DMM models to multiview (monocular) video data.
MIT License
59 stars 10 forks source link

3DMM Fitting for Multiview (monocular) Videos

This is a very fast offline fitting framework, which uses only landmarks. Currently commonly used 3DMM models: BFM, FaceVerse and FLAME are supported.

demo demo

More results are in "gifs/".

Installation

Requirements

BFM

FaceVerse

FLAME

Datasets

Make the dataset according to the following directory structure:

data_root
│   └── images
│   │   └── {frame_0}
|   |   |   └── image_{camera_id_0}.jpg
|   |   |   └── image_{camera_id_1}.jpg
|   |   |   └── ...
│   │   └── {frame_1}
|   |   |   └── image_{camera_id_0}.jpg
|   |   |   └── image_{camera_id_1}.jpg
|   |   |   └── ...
|   |   └── ...
│   └── cameras
│   │   └── {frame_0}
|   |   |   └── camera_{camera_id_0}.npz
|   |   |   └── camera_{camera_id_1}.npz
|   |   |   └── ...
│   │   └── {frame_1}
|   |   |   └── camera_{camera_id_0}.npz
|   |   |   └── camera_{camera_id_1}.npz
|   |   |   └── ...
|   |   └── ...

I provide a script "preprocess/preprocess_monocular_video.py" for preprocessing NeRSemble dataset to such a structured dataset. Please apply to download it and put it into "path/to/raw_NeRSemble/".

cd preprocess
python preprocess_nersemble.py

Besides, I also provide a script "preprocess/preprocess_monocular_video.py" for converting a monocular video.

cd preprocess
python preprocess_monocular_video.py

Multiview (monocular) Fitting

First, edit the config file, for example "config/NeRSemble_031.yaml". Second, detect 2D landmarks for all the input images.

python detect_landmarks.py --config config/NeRSemble_031.yaml

Third, fit 3DMM model.

python fitting.py --config config/NeRSemble_031.yaml

Acknowledgement

Part of the code is borrowed from FLAME_PyTorch.