MCPcopy Index your code
hub / github.com/YuelangX/Multiview-3DMM-Fitting

github.com/YuelangX/Multiview-3DMM-Fitting @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
50 symbols 166 edges 13 files 6 documented · 12% updated 2y ago★ 1093 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

  • Create a conda environment.
conda env create -f environment.yaml
pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1120/download.html

BFM

  • Follow the installation of 3DMM-Fitting-Pytorch to generate "BFM09_model_info.mat" and put it into "assets/BFM/".

FaceVerse

FLAME

  • Download FLAME model and put "generic_model.pkl" into "assets/FLAME/".
  • Download the embeddings from RingNet and put "flame_dynamic_embedding.npy" and "flame_static_embedding.pkl" into "assets/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.

Core symbols most depended-on inside this repo

Shape

Method 34
Class 9
Function 7

Languages

Python100%

Modules by API surface

lib/face_models/FLAMEModule.py12 symbols
lib/face_models/FaceVerseModule.py7 symbols
lib/face_models/BFMModule.py7 symbols
lib/Camera.py5 symbols
lib/LandmarkDataset.py4 symbols
lib/Fitter.py4 symbols
config/config.py4 symbols
preprocess/preprocess_nersemble.py3 symbols
lib/Recorder.py3 symbols
lib/face_models/__init__.py1 symbols

For agents

$ claude mcp add Multiview-3DMM-Fitting \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page