Git Product home page Git Product logo

multiview-3dmm-fitting's Introduction

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.

multiview-3dmm-fitting's People

Contributors

yuelangx avatar

Stargazers

Claus Steinmassl avatar Zidu Wang avatar 隐约雷鸣 avatar Haoqi Zeng avatar Xueting Yang avatar Yuxuan Han avatar  avatar  avatar RIA avatar chiehwangs avatar Kaiqiang Xiong avatar Ramazan avatar  avatar blacksino avatar ZZSSCC  avatar zhangyubing avatar Ye Yukang avatar Eric-chuan avatar Berna Kabadayı avatar Shenhan Qian avatar  avatar  avatar 某科学的苏打汽水 avatar zhxsking avatar Zixing Zhao avatar WanChao avatar  avatar Qingyao avatar  avatar Aleksey Pshenichniy avatar Tianze Shi avatar  avatar Pupa avatar  avatar Mitchell Mosure avatar  avatar  avatar QiulinW avatar Cheng-Bin Jin avatar conallwang avatar Doron Adler avatar Sergey Prokudin avatar Lu Ming avatar  avatar  avatar Wojciech Zielonka avatar Snow avatar Xiyi Chen avatar  avatar  avatar zhang avatar Jiawei Lu avatar yuzy avatar Chen avatar Zhenhui Ye avatar  avatar Francisco Vicente Carrasco avatar  avatar  avatar SeungJun Moon avatar  avatar llcc avatar Lovemefan avatar 个人公众号 Hypochondira avatar YiChenCityU avatar

Watchers

PeterZs avatar Snow avatar 个人公众号 Hypochondira avatar  avatar  avatar

multiview-3dmm-fitting's Issues

About Visualization

Hi @YuelangX , I successfully get fitting results from videos, but I have difficulty in visualization.
How to get visualization results like gifs/ .
Vertices can be exported to mesh and view in external Viewer, but how to project with a camera to get a mask with actual positon in image like your results?

Thank you!

Training Time

I want to know how long does this line of code take to execute?
python fitting.py --config config/NeRSemble_031.yaml

what FLAME version did you use?

Thanks for the work and code release!
I tested it on a custom multi-view dataset with ground truth camera parameters. Using the BFM model, I am able to get desired results, but using FLAME 2020 (with the same camera parameters and landmarks), the resulted mesh looks very distorted.
BFM result:
vis_1_bfm
FLAME result:
vis_1_flame

I wonder if you used a different FLAME version. I also tried 2019 but it's also not working.

About Fitting on New Datasets

Hi Yuelang.

I followed the instructions and obtained identical results on NeRSemble, but when I tried it on MEAD, the loss starts at around 750 and never converg.

The preprocess on these two datasets is same, expect the camera params, I got them from colmap (but the cam params in NeRSemble is also from colmap).

And I have checked the lmds from step 1, seems alright. However, the fitting cannot work. Do you have any idea on that?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.