Skip to content

fraunhoferhhi/cgs-gan

Repository files navigation

CGS GAN

This repository is the official implementation of CGS-GAN 3D Consistent Gaussian Splatting GANs for High Resolution Human Head Synthesis.

alt text

Requirements

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-branch

Install 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-rasterization

Training

To enable logging with wandb, use wandb login before the first time you launch the training.

wandb login

To 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_default

Further optional parameters are:

  • --gamma = 1.0 R1 regularization weight
  • --gpus = 4 training with multiple GPUs
  • --batch_gpu = 8 split the training batchsize of 32 into smaller batches >=4
  • --use_multivew_reg = True activate / deactivate multiview regularization
  • --num_multiview = 4 number of views per multiview regularization step
  • --desc = new_experiment name your run so that you find it in wandb

Load Checkpoint:

  • --resume = path/to/network.pkl resume the training from a network checkpoint
  • --resume_kimg = 5000 continue counting from the loaded checkpoint

Evaluation

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_full

Dataset Download

You 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.

Pre-trained Models

You can download our pretrained models here:

FFHQC

Vanilla FFHQ

Run Inference

Render results and save .ply files as follows:

python generate_samples.py --pkl path/to/network.pkl 

Optional parameters are:

  • --truncation_psi = 0.8 tradeoff between quality and variety (0: quality and 1: variety)
  • --num_ids = 6 number of ids to generate (number of rows)
  • --radius = 2.7 radius of the camera
  • --seed = 42
  • --save_dir="results

Visualize

Visualize our results using https://github.com/Florian-Barthel/splatviz

Results

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

Citation

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},
}

About

Create 3DGS heads from latent vectors

Topics

Resources

License

Stars

Watchers

Forks