yfeng95 / PRNet

Joint 3D Face Reconstruction and Dense Alignment with Position Map Regression Network (ECCV 2018)
http://openaccess.thecvf.com/content_ECCV_2018/papers/Yao_Feng_Joint_3D_Face_ECCV_2018_paper.pdf
MIT License
4.96k stars 945 forks source link

Improve depth map rasterization time #195

Open gfickel opened 4 years ago

gfickel commented 4 years ago

The main point of this PR is to greatly improve the runtime of depth map rasterization. It is currently written on Python and this PR takes only the hot loop and codes it in C++.

The main guiding points here: 1 - Don't break compatibility. Every user of PRNet should be using the code in the same way, without installing any additional dependency or doing extra steps. So the code will gracefully fallback to the original Python code if the user do not compile the C++ code. 2 - Easy to use. The compilation step is quite simple, and a build.sh script is available for Unix users. Also the required dependencies to compile are a C++ compiler and cmake to make life easier on different OSes. So no additional libs or tools are required. 3 - Touch the minimal amount of code so that the debugging and maintenance process stays as much as possible on Python. 4 - Must be quite fast. For a 250x250 image, the runtime went from 2376ms to 2.152ms on a i7-8700K. Notice that no threads o parallel computing was used, it was just a plain conversion from the Python code to C++.

I've noticed that there is a cython implementation, however it is on another repo, and it may be hard to setup for people that do not have any cython knowledge.

On a side note, amazing work on PRNet! :D