← 开源
anhttran

3dmm_cnn

Regressing Robust and Discriminative 3D Morphable Models with a very Deep Neural Network

ModelsVision modelsC++
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
867
Star
246
Fork
+0
本周
4
贡献者
创建于 2017-01-26 · 更新于 2026-07-27 · 今日第 13057 名
主要开发者
iacopomasianhttranTalHassner

anhttran/3dmm_cnn 排名第 13,057,有 867 个星标。

同类别比较

anhttran/3dmm_cnn 排名第 13,057,此处有 8 个同类条目;UCSB-AI/MiniGPT-5 排名第 13,055。

同类别比较
名称排名指标
SunzeY/AlphaCLIP12,993
语言:
Jupyter Notebook
星标数:
874
分叉数:
57
简介:
[CVPR 2024] Alpha-CLIP: A CLIP Model Focusing on Wherever You Want
NVIDIA/mellotron13,031
语言:
Jupyter Notebook
星标数:
870
分叉数:
187
简介:
Mellotron: a multispeaker voice synthesis model based on Tacotron 2 GST that can make a voice emote and sing without emotive or singing training data
caiyuanhao1998/Open-DiffusionGS13,034
语言:
Python
星标数:
870
分叉数:
45
简介:
Baking Gaussian Splatting into Diffusion Denoiser for Fast and Scalable Single-stage Image-to-3D Generation and Reconstruction (ICCV 2025)
UCSB-AI/MiniGPT-513,055
语言:
Python
星标数:
867
分叉数:
52
简介:
Official implementation of paper "MiniGPT-5: Interleaved Vision-and-Language Generation via Generative Vokens"
yxuansu/PandaGPT13,070
语言:
Python
星标数:
866
分叉数:
69
简介:
[TLLM'23] PandaGPT: One Model To Instruction-Follow Them All
santi-pdp/segan13,078
语言:
Python
星标数:
865
分叉数:
280
简介:
Speech Enhancement Generative Adversarial Network in TensorFlow
xavysp/DexiNed13,082
语言:
Python
星标数:
865
分叉数:
172
简介:
DexiNed: Dense EXtreme Inception Network for Edge Detection
PKU-YuanGroup/ConsisID13,085
语言:
Python
星标数:
864
分叉数:
47
简介:
[CVPR 2025 Highlight🔥] Identity-Preserving Text-to-Video Generation by Frequency Decomposition
关键参数与规格
关键参数与规格
参数值
语言C++
类别Models
子类别Vision models
关键词3D
星标数867
分叉数246
贡献者4
创建日期2017-01-26
更新日期2026-07-27
1 天星标数0
7 天星标数0
排名13,057
上次排名12,948
排名变化-109
7 天星标排名13,739
上次 7 天星标排名13,753
7 天星标排名变化14
总星标排名12,475
上次总星标排名12,455
总星标排名变化-20
README 摘录

Python code for 3D face modeling from single image using **our very deep neural network** =========== **_New_: Please see our follow up project for deep pose and 3D expression fitting. ** This page contains end-to-end demo code that estimates the 3D facial shape and texture directly from an unconstrained 2D face image. For a given input image, it produces a standard ply file of the face shape and texture. It accompanies the deep network described in our paper [1]. We

also include demo code of pose and expression fitting from landmarks in this release. This release is part of an on-going face recognition and modeling project. Please, see **this page** for updates and more data. Features **End-to-End code** to be used for **3D shape and texture estimation** directly from image intensities Designed and tested on **face images in unconstrained conditions**, including the challenging LFW, YTF and IJB-A benchmarks The 3D face shape and texture parameters extracted

using our network were **shown for the first time to be descriminative and robust**, providing near state of the art face recognition performance with 3DMM representations on these benchmarks **No expensive, iterative optimization, inner loops** to regress the shape. 3DMM fitting is therefore extremely fast Extra code for **head pose and expression estimation from detected facial landmarks**, with the use of the regressed 3D face model Dependencies Library requirements Dlib Python and C++ library OpenCV Python and C++ library Caffe

(**version 1. 0-rc3 or above required**) Numpy Python2. 7 The code has been tested on Linux only. On Linux you can rely on the default version of python, installing all the packages needed from the package manager or on Anaconda Python and install required packages through . A bit more effort is required to install caffé, dlib, and libhdf5. Automatic Install of the Dependencies Check this useful script on the wiki by seva100 Data requirements Before running the code, please

, make sure to have all the required data in the following specific folder: **Download our CNN** and move the CNN model (3 files: , , ) into the folder **Download the Basel Face Model** and move into the folder **Acquire 3DDFA Expression Model**, run its code to generate and move this file the folder Go into folder. **Download dlib face prediction model** and move the file into the folder. Installation (pose & expression fitting code) Install **cmake**: Install **opencv** (2. 6 or higher is

recommended): Install **libboost** (1. 5 or higher is recommended): Install **OpenGL, freeglut, and glew** Install **libhdf5-dev** library Install **Dlib C++ library**. Dlib should be compiled to shared objects. Update Dlib directory paths ( and ) in Make build directory (temporary). Make & install to bin folder This code should generate in folder Usage 3DMM fitting on a set of input images Go into folder. The demo script can be used from the command line with the following syntax: where the parameters are

the following: is a text file containing the paths to each of the input images, one in each line. is

常见问题

记录了多少星标和分叉?

anhttran/3dmm_cnn 有 867 个星标和 246 个分叉。

仓库排名是多少?

anhttran/3dmm_cnn 排名第 13,057。

记录的语言和类别是什么?

anhttran/3dmm_cnn 有 867 个星标,语言为 C++,类别为 Models。

哪个仓库排名最接近?

anhttran/3dmm_cnn 与 UCSB-AI/MiniGPT-5 比较,后者排名第 13,055,有 867 个星标。

README

Python code for 3D face modeling from single image using our very deep neural network

New: Please see our follow up project for deep pose and 3D expression fitting.

This page contains end-to-end demo code that estimates the 3D facial shape and texture directly from an unconstrained 2D face image. For a given input image, it produces a standard ply file of the face shape and texture. It accompanies the deep network described in our paper [1]. We also include demo code of pose and expression fitting from landmarks in this release.

This release is part of an on-going face recognition and modeling project. Please, see this page for updates and more data.

Features

  • End-to-End code to be used for 3D shape and texture estimation directly from image intensities
  • Designed and tested on face images in unconstrained conditions, including the challenging LFW, YTF and IJB-A benchmarks
  • The 3D face shape and texture parameters extracted using our network were shown for the first time to be descriminative and robust, providing near state of the art face recognition performance with 3DMM representations on these benchmarks
  • No expensive, iterative optimization, inner loops to regress the shape. 3DMM fitting is therefore extremely fast
  • Extra code for head pose and expression estimation from detected facial landmarks, with the use of the regressed 3D face model

Dependencies

Library requirements

The code has been tested on Linux only. On Linux you can rely on the default version of python, installing all the packages needed from the package manager or on Anaconda Python and install required packages through conda. A bit more effort is required to install caffé, dlib, and libhdf5.

Automatic Install of the Dependencies

Check this useful script on the wiki by seva100

Data requirements

Before running the code, please, make sure to have all the required data in the following specific folder:

  • Download our CNN and move the CNN model (3 files: 3dmm_cnn_resnet_101.caffemodel,deploy_network.prototxt,mean.binaryproto) into the CNN folder
  • Download the Basel Face Model and move 01_MorphableModel.mat into the 3DMM_model folder
  • Acquire 3DDFA Expression Model, run its code to generate Model_Expression.mat and move this file the 3DMM_model folder
  • Go into 3DMM_model folder. Run the script python trimBaselFace.py. This should output 2 files BaselFaceModel_mod.mat and BaselFaceModel_mod.h5.
  • Download dlib face prediction model and move the .dat file into the dlib_model folder.

Installation (pose & expression fitting code)

  • Install cmake:
	apt-get install cmake
  • Install opencv (2.4.6 or higher is recommended):
	(http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html)
  • Install libboost (1.5 or higher is recommended):
	apt-get install libboost-all-dev
  • Install OpenGL, freeglut, and glew
	sudo apt-get install freeglut3-dev
	sudo apt-get install libglew-dev
  • Install libhdf5-dev library
	sudo apt-get install libhdf5-dev
  • Install Dlib C++ library. Dlib should be compiled to shared objects. Check the comments in its CMakeList.txt.
	(http://dlib.net/)
  • Update Dlib directory paths (DLIB_INCLUDE_DIR and DLIB_LIB_DIR) in CMakeLists.txt
  • Make build directory (temporary). Make & install to bin folder
	mkdir build
	cd build
	cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=../bin ..
	make
	make install

This code should generate TestVisualization in bin folder

Usage

3DMM fitting on a set of input images

  • Go into demoCode folder. The demo script can be used from the command line with the following syntax:
$ Usage: python testBatchModel.py    

where the parameters are the following:

  • `` is a text file containing the paths to each of the input images, one in each line.
  • `` is the path to the output directory, where ply files are stored.
  • tells the demo if the images need cropping (1) or not (0). Default 1. If your input image size is equal (square) and has a CASIA-like [2] bounding box, you can set as 0. Otherwise, you have to set it as 1.
  • `` is an option to refine the bounding box using detected landmarks (1) or not (0). Default 1.

Example for ``:

data/1.jpg data/2.jpg ....

  • The demo code should produce an output similar to this:
user@system:~/Desktop/3dmm_release$ python testBatchModel.py input.txt out/
> Prepare image data/1.jpg:
>     Number of faces detected: 1
> Prepare image data/2.jpg:
>     Number of faces detected: 1
> CNN Model loaded to regress 3D Shape and Texture!
> Loaded the Basel Face Model to write the 3D output!
> Processing image:  tmp_ims/2.png   2.png   1/2
> Writing 3D file in:  out//2.ply
> Processing image:  tmp_ims/1.png   1.png   2/2
> Writing 3D file in:  out//1.ply

The final 3D shape and texture can be displayed using standard off-the-shelf 3D (ply file) visualization software such as MeshLab. Using MeshLab, the output may be displayed as follows:

user@system:~/Desktop/3dmm_release$ meshlab out/1.ply

user@system:~/Desktop/3dmm_release$ meshlab out/2.ply

which should produce something similar to:

3D Face modeling + pose & expression estimation on a single input image

  • Go into demoCode folder. The demo script can be used from the command line with the following syntax:
$ Usage: python testModel_PoseExpr.py  

where the parameters are the following:

  • `` is the path to the output directory, where 3DMM (and ply) files are stored.
  • `` is an option to save the ply file (1) or not (0). Default 1.
  • The program will pop up a dialog to select an input image. Then it will estimate 3DMM paramters (with the CNN model), estimate pose+expression and visualize the result (with C++ program)

Example:

user@system:~/Desktop/3dmm_release$ python testModel_PoseExpr.py out/
(Select `Anders_Fogh_Rasmussen_0004.jpg`)
> Prepare image /home/anh/Downloads/PoseExprFromLM-master/demoCode/data/Anders_Fogh_Rasmussen_0004.jpg:
    Number of faces detected: 1
> CNN Model loaded to regress 3D Shape and Texture!
> Loaded the Basel Face Model to write the 3D output!
*****************************************
** Caffe loading    : 1.007 s
** Image cropping   : 0.069 s
** 3D Modeling      : 1.145 s
*****************************************
> Writing 3D file in:  out/Anders_Fogh_Rasmussen_0004.ply
> Pose & expression estimation
load ../3DMM_model/BaselFaceModel_mod.h5
** Pose+expr fitting: 0.153 s
** Visualization    : 0.052 s
*****************************************

The pop up window should look similar to:

Citation

If you find this work useful, please cite our paper [1] with the following bibtex:

@inproceedings{tran2017regressing,
  title={Regressing Robust and Discriminative 3D Morphable Models with a very Deep Neural Network},
  author={Tran, Anh Tuan and Hassner, Tal and Masi, Iacopo and Medioni, Gerard},
  booktitle={Computer Vision and Pattern Recognition (CVPR)},
  year={2017}
}

Troubleshooting

Problem: Old Caffe Engine

"F0210 10:49:17.604714 24046 net.cpp:797] Check failed:
target_blobs.size() == source_layer.blobs_size() (5 vs. 3) Incompatible
number of blobs for layer bn_conv1"

Solution: install caffe 1.0.0-rc3 or above.

For more info on caffe verson please see https://github.com/BVLC/caffe/releases

To check your caffe version from python:

In [3]: import caffe
In [4]: caffe.__version__
Out[4]: '1.0.0-rc3'

References

[1] A. Tran, T. Hassner, I. Masi, G. Medioni, "Regressing Robust and Discriminative 3D Morphable Models with a very Deep Neural Network", arxiv pre-print 2016

[2] Dong Yi, Zhen Lei, Shengcai Liao and Stan Z. Li, "Learning Face Representation from Scratch". arXiv preprint arXiv:1411.7923. 2014.

Changelog

  • Jan 2017, First Release

License and Disclaimer

Please, see the LICENSE here

Contacts

If you have any questions, drop an email to anhttran@usc.edu , hassner@isi.edu and iacopoma@usc.edu or leave a message below with GitHub (log-in is needed).

排名相邻
同类项目