Go to file
2025-02-18 00:57:00 +08:00
.cursor/rules Update 2025-02-15 14:31:02 +08:00
ext/diff_gaussian_rasterization_hair GaussianHaircut 2025-02-14 00:44:47 +08:00
src GaussianHaircut 2025-02-14 00:44:47 +08:00
.cursorignore Update 2025-02-14 01:00:32 +08:00
.gitattributes Update 2025-02-14 01:00:32 +08:00
.gitignore Update .gitignore 2025-02-15 15:56:18 +08:00
activate_gaussian_splatting_hair.bat update 2025-02-18 00:46:10 +08:00
activate_matte_anything.bat update 2025-02-18 00:46:10 +08:00
activate_openpose.bat update 2025-02-18 00:46:10 +08:00
activate_pixie-env.bat update 2025-02-18 00:46:10 +08:00
download_resource.bat Update download_resource.bat 2025-02-18 00:57:00 +08:00
environment.yml GaussianHaircut 2025-02-14 00:44:47 +08:00
install.bat Update 2025-02-18 00:54:47 +08:00
install.sh GaussianHaircut 2025-02-14 00:44:47 +08:00
LICENSE.md GaussianHaircut 2025-02-14 00:44:47 +08:00
micromamba.exe Update 2025-02-14 01:00:32 +08:00
README_CN.md Update 2025-02-17 08:44:22 +08:00
README.md Update 2025-02-17 08:31:59 +08:00
requirements_matte.txt Update 2025-02-18 00:54:47 +08:00
requirements_openpose.txt Update 2025-02-18 00:54:47 +08:00
requirements_pixie.txt Update 2025-02-18 00:54:47 +08:00
requirements.txt Update 2025-02-18 00:54:47 +08:00
run.bat Update 2025-02-16 22:40:27 +08:00
run.sh GaussianHaircut 2025-02-14 00:44:47 +08:00

Gaussian Haircut: Human Hair Reconstruction with Strand-Aligned 3D Gaussians

中文 | English

This repository contains the official implementation of Gaussian Haircut, a strand-based human hair reconstruction method from monocular video.

Paper | Project Page

Overview

The reconstruction process includes the following main stages:

  1. Preprocessing Stage

    • Video frame extraction and organization
    • COLMAP camera reconstruction
    • Hair and body segmentation
    • Image quality assessment and filtering
    • Orientation map calculation
    • Facial keypoint detection
    • FLAME head model fitting
  2. Reconstruction Stage

    • 3D Gaussian reconstruction
    • FLAME mesh fitting
    • Scene cropping and optimization
    • Hair strand reconstruction
  3. Visualization Stage

    • Export reconstructed strands
    • Blender rendering visualization
    • Generate result video

Expected output:

[your_scene_folder]/
├── raw.mp4                    # Input video
├── 3d_gaussian_splatting/     # 3D Gaussian reconstruction results
├── flame_fitting/             # FLAME head model fitting results
├── strands_reconstruction/    # Hair strand reconstruction intermediate results
├── curves_reconstruction/     # Final hair strand results
└── visualization/            # Rendering results and video

Required resource structure:

resource/
├── NeuralHaircut/
│   ├── pretrained_models/
│   │   ├── diffusion_prior/
│   │   │   └── dif_ckpt.pt          # Diffusion prior model
│   │   └── strand_prior/
│   │       └── strand_ckpt.pt       # Strand prior model
│   └── PIXIE/
│       └── pixie_data.tar.gz        # PIXIE model data archive
├── Matte-Anything/
│   └── pretrained/
│       └── ViTMatte_B_DIS.pth       # Matte-Anything model
├── openpose/
│   └── models/
│       └── models.tar.gz            # OpenPose model archive
└── hyperIQA/
    └── pretrained/
        └── koniq_pretrained.pkl     # Image quality assessment model

Getting Started

