This repository is the official implementation of CGS-GAN 3D Consistent Gaussian Splatting GANs for High Resolution Human Head Synthesis.
Clone the repository. Use the single branch tag to avoid loading the large project page:
git clone https://github.com/fraunhoferhhi/cgs-gan.git --single-branchInstall the conda environment and load the Gaussian splatting renderer:
Change the line pytorch-cuda=11.8 in environment.yml to the installed cuda version on your machine. Otherwise diff-gaussian-rasterization fails to install.
Any version >=11.8 should work.
conda env create -f environment.yml
conda activate cgsgan
git clone --recursive https://github.com/ashawkey/diff-gaussian-rasterization
pip install ./diff-gaussian-rasterizationTo enable logging with wandb, use wandb login before the first time you launch the training.
wandb loginTo train our models run:
# Train with FFHQC
# 256
python train.py --data=path/FFHQC/256
# 512
python train.py --data=path/FFHQC/512
# 1024
python train.py --data=path/FFHQC/1024
# 2048
python train.py --data=path/FFHQC/2048
# Train with vanilla FFHQ
python train.py --data=path/FFHQ/512 --cam_sample_mode=ffhq_defaultFurther optional parameters are:
--gamma = 1.0R1 regularization weight--gpus = 4training with multiple GPUs--batch_gpu = 8split the training batchsize of 32 into smaller batches >=4--use_multivew_reg = Trueactivate / deactivate multiview regularization--num_multiview = 4number of views per multiview regularization step--desc = new_experimentname your run so that you find it in wandb
Load Checkpoint:
--resume = path/to/network.pklresume the training from a network checkpoint--resume_kimg = 5000continue counting from the loaded checkpoint
Evaluate the checkpoint using FID and FID3D. Select the respective data path for the matching resolution.
# FID 50k
python calc_metrics.py --network path/to/network.pkl --data data/FFHQC/512 --metrics fid50k_full
# FID_3D 50k
python calc_metrics.py --network path/to/network.pkl --data data/FFHQC/512 --metrics fid3d_50k_fullYou can download the FFHQC dataset here:
This will download the entire FFHQ dataset with the new cropping and in high resolutions. The dataset filtering happens in this json file, which tells the training which image should be used during training. Some of the indices in the json file appear multiple times. This is because of our smile and pose rebalancing strategy that reduces view-dependend artifacts and improves the quality for steep viewing angles.
Our data preprocessing uses Insightface for keypoint detection, 3DDFA_v2 3D for camera estimation and MODNet for background masking.
The full pipeline can be found here: https://github.com/Florian-Barthel/gan_preprocessing.
You can download our pretrained models here:
FFHQC
Vanilla FFHQ
Render results and save .ply files as follows:
python generate_samples.py --pkl path/to/network.pkl Optional parameters are:
--truncation_psi = 0.8tradeoff between quality and variety (0: quality and 1: variety)--num_ids = 6number of ids to generate (number of rows)--radius = 2.7radius of the camera--seed = 42--save_dir="results
Visualize our results using https://github.com/Florian-Barthel/splatviz
| FID | FFHQ 512 | FFHQC 512 | FFHQC 1024 | FFHQC 2048 |
|---|---|---|---|---|
| GSGAN | 5.02 | 5.17 | / | / |
| GGHead | 4.34 | 5.37 | 9.91 | / |
| Ours | 4.94 | 4.53 | 5.25 | 7.8 |
| FID3D | FFHQ 512 | FFHQC 512 | FFHQC 1024 | FFHQC 2048 |
|---|---|---|---|---|
| GSGAN | 10.50 | 7.68 | / | / |
| GGHead | 7.90 | 7.78 | 14.27 | / |
| Ours | 4.94 | 4.53 | 5.25 | 7.8 |
Please cite our paper when using CGS-GAN in your work.
@misc{barthel2025cgsgan,
title={CGS-GAN: 3D Consistent Gaussian Splatting GANs for High Resolution Human Head Synthesis},
author={Florian Barthel and Wieland Morgenstern and Paul Hinzer and Anna Hilsmann and Peter Eisert},
year={2025},
eprint={2505.17590},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2505.17590},
}