Install 3DMM_CNN

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


Install code

<font color=red>** Follow the instructions on the github repo readme page. ↓↓↓↓↓ **</font>

<font color=green>//Green letters and comments are my own words, others are all from README.MD</font>

Data requirements

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

<font color=green>//After running the code, I only got Model_Shape.mat, but I found a Model_Expression.mat in the folder where it should be generated. It seems that this file comes with the original download. So I upload that one to the 3DMM_model folder. (Anyway, this file seems unnecessary to the demo code.)</font>

  • 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

<font color=green>If you don't have apt-get install, use yum install instead.</font>

  • Install cmake:
$ apt-get install cmake
$ #yum 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
$ #yum install boost-devel
  • Install OpenGL, freeglut, and glew
$ sudo apt-get install freeglut3-dev
$ #yum install freeglut-devel

$ sudo apt-get install libglew-dev
$ #yum install glew-devel   #not sure, may need to build from source
  • Install libhdf5-dev library
$ sudo apt-get install libhdf5-dev
$ #yum install hdf5-devel
  • Install Dlib C++ library
$ (http://dlib.net/)

<font color=green>
To get libdlib.so, do not follow the instructions on the offical website for Dlib. Use the following commands, which are originally from stackoverflow.
</font>

$ cd dlib
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

<font color=green>
libdlib.so will appear in build foler.
</font>

  • Update Dlib directory paths (DLIB_INCLUDE_DIR and DLIB_LIB_DIR) in CMakeLists.txt

<font color=green>
DLIB_INCLUDE_DIR = /path/to/dlib-19.4
DLIB_LIB_DIR = /path/to/dlib-19.4/dlib/build
</font>

  • 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 <inputList> <outputDir> <needCrop> <useLM>

where the parameters are the following:

  • <inputList> is a text file containing the paths to each of the input images, one in each line.
  • <outputDir> is the path to the output directory, where ply files are stored.
  • <needCrop> 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 <needCrop> as 0. Otherwise, you have to set it as 1.
  • <useLM> is an option to refine the bounding box using detected landmarks (1) or not (0). Default 1.

Example for <inputList>:
<pre>
data/1.jpg
data/2.jpg
....
</pre>

Other errors I have encountered

  • import caffe error: add caffe path to PYTHONPATH
$ export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
  • "xxx" is not a member of cv: add corresponding header files
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"

//my markdown doesn't support cpp :(
  • import dlib error: Go to the base folder of the dlib repository and run python setup.py install or pip install dlib. I don't know which one works.

  • libcudart.so.8.0: cannot open shared object file: No such file or directory: I failed on this. _(:3」∠)_

<font color=green>After words: I finally managed to run the demo with two servers. I generated TestVisualization on a RedHat server. But I can't run the demo code. I copied TestVisualization to a Ubuntu server, with some other preparations, it works, miraculously! </font>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末砸琅,一起剝皮案震驚了整個(gè)濱河市担租,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌空厌,老刑警劉巖塑顺,帶你破解...
    沈念sama閱讀 211,123評(píng)論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件淳附,死亡現(xiàn)場(chǎng)離奇詭異帮辟,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)龄糊,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,031評(píng)論 2 384
  • 文/潘曉璐 我一進(jìn)店門逆粹,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人炫惩,你說(shuō)我怎么就攤上這事枯饿。” “怎么了诡必?”我有些...
    開封第一講書人閱讀 156,723評(píng)論 0 345
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)搔扁。 經(jīng)常有香客問我爸舒,道長(zhǎng),這世上最難降的妖魔是什么稿蹲? 我笑而不...
    開封第一講書人閱讀 56,357評(píng)論 1 283
  • 正文 為了忘掉前任扭勉,我火速辦了婚禮,結(jié)果婚禮上苛聘,老公的妹妹穿的比我還像新娘涂炎。我一直安慰自己,他們只是感情好设哗,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,412評(píng)論 5 384
  • 文/花漫 我一把揭開白布唱捣。 她就那樣靜靜地躺著,像睡著了一般网梢。 火紅的嫁衣襯著肌膚如雪震缭。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,760評(píng)論 1 289
  • 那天战虏,我揣著相機(jī)與錄音拣宰,去河邊找鬼。 笑死,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的姐刁。 我是一名探鬼主播导街,決...
    沈念sama閱讀 38,904評(píng)論 3 405
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼航棱!你這毒婦竟也來(lái)了骇两?” 一聲冷哼從身側(cè)響起态贤,我...
    開封第一講書人閱讀 37,672評(píng)論 0 266
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤气笙,失蹤者是張志新(化名)和其女友劉穎次企,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體潜圃,經(jīng)...
    沈念sama閱讀 44,118評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡缸棵,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,456評(píng)論 2 325
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了谭期。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片堵第。...
    茶點(diǎn)故事閱讀 38,599評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖隧出,靈堂內(nèi)的尸體忽然破棺而出踏志,到底是詐尸還是另有隱情,我是刑警寧澤胀瞪,帶...
    沈念sama閱讀 34,264評(píng)論 4 328
  • 正文 年R本政府宣布针余,位于F島的核電站,受9級(jí)特大地震影響凄诞,放射性物質(zhì)發(fā)生泄漏圆雁。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,857評(píng)論 3 312
  • 文/蒙蒙 一帆谍、第九天 我趴在偏房一處隱蔽的房頂上張望伪朽。 院中可真熱鬧,春花似錦汛蝙、人聲如沸烈涮。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,731評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)坚洽。三九已至,卻和暖如春西土,著一層夾襖步出監(jiān)牢的瞬間酪术,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,956評(píng)論 1 264
  • 我被黑心中介騙來(lái)泰國(guó)打工翠储, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留绘雁,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 46,286評(píng)論 2 360
  • 正文 我出身青樓援所,卻偏偏與公主長(zhǎng)得像庐舟,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子住拭,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,465評(píng)論 2 348

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,308評(píng)論 0 10
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的閱讀 13,441評(píng)論 5 6
  • 他媽的挪略,為什么历帚,我什么我盧屹就該經(jīng)歷這些,磨難的最后是什么杠娱,媽蛋的還是失敗挽牢,為什么?
    盧屹閱讀 234評(píng)論 2 1
  • “那不是夢(mèng),是真實(shí)的室叉《闷埽” 我不信 你說(shuō)的我都不信 只有父親在說(shuō):“我曉得了,都是真的茧痕∫袄矗” “那真的不是夢(mèng),是真的踪旷。...
    知識(shí)分享閱讀 376評(píng)論 0 1
  • 焙源道曼氛,自主創(chuàng)旨在打造出更健康,更天然令野,更美味的產(chǎn)品舀患,面包的誘惑,法式甜品的顏值彩掐,咖啡的香氣,簡(jiǎn)餐的食欲灰追,總有一款...
    焙源道閱讀 503評(píng)論 0 0