This is a project reconstructing 3D face mesh from related RGB image, with the help of Basel Face Model(BFM) and soft renderer(differantiable renderer). We present a pipeline that reconstructs a human face 3D model from a single RGB image. The pipeline includes face detection, landmark detection, regression of 3DMM model parameters, and soft rendering.
- Make sure you have python3 and related pip3 installed.
- Make sure you have Anaconda3 installed.
- Run the following code to setup the environment:
conda env create -f environment.yml
source activate py3dface
- Please download our pretrained model from Google Drive.
- Please download the pretrained resnet50 model from Google Drive. and put it under folder
./checkpoints/init_model
- Please download the BFM from Google Drive. and put it as './BFM'
- Please install nvdiffrast from Github. and put it as './nvdiffrast'
- Put the model to the folder
./checkpoints/twoloss/...
- Put images you want to test with into the folder
./examples
- Run
preprocessing.ipynb
with all images you want to test with, and put all generated.txt
files (with the same name but different postfix as images) into the folder./examples/detections
. - Run:
python test.py
- Results will be stored in ./checkpoints/twoloss/examples