MCPcopy Create free account
hub / github.com/apple/ml-facelit

github.com/apple/ml-facelit @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
527 symbols 1,485 edges 61 files ⚖ custom 104 documented · 20% updated 3y ago★ 482

Browse by type

Functions 451 Types & classes 71 Endpoints 5
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

FaceLit: Neural 3D Relightable Faces

This is the official repository of

Anurag Ranjan, Kwang Moo Yi, Rick Chang, Oncel Tuzel, FaceLit: Neural 3D Relightable Faces. CVPR 2023

arxiv webpage

https://user-images.githubusercontent.com/14334441/229917229-ab587c29-7250-46ab-9f42-12b52bb141de.mp4

Setup

conda create -f facelit/enviroment.yml
conda activate facelit

Demo

Download pretrained models

bash download_models.sh

Generate video demos.

python gen_videos.py --outdir=out --trunc=0.7 --seeds=0-3 --grid=2x2 --network=pretrained/NETWORK.pkl --light_cond=True --entangle=[camera, light, lightcam, specular, specularcam]

Training

Train with a neural rendering resolution of 64x64

python train.py --outdir==out --cfg=ffhq --data=DATA_DIR --gpus=8 --batch=32 --gamma=1 --gen_pose_cond=True --gen_light_cond=True --light_mode=[diffuse, full] --normal_reg_weight=1e-4 --neural_rendering_resolution_final=64

Fine tune with a neural rendering resolution of 128x128

python train.py --outdir==out --cfg=ffhq --data=DATA_DIR --gpus=8 --batch=32 --gamma=1 --gen_pose_cond=True --gen_light_cond=True --light_mode=[diffuse, full] --normal_reg_weight=1e-4 --neural_rendering_resolution_final=128 --resume=pretrained/NETWORK.pkl

Data Preprocessing

We use the dataset from EG3D and obtain camera parameters and illumination parameters using DECA.

Setting up DECA

git clone https://github.com/YadiraF/DECA.git
cd DECA
git checkout 022ed52
bash install_conda.sh
conda activate deca-env
bash fetch_data.sh

Apply our patch

git apply FACELIT_DIR/third_party/deca.patch

To generate deca fits, run generate_deca_fits.sh.

Evaluation

Evaluation of models requires setting up DECA (see here) and setting up Deep3DFaceRecon (see below).

Setting up Deep3DFaceRecon

Use this fork to set up Deep3DFaceRecon_pytorch.

git clone https://github.com/Xiaoming-Zhao/Deep3DFaceRecon_pytorch

To run the evaluation, run eval_metrics.sh. Note that due to randomness in the generation process, the metrics reported might vary by ±2%.

Citation

@inproceedings{ranjan2023,
  author = {Anurag Ranjan and Kwang Moo Yi and Rick Chang and Oncel Tuzel},
  title = {FaceLit: Neural 3D Relightable Faces},
  booktitle = {Proceedings of the IEEE conference on computer vision and pattern recognition},
  year = {2023}
}

Acknowledgements

This code is based on EG3D, we thank the authors for their github contribution. We also use portions of the code from GMPI.

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 236
Method 215
Class 71
Route 5

Languages

Python97%
C++3%

Modules by API surface

facelit/training/networks_stylegan2.py50 symbols
facelit/training/dataset.py31 symbols
facelit/dnnlib/util.py31 symbols
facelit/training/networks_stylegan3.py25 symbols
facelit/metrics/metric_utils.py22 symbols
facelit/dataset_tool.py21 symbols
facelit/training/superresolution.py19 symbols
facelit/training/triplane.py17 symbols
facelit/training/dual_discriminator.py17 symbols
facelit/torch_utils/misc.py17 symbols
facelit/light_utils.py17 symbols
facelit/metrics/metric_main.py16 symbols

For agents

$ claude mcp add ml-facelit \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page