Linux Platform

  1. Install CUDA 11.8

    Follow instructions at https://developer.nvidia.com/cuda-11-8-0-download-archive

    Make sure:

    • PATH includes <CUDA_DIR>/bin
    • LD_LIBRARY_PATH includes <CUDA_DIR>/lib64

    The environment was tested only with this CUDA version.

  2. Install Blender 3.6 for strand visualization

    Follow instructions at https://www.blender.org/download/lts/3-6

  3. Clone repository and run installation script

    git clone git@github.com:eth-ait/GaussianHaircut.git
    cd GaussianHaircut
    chmod +x ./install.sh
    ./install.sh
    

Windows Platform

  1. Install CUDA 11.8

  2. Install Blender 3.6

  3. Install Visual Studio 2019 Build Tools

  4. Install COLMAP

    • Download from https://github.com/colmap/colmap/releases
    • Download CUDA version of COLMAP (e.g., COLMAP-3.8-windows-cuda.zip)
    • Extract to a path without spaces (e.g., C:\COLMAP)
    • Add COLMAP directory to system PATH:
      1. Open "System Properties" > "Environment Variables"
      2. Under "System Variables", find "Path"
      3. Click "Edit" > "New"
      4. Add COLMAP directory path
      5. Click "OK" to save
    • Restart terminal for PATH changes to take effect
  5. Install 7-Zip

    • Download and install from https://7-zip.org/
    • Add 7-Zip installation directory to system PATH:
      1. Open "System Properties" > "Environment Variables"
      2. Under "System Variables", find "Path"
      3. Click "Edit" > "New"
      4. Add 7-Zip installation directory (default: C:\Program Files\7-Zip)
      5. Click "OK" to save
    • Restart terminal for PATH changes to take effect
  6. Download pre-trained models and resources

    git clone https://github.com/Jeffreytsai1004/GaussianHairCut
    cd GaussianHairCut
    # Run in PowerShell:
    # The script will automatically install gdown and download required resources
    .\download_resource.bat
    

    Note:

    • Download time varies from minutes to tens of minutes depending on network speed
    • If download fails, you can rerun the script
    • Ensure stable network connection
  7. Clone repository and run installation script

    git clone https://github.com/Jeffreytsai1004/GaussianHairCut
    cd GaussianHairCut
    # First download required resources
    .\download_resource.bat
    # Run installation script
    .\install.bat
    # Run reconstruction script
    .\run.bat
    

Usage

  1. Record Monocular Video

    • Reference example videos on the project page
    • Recording requirements:
      • Subject should rotate head slowly to capture all angles
      • Keep hair and face clearly visible
      • Avoid motion blur from fast movements
      • Maintain stable lighting conditions
      • Recommended length: 10-20 seconds
      • Recommended resolution: 1920x1080 or higher
  2. Setup Scene Directory

    # In CMD:
    set PROJECT_DIR=[path\to\]GaussianHaircut
    set DATA_PATH=[path\to\scene\folder]
    run.bat
    
    # Or in PowerShell:
    $env:PROJECT_DIR="[path\to\]GaussianHaircut"
    $env:DATA_PATH="[path\to\scene\folder]"
    .\run.bat
    

    Note:

    • DATA_PATH should point to directory containing raw.mp4
    • Directory paths should not contain spaces or special characters
    • Ensure sufficient disk space (at least 20GB recommended)

License

This code is based on the 3D Gaussian Splatting project. See LICENSE_3DGS for terms and conditions. The rest of the code is distributed under CC BY-NC-SA 4.0.

Citation

If you find this code helpful for your research, please cite our paper:

@inproceedings{zakharov2024gh,
   title = {Human Hair Reconstruction with Strand-Aligned 3D Gaussians},
   author = {Zakharov, Egor and Sklyarova, Vanessa and Black, Michael J and Nam, Giljoo and Thies, Justus and Hilliges, Otmar},
   booktitle = {European Conference of Computer Vision (ECCV)},
   year = {2024}
}