Giter Site home page Giter Site logo

sunshinewhy / prnet-pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reshow/prnet-pytorch

0.0 0.0 0.0 2.38 MB

The training and evaluation code for PRNet (《Joint 3D Face Reconstruction and Dense Alignment with Position Map Regression Network》)

Python 90.08% C++ 9.92%

prnet-pytorch's Introduction

PRN

Notice

This repository is only a re-implementation of 《Joint 3D Face Reconstruction and Dense Alignment with Position Map Regression Network》. If you use this code, please observe the license of PRNet and 3DDFA. Please make sure that this code is only used for research and non-commercial purposes. I hope this re-implementation can help you.

Requirements:

python 3.6.9
opencv-python 4.1
pillow 6.1
pyrender 0.1.32
pytorch 1.1.0
scikit-image 0.15.0
scikit-learn 0.21.3
scipy 1.3.1
tensorboard 2.0.0
torchvision 0.3.0

Getting started

Please refer to face3d to prepare BFM data. And move the generated files in Out/ to data/Out/ (Thanks for their opensource code. The codes in faceutil are mainly from face3d)

Download databases from 3DDFA. Put the raw dataset in data/images (e.g. data/images/AFLW2000)

Run processor.py to generate UV position maps. I recommend you to use the following instructions:

python processor.py -i=data/images/AFLW2000 -o=data/images/AFLW2000-crop -f=True -v=True --isOldKpt=True
python processor.py -i=data/images/300W_LP -o=data/images/300W_LP-crop --thread=16

It takes about 2-4 hours depending on your working machine.

Trian PRNet:

python torchrun.py -train=True -test=False --batchSize=16 -td=data/images/300W_LP-crop -vd=data/images/AFLW2000 --numWorker=1

If you have more than 128 GB RAM, you can use

python torchrun.py -train=True -test=False --batchSize=16 -td=data/images/300W_LP-crop -vd=data/images/AFLW2000 --isPreRead=True --numWorker=8

For multi-gpus, for example 4 gpus, you can set:

--gpu=4 --visibleDevice=0,1,2,3

Evaluation, use your own model path, for example:

python torchrun.py -train=False -test=True -pd=data/images/AFLW2000 --loadModelPath=savedmodel/temp_best_model/2019-11-18-12-34-19/best.pth

A pre-trained model is provided at here

Result examples:

Alt text Alt text Alt text

prnet-pytorch's People

Contributors

reshow avatar

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.