Update
This commit is contained in:
parent
b8c941df04
commit
500b7a50fc
22
.gitignore
vendored
22
.gitignore
vendored
@ -14,8 +14,10 @@ ext/diff_gaussian_rasterization_hair/third_party
|
||||
.vscode
|
||||
|
||||
# Executable files
|
||||
resource
|
||||
scripts
|
||||
resource
|
||||
condabin
|
||||
pkgs
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
@ -177,21 +179,3 @@ cython_debug/
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
# Project specific
|
||||
resource/
|
||||
micromamba/
|
||||
cache/
|
||||
ext/
|
||||
*.exe
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
|
||||
# Build
|
||||
build/
|
||||
dist/
|
||||
*.egg-info/
|
||||
|
320
README.md
320
README.md
@ -1,212 +1,210 @@
|
||||
# Gaussian Haircut: Human Hair Reconstruction with Strand-Aligned 3D Gaussians
|
||||
# Gaussian Haircut:使用股线对齐 3D 高斯模型进行人体头发重建
|
||||
|
||||
[**中文**](README_CN.md) | [**English**](README.md)
|
||||
[**中文**](README.md) | [**English**](README_EN.md)
|
||||
|
||||
This repository contains the official implementation of Gaussian Haircut, a strand-based human hair reconstruction method from monocular video.
|
||||
本仓库包含了 Gaussian Haircut 的官方实现,这是一种基于股线的人体头发重建方法,用于单目视频。
|
||||
|
||||
[**Paper**](https://arxiv.org/abs/2409.14778) | [**Project Page**](https://eth-ait.github.io/GaussianHaircut/)
|
||||
[**论文**](https://arxiv.org/abs/2409.14778) | [**项目页面**](https://eth-ait.github.io/GaussianHaircut/)
|
||||
|
||||
## 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
|
||||
1. **预处理阶段**
|
||||
- 视频帧提取和整理
|
||||
- COLMAP相机重建
|
||||
- 头发和身体分割
|
||||
- 图像质量评估和筛选
|
||||
- 方向图计算
|
||||
- 人脸关键点检测
|
||||
- FLAME头部模型拟合
|
||||
|
||||
2. **Reconstruction Stage**
|
||||
- 3D Gaussian reconstruction
|
||||
- FLAME mesh fitting
|
||||
- Scene cropping and optimization
|
||||
- Hair strand reconstruction
|
||||
2. **重建阶段**
|
||||
- 3D高斯体重建
|
||||
- FLAME网格拟合
|
||||
- 场景裁剪和优化
|
||||
- 头发股线重建
|
||||
|
||||
3. **Visualization Stage**
|
||||
- Export reconstructed strands
|
||||
- Blender rendering visualization
|
||||
- Generate result video
|
||||
3. **可视化阶段**
|
||||
- 导出重建的股线
|
||||
- Blender渲染可视化
|
||||
- 生成结果视频
|
||||
|
||||
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
|
||||
├── raw.mp4 # 输入视频
|
||||
├── 3d_gaussian_splatting/ # 3D高斯体重建结果
|
||||
├── flame_fitting/ # FLAME头部模型拟合结果
|
||||
├── strands_reconstruction/ # 头发股线重建中间结果
|
||||
├── curves_reconstruction/ # 最终头发股线结果
|
||||
└── visualization/ # 渲染结果和视频
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
## 目录结构
|
||||
```
|
||||
├── cache/ # Cache directory
|
||||
│ ├── gdown/ # gdown cache
|
||||
│ ├── torch/ # PyTorch cache
|
||||
│ └── huggingface/ # Hugging Face cache
|
||||
├── ext/ # External dependencies
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut repository
|
||||
│ ├── Matte-Anything/ # Matte-Anything repository
|
||||
│ ├── openpose/ # OpenPose repository
|
||||
│ ├── pytorch3d/ # PyTorch3D repository
|
||||
│ ├── simple-knn/ # Simple KNN repository
|
||||
│ ├── kaolin/ # Kaolin repository
|
||||
│ └── hyperIQA/ # HyperIQA repository
|
||||
├── resource/ # Resource files
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut models
|
||||
│ ├── Matte-Anything/ # Matte-Anything models
|
||||
│ ├── openpose/ # OpenPose models
|
||||
│ ├── PIXIE/ # PIXIE models
|
||||
│ └── hyperIQA/ # HyperIQA models
|
||||
├── src/ # Source code
|
||||
├── micromamba/ # Micromamba installation
|
||||
├── micromamba.exe # Micromamba executable
|
||||
├── install.bat # Installation script
|
||||
├── download_resource.bat # Resource download script
|
||||
└── run.bat # Execution script
|
||||
├── cache/ # 缓存目录
|
||||
│ ├── gdown/ # gdown缓存
|
||||
│ ├── torch/ # PyTorch缓存
|
||||
│ └── huggingface/ # Hugging Face缓存
|
||||
├── ext/ # 外部依赖
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut仓库
|
||||
│ ├── Matte-Anything/ # Matte-Anything仓库
|
||||
│ ├── openpose/ # OpenPose仓库
|
||||
│ ├── pytorch3d/ # PyTorch3D仓库
|
||||
│ ├── simple-knn/ # Simple KNN仓库
|
||||
│ ├── kaolin/ # Kaolin仓库
|
||||
│ └── hyperIQA/ # HyperIQA仓库
|
||||
├── resource/ # 资源文件
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut模型
|
||||
│ ├── Matte-Anything/ # Matte-Anything模型
|
||||
│ ├── openpose/ # OpenPose模型
|
||||
│ ├── PIXIE/ # PIXIE模型
|
||||
│ └── hyperIQA/ # HyperIQA模型
|
||||
├── src/ # 源代码
|
||||
├── micromamba/ # Micromamba安装目录
|
||||
├── micromamba.exe # Micromamba可执行文件
|
||||
├── install.bat # 安装脚本
|
||||
├── download_resource.bat # 资源下载脚本
|
||||
└── run.bat # 执行脚本
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
Required environment variables:
|
||||
## 环境变量
|
||||
需要设置的环境变量:
|
||||
```batch
|
||||
set "PROJECT_DIR=C:\path\to\project" # Project root directory
|
||||
set "PROJECT_DIR=C:\path\to\project" # 项目根目录
|
||||
set "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
set "BLENDER_DIR=C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
set "VS_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
## 环境配置
|
||||
|
||||
### Linux Platform
|
||||
### Linux 平台
|
||||
|
||||
1. **Install CUDA 11.8**
|
||||
1. **安装 CUDA 11.8**
|
||||
|
||||
Follow instructions at https://developer.nvidia.com/cuda-11-8-0-download-archive
|
||||
按照 https://developer.nvidia.com/cuda-11-8-0-download-archive 上的说明进行操作。
|
||||
|
||||
Make sure:
|
||||
- PATH includes <CUDA_DIR>/bin
|
||||
- LD_LIBRARY_PATH includes <CUDA_DIR>/lib64
|
||||
确保:
|
||||
- PATH 包含 <CUDA_DIR>/bin
|
||||
- LD_LIBRARY_PATH 包含 <CUDA_DIR>/lib64
|
||||
|
||||
The environment was tested only with this CUDA version.
|
||||
该环境仅在此 CUDA 版本下进行了测试。
|
||||
|
||||
2. **Install Blender 3.6** for strand visualization
|
||||
2. **安装 Blender 3.6** 以创建股线可视化
|
||||
|
||||
Follow instructions at https://www.blender.org/download/lts/3-6
|
||||
按照 https://www.blender.org/download/lts/3-6 上的说明进行操作。
|
||||
|
||||
3. **Clone repository and run installation script**
|
||||
3. **克隆仓库并运行安装脚本**
|
||||
|
||||
```bash
|
||||
git clone git@github.com:eth-ait/GaussianHaircut.git
|
||||
cd GaussianHaircut
|
||||
chmod +x ./install.sh
|
||||
./install.sh
|
||||
```
|
||||
```bash
|
||||
git clone git@github.com:eth-ait/GaussianHaircut.git
|
||||
cd GaussianHaircut
|
||||
chmod +x ./install.sh
|
||||
./install.sh
|
||||
```
|
||||
|
||||
### Windows Platform
|
||||
### Windows 平台
|
||||
|
||||
1. **Install CUDA 11.8**
|
||||
- Download and install from https://developer.nvidia.com/cuda-11-8-0-download-archive
|
||||
- Default installation path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
|
||||
- Ensure CUDA version is compatible with your system
|
||||
1. **安装 CUDA 11.8**
|
||||
- 从 https://developer.nvidia.com/cuda-11-8-0-download-archive 下载并安装
|
||||
- 默认安装路径:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
|
||||
- 确保CUDA版本与系统兼容
|
||||
|
||||
2. **Install Blender 3.6**
|
||||
- Download and install from https://www.blender.org/download/lts/3-6
|
||||
- Default installation path: C:\Program Files\Blender Foundation\Blender 3.6
|
||||
2. **安装 Blender 3.6**
|
||||
- 从 https://www.blender.org/download/lts/3-6 下载并安装
|
||||
- 默认安装路径:C:\Program Files\Blender Foundation\Blender 3.6
|
||||
|
||||
3. **Install Visual Studio 2019 Build Tools**
|
||||
- Download and install from https://visualstudio.microsoft.com/vs/older-downloads/
|
||||
- Select "C++ Build Tools" workload
|
||||
- Default installation path: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
|
||||
3. **安装 Visual Studio 2019 Build Tools**
|
||||
- 从 https://visualstudio.microsoft.com/vs/older-downloads/ 下载并安装
|
||||
- 选择"C++构建工具"工作负载
|
||||
- 默认安装路径:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
|
||||
|
||||
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
|
||||
4. **安装 COLMAP**
|
||||
- 从 https://github.com/colmap/colmap/releases 下载并安装
|
||||
- 下载CUDA版本的COLMAP (例如:COLMAP-3.8-windows-cuda.zip)
|
||||
- 解压到不含空格的路径 (例如:C:\COLMAP)
|
||||
- 将COLMAP目录添加到系统PATH:
|
||||
1. 打开"系统属性" > "环境变量"
|
||||
2. 在"系统变量"中找到"Path"
|
||||
3. 点击"编辑" > "新建"
|
||||
4. 添加COLMAP目录路径
|
||||
5. 点击"确定"保存
|
||||
- 重启终端使PATH生效
|
||||
|
||||
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
|
||||
5. **安装 7-Zip**
|
||||
- 从 https://7-zip.org/ 下载并安装
|
||||
- 将7-Zip安装目录添加到系统PATH:
|
||||
1. 打开"系统属性" > "环境变量"
|
||||
2. 在"系统变量"中找到"Path"
|
||||
3. 点击"编辑" > "新建"
|
||||
4. 添加7-Zip安装目录(默认为C:\Program Files\7-Zip)
|
||||
5. 点击"确定"保存
|
||||
- 重启终端使PATH生效
|
||||
|
||||
6. **Download pre-trained models and resources**
|
||||
6. **下载预训练模型和资源**
|
||||
```cmd
|
||||
git clone https://github.com/Jeffreytsai1004/GaussianHairCut
|
||||
cd GaussianHairCut
|
||||
# Run in PowerShell:
|
||||
# The script will automatically install gdown and download required resources
|
||||
# 在PowerShell中运行:
|
||||
# 脚本会自动安装gdown并下载所需资源
|
||||
.\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**
|
||||
```cmd
|
||||
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. **录制单目视频**
|
||||
- 参考项目页面上的示例视频
|
||||
- 录制要求:
|
||||
* 拍摄对象应缓慢转动头部,确保捕捉到所有角度
|
||||
* 保持头发和面部清晰可见
|
||||
* 避免快速移动导致的运动模糊
|
||||
* 保持光照条件稳定
|
||||
* 建议视频长度:10-20秒
|
||||
* 建议分辨率:1920x1080或更高
|
||||
注意:
|
||||
- DATA_PATH 应指向包含 raw.mp4 的目录
|
||||
- 目录路径不应包含空格或特殊字符
|
||||
- 确保有足够的磁盘空间(建议至少20GB)
|
||||
|
||||
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**
|
||||
2. **设置重建场景目录**
|
||||
- 新建一个文件夹,例如:C:\path\to\scene\folder
|
||||
- 将 raw.mp4 放入该文件夹
|
||||
|
||||
3. **运行安装和重建脚本**
|
||||
- 在 install.bat 和 run.bat 中设置环境变量 PROJECT_DIR 和 DATA_PATH
|
||||
- 例如:
|
||||
```cmd
|
||||
set "PROJECT_DIR=C:\path\to\project"
|
||||
set "DATA_PATH=C:\path\to\scene\folder"
|
||||
```
|
||||
- 在 install.bat 和 run.bat 中修改环境变量 CUDA_HOME,BLENDER_DIR,VS_DIR
|
||||
```cmd
|
||||
set "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
set "BLENDER_DIR=C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
set "VS_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
```
|
||||
- 运行安装脚本
|
||||
```cmd
|
||||
.\install.bat
|
||||
```
|
||||
- 运行重建脚本
|
||||
```cmd
|
||||
# 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.
|
||||
此代码基于 3D Gaussian Splatting 项目。有关条款和条件,请参阅 LICENSE_3DGS。其余代码根据 CC BY-NC-SA 4.0 分发。
|
||||
|
||||
## Citation
|
||||
## 引用
|
||||
|
||||
If you find this code helpful for your research, please cite our paper:
|
||||
如果此代码对您的项目有帮助,请引用以下论文:
|
||||
|
||||
```bibtex
|
||||
@inproceedings{zakharov2024gh,
|
||||
@ -217,11 +215,11 @@ If you find this code helpful for your research, please cite our paper:
|
||||
}
|
||||
```
|
||||
|
||||
## Related Projects
|
||||
## 相关项目
|
||||
|
||||
- [3D Gaussian Splatting](https://github.com/graphdeco-inria/gaussian-splatting)
|
||||
- [Neural Haircut](https://github.com/SamsungLabs/NeuralHaircut): FLAME fitting pipeline, strand prior and hairstyle diffusion prior
|
||||
- [HAAR](https://github.com/Vanessik/HAAR): Hair upsampling
|
||||
- [Matte-Anything](https://github.com/hustvl/Matte-Anything): Hair and body segmentation
|
||||
- [PIXIE](https://github.com/yfeng95/PIXIE): FLAME fitting initialization
|
||||
- [Face-Alignment](https://github.com/1adrianb/face-alignment), [OpenPose](https://github.com/CMU-Perceptual-Computing-Lab/openpose): Keypoint detection for FLAME fitting
|
||||
- [Neural Haircut](https://github.com/SamsungLabs/NeuralHaircut): FLAME 拟合管线、股线先验和发型扩散先验
|
||||
- [HAAR](https://github.com/Vanessik/HAAR): 头发上采样
|
||||
- [Matte-Anything](https://github.com/hustvl/Matte-Anything): 头发和身体分割
|
||||
- [PIXIE](https://github.com/yfeng95/PIXIE): FLAME 拟合的初始化
|
||||
- [Face-Alignment](https://github.com/1adrianb/face-alignment), [OpenPose](https://github.com/CMU-Perceptual-Computing-Lab/openpose): 用于 FLAME 拟合的关键点检测
|
221
README_CN.md
221
README_CN.md
@ -1,221 +0,0 @@
|
||||
# Gaussian Haircut:使用股线对齐 3D 高斯模型进行人体头发重建
|
||||
|
||||
[**中文**](README_CN.md) | [**English**](README.md)
|
||||
|
||||
本仓库包含了 Gaussian Haircut 的官方实现,这是一种基于股线的人体头发重建方法,用于单目视频。
|
||||
|
||||
[**论文**](https://arxiv.org/abs/2409.14778) | [**项目页面**](https://eth-ait.github.io/GaussianHaircut/)
|
||||
|
||||
## 概述
|
||||
|
||||
重建过程包括以下主要阶段:
|
||||
|
||||
1. **预处理阶段**
|
||||
- 视频帧提取和整理
|
||||
- COLMAP相机重建
|
||||
- 头发和身体分割
|
||||
- 图像质量评估和筛选
|
||||
- 方向图计算
|
||||
- 人脸关键点检测
|
||||
- FLAME头部模型拟合
|
||||
|
||||
2. **重建阶段**
|
||||
- 3D高斯体重建
|
||||
- FLAME网格拟合
|
||||
- 场景裁剪和优化
|
||||
- 头发股线重建
|
||||
|
||||
3. **可视化阶段**
|
||||
- 导出重建的股线
|
||||
- Blender渲染可视化
|
||||
- 生成结果视频
|
||||
|
||||
预期输出:
|
||||
```
|
||||
[your_scene_folder]/
|
||||
├── raw.mp4 # 输入视频
|
||||
├── 3d_gaussian_splatting/ # 3D高斯体重建结果
|
||||
├── flame_fitting/ # FLAME头部模型拟合结果
|
||||
├── strands_reconstruction/ # 头发股线重建中间结果
|
||||
├── curves_reconstruction/ # 最终头发股线结果
|
||||
└── visualization/ # 渲染结果和视频
|
||||
```
|
||||
|
||||
## 目录结构
|
||||
```
|
||||
├── cache/ # 缓存目录
|
||||
│ ├── gdown/ # gdown缓存
|
||||
│ ├── torch/ # PyTorch缓存
|
||||
│ └── huggingface/ # Hugging Face缓存
|
||||
├── ext/ # 外部依赖
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut仓库
|
||||
│ ├── Matte-Anything/ # Matte-Anything仓库
|
||||
│ ├── openpose/ # OpenPose仓库
|
||||
│ ├── pytorch3d/ # PyTorch3D仓库
|
||||
│ ├── simple-knn/ # Simple KNN仓库
|
||||
│ ├── kaolin/ # Kaolin仓库
|
||||
│ └── hyperIQA/ # HyperIQA仓库
|
||||
├── resource/ # 资源文件
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut模型
|
||||
│ ├── Matte-Anything/ # Matte-Anything模型
|
||||
│ ├── openpose/ # OpenPose模型
|
||||
│ ├── PIXIE/ # PIXIE模型
|
||||
│ └── hyperIQA/ # HyperIQA模型
|
||||
├── src/ # 源代码
|
||||
├── micromamba/ # Micromamba安装目录
|
||||
├── micromamba.exe # Micromamba可执行文件
|
||||
├── install.bat # 安装脚本
|
||||
├── download_resource.bat # 资源下载脚本
|
||||
└── run.bat # 执行脚本
|
||||
```
|
||||
|
||||
## 环境变量
|
||||
需要设置的环境变量:
|
||||
```batch
|
||||
set "PROJECT_DIR=C:\path\to\project" # 项目根目录
|
||||
set "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
set "BLENDER_DIR=C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
set "VS_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
```
|
||||
|
||||
## 环境配置
|
||||
|
||||
### Linux 平台
|
||||
|
||||
1. **安装 CUDA 11.8**
|
||||
|
||||
按照 https://developer.nvidia.com/cuda-11-8-0-download-archive 上的说明进行操作。
|
||||
|
||||
确保:
|
||||
- PATH 包含 <CUDA_DIR>/bin
|
||||
- LD_LIBRARY_PATH 包含 <CUDA_DIR>/lib64
|
||||
|
||||
该环境仅在此 CUDA 版本下进行了测试。
|
||||
|
||||
2. **安装 Blender 3.6** 以创建股线可视化
|
||||
|
||||
按照 https://www.blender.org/download/lts/3-6 上的说明进行操作。
|
||||
|
||||
3. **克隆仓库并运行安装脚本**
|
||||
|
||||
```bash
|
||||
git clone git@github.com:eth-ait/GaussianHaircut.git
|
||||
cd GaussianHaircut
|
||||
chmod +x ./install.sh
|
||||
./install.sh
|
||||
```
|
||||
|
||||
### Windows 平台
|
||||
|
||||
1. **安装 CUDA 11.8**
|
||||
- 从 https://developer.nvidia.com/cuda-11-8-0-download-archive 下载并安装
|
||||
- 默认安装路径:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
|
||||
- 确保CUDA版本与系统兼容
|
||||
|
||||
2. **安装 Blender 3.6**
|
||||
- 从 https://www.blender.org/download/lts/3-6 下载并安装
|
||||
- 默认安装路径:C:\Program Files\Blender Foundation\Blender 3.6
|
||||
|
||||
3. **安装 Visual Studio 2019 Build Tools**
|
||||
- 从 https://visualstudio.microsoft.com/vs/older-downloads/ 下载并安装
|
||||
- 选择"C++构建工具"工作负载
|
||||
- 默认安装路径:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
|
||||
|
||||
4. **安装 COLMAP**
|
||||
- 从 https://github.com/colmap/colmap/releases 下载并安装
|
||||
- 下载CUDA版本的COLMAP (例如:COLMAP-3.8-windows-cuda.zip)
|
||||
- 解压到不含空格的路径 (例如:C:\COLMAP)
|
||||
- 将COLMAP目录添加到系统PATH:
|
||||
1. 打开"系统属性" > "环境变量"
|
||||
2. 在"系统变量"中找到"Path"
|
||||
3. 点击"编辑" > "新建"
|
||||
4. 添加COLMAP目录路径
|
||||
5. 点击"确定"保存
|
||||
- 重启终端使PATH生效
|
||||
|
||||
5. **安装 7-Zip**
|
||||
- 从 https://7-zip.org/ 下载并安装
|
||||
- 将7-Zip安装目录添加到系统PATH:
|
||||
1. 打开"系统属性" > "环境变量"
|
||||
2. 在"系统变量"中找到"Path"
|
||||
3. 点击"编辑" > "新建"
|
||||
4. 添加7-Zip安装目录(默认为C:\Program Files\7-Zip)
|
||||
5. 点击"确定"保存
|
||||
- 重启终端使PATH生效
|
||||
|
||||
6. **下载预训练模型和资源**
|
||||
```cmd
|
||||
git clone https://github.com/Jeffreytsai1004/GaussianHairCut
|
||||
cd GaussianHairCut
|
||||
# 在PowerShell中运行:
|
||||
# 脚本会自动安装gdown并下载所需资源
|
||||
.\download_resource.bat
|
||||
```
|
||||
注意:
|
||||
- 下载过程可能需要几分钟到几十分钟,取决于网络速度
|
||||
- 如果下载失败,可以重新运行脚本
|
||||
- 确保有稳定的网络连接
|
||||
|
||||
7. **运行安装和重建脚本**
|
||||
```cmd
|
||||
# 运行安装脚本
|
||||
.\install.bat
|
||||
# 运行重建脚本
|
||||
.\run.bat
|
||||
```
|
||||
|
||||
## 使用说明
|
||||
|
||||
1. **录制单目视频**
|
||||
- 参考项目页面上的示例视频
|
||||
- 录制要求:
|
||||
* 拍摄对象应缓慢转动头部,确保捕捉到所有角度
|
||||
* 保持头发和面部清晰可见
|
||||
* 避免快速移动导致的运动模糊
|
||||
* 保持光照条件稳定
|
||||
* 建议视频长度:10-20秒
|
||||
* 建议分辨率:1920x1080或更高
|
||||
|
||||
2. **设置重建场景目录**
|
||||
```cmd
|
||||
# 在CMD中运行:
|
||||
set PROJECT_DIR=[path\to\]GaussianHaircut
|
||||
set DATA_PATH=[path\to\scene\folder]
|
||||
run.bat
|
||||
|
||||
# 或在PowerShell中运行:
|
||||
$env:PROJECT_DIR="[path\to\]GaussianHaircut"
|
||||
$env:DATA_PATH="[path\to\scene\folder]"
|
||||
.\run.bat
|
||||
```
|
||||
|
||||
注意:
|
||||
- DATA_PATH 应指向包含 raw.mp4 的目录
|
||||
- 目录路径不应包含空格或特殊字符
|
||||
- 确保有足够的磁盘空间(建议至少20GB)
|
||||
|
||||
## 许可证
|
||||
|
||||
此代码基于 3D Gaussian Splatting 项目。有关条款和条件,请参阅 LICENSE_3DGS。其余代码根据 CC BY-NC-SA 4.0 分发。
|
||||
|
||||
## 引用
|
||||
|
||||
如果此代码对您的项目有帮助,请引用以下论文:
|
||||
|
||||
```bibtex
|
||||
@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}
|
||||
}
|
||||
```
|
||||
|
||||
## 相关项目
|
||||
|
||||
- [3D Gaussian Splatting](https://github.com/graphdeco-inria/gaussian-splatting)
|
||||
- [Neural Haircut](https://github.com/SamsungLabs/NeuralHaircut): FLAME 拟合管线、股线先验和发型扩散先验
|
||||
- [HAAR](https://github.com/Vanessik/HAAR): 头发上采样
|
||||
- [Matte-Anything](https://github.com/hustvl/Matte-Anything): 头发和身体分割
|
||||
- [PIXIE](https://github.com/yfeng95/PIXIE): FLAME 拟合的初始化
|
||||
- [Face-Alignment](https://github.com/1adrianb/face-alignment), [OpenPose](https://github.com/CMU-Perceptual-Computing-Lab/openpose): 用于 FLAME 拟合的关键点检测
|
225
README_EN.md
Normal file
225
README_EN.md
Normal file
@ -0,0 +1,225 @@
|
||||
# Gaussian Haircut: Human Hair Reconstruction with Strand-Aligned 3D Gaussians
|
||||
|
||||
[**中文**](README.md) | [**English**](README_EN.md)
|
||||
|
||||
This repository contains the official implementation of Gaussian Haircut, a strand-based human hair reconstruction method from monocular video.
|
||||
|
||||
[**Paper**](https://arxiv.org/abs/2409.14778) | [**Project Page**](https://eth-ait.github.io/GaussianHaircut/)
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
```
|
||||
├── cache/ # Cache directory
|
||||
│ ├── gdown/ # gdown cache
|
||||
│ ├── torch/ # PyTorch cache
|
||||
│ └── huggingface/ # Hugging Face cache
|
||||
├── ext/ # External dependencies
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut repository
|
||||
│ ├── Matte-Anything/ # Matte-Anything repository
|
||||
│ ├── openpose/ # OpenPose repository
|
||||
│ ├── pytorch3d/ # PyTorch3D repository
|
||||
│ ├── simple-knn/ # Simple KNN repository
|
||||
│ ├── kaolin/ # Kaolin repository
|
||||
│ └── hyperIQA/ # HyperIQA repository
|
||||
├── resource/ # Resource files
|
||||
│ ├── NeuralHaircut/ # NeuralHaircut models
|
||||
│ ├── Matte-Anything/ # Matte-Anything models
|
||||
│ ├── openpose/ # OpenPose models
|
||||
│ ├── PIXIE/ # PIXIE models
|
||||
│ └── hyperIQA/ # HyperIQA models
|
||||
├── src/ # Source code
|
||||
├── micromamba/ # Micromamba installation
|
||||
├── micromamba.exe # Micromamba executable
|
||||
├── install.bat # Installation script
|
||||
├── download_resource.bat # Resource download script
|
||||
└── run.bat # Execution script
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
Required environment variables:
|
||||
```batch
|
||||
set "PROJECT_DIR=C:\path\to\project" # Project root directory
|
||||
set "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
set "BLENDER_DIR=C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
set "VS_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
```
|
||||
|
||||
## 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**
|
||||
|
||||
```bash
|
||||
git clone git@github.com:eth-ait/GaussianHaircut.git
|
||||
cd GaussianHaircut
|
||||
chmod +x ./install.sh
|
||||
./install.sh
|
||||
```
|
||||
|
||||
### Windows Platform
|
||||
|
||||
1. **Install CUDA 11.8**
|
||||
- Download and install from https://developer.nvidia.com/cuda-11-8-0-download-archive
|
||||
- Default installation path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
|
||||
- Ensure CUDA version is compatible with your system
|
||||
|
||||
2. **Install Blender 3.6**
|
||||
- Download and install from https://www.blender.org/download/lts/3-6
|
||||
- Default installation path: C:\Program Files\Blender Foundation\Blender 3.6
|
||||
|
||||
3. **Install Visual Studio 2019 Build Tools**
|
||||
- Download and install from https://visualstudio.microsoft.com/vs/older-downloads/
|
||||
- Select "C++ Build Tools" workload
|
||||
- Default installation path: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
|
||||
|
||||
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**
|
||||
```cmd
|
||||
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
|
||||
|
||||
## 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
|
||||
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)
|
||||
|
||||
2. **Setup Scene Directory**
|
||||
- Create a new folder, e.g., C:\path\to\scene\folder
|
||||
- Place raw.mp4 in this folder
|
||||
|
||||
3. **Run Installation and Reconstruction Scripts**
|
||||
- Set environment variables PROJECT_DIR and DATA_PATH in install.bat and run.bat
|
||||
- For example:
|
||||
```cmd
|
||||
set "PROJECT_DIR=C:\path\to\project"
|
||||
set "DATA_PATH=C:\path\to\scene\folder"
|
||||
```
|
||||
- Modify environment variables CUDA_HOME, BLENDER_DIR, VS_DIR in install.bat and run.bat
|
||||
```cmd
|
||||
set "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
set "BLENDER_DIR=C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
set "VS_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
```
|
||||
- Run installation script
|
||||
```cmd
|
||||
.\install.bat
|
||||
```
|
||||
- Run reconstruction script
|
||||
```cmd
|
||||
.\run.bat
|
||||
```
|
||||
|
||||
## 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:
|
||||
|
||||
```bibtex
|
||||
@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}
|
||||
}
|
||||
```
|
||||
|
||||
## Related Projects
|
||||
|
||||
- [3D Gaussian Splatting](https://github.com/graphdeco-inria/gaussian-splatting)
|
||||
- [Neural Haircut](https://github.com/SamsungLabs/NeuralHaircut): FLAME fitting pipeline, strand prior and hairstyle diffusion prior
|
||||
- [HAAR](https://github.com/Vanessik/HAAR): Hair upsampling
|
||||
- [Matte-Anything](https://github.com/hustvl/Matte-Anything): Hair and body segmentation
|
||||
- [PIXIE](https://github.com/yfeng95/PIXIE): FLAME fitting initialization
|
||||
- [Face-Alignment](https://github.com/1adrianb/face-alignment), [OpenPose](https://github.com/CMU-Perceptual-Computing-Lab/openpose): Keypoint detection for FLAME fitting
|
@ -1,18 +1,2 @@
|
||||
@echo off
|
||||
|
||||
REM 设置环境变量
|
||||
SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
SET PATH="%CUDA_HOME%\bin;%PATH%"
|
||||
SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
SET VS_DIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
||||
SET PROJECT_DIR=%~dp0
|
||||
SET MICROMAMBA_EXE=%~dp0micromamba.exe
|
||||
SET MAMBA_ROOT_PREFIX=%PROJECT_DIR%\micromamba
|
||||
SET PYTHONDONTWRITEBYTECODE=1
|
||||
SET GDOWN_CACHE=cache\gdown
|
||||
SET TORCH_HOME=cache\torch
|
||||
SET HF_HOME=cache\huggingface
|
||||
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
IF EXIST %VS_VCVARS% CALL %VS_VCVARS%
|
||||
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
|
||||
start cmd /k "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
|
@ -1,18 +1,2 @@
|
||||
@echo off
|
||||
|
||||
REM 设置环境变量
|
||||
SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
SET PATH="%CUDA_HOME%\bin;%PATH%"
|
||||
SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
SET VS_DIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
||||
SET PROJECT_DIR=%~dp0
|
||||
SET MICROMAMBA_EXE=%~dp0micromamba.exe
|
||||
SET MAMBA_ROOT_PREFIX=%PROJECT_DIR%\micromamba
|
||||
SET PYTHONDONTWRITEBYTECODE=1
|
||||
SET GDOWN_CACHE=cache\gdown
|
||||
SET TORCH_HOME=cache\torch
|
||||
SET HF_HOME=cache\huggingface
|
||||
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\matte_anything
|
||||
IF EXIST %VS_VCVARS% CALL %VS_VCVARS%
|
||||
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
|
||||
start cmd /k "%~dp0condabin\micromamba.bat" activate matte_anything
|
@ -1,18 +1,2 @@
|
||||
@echo off
|
||||
|
||||
REM 设置环境变量
|
||||
SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
SET PATH="%CUDA_HOME%\bin;%PATH%"
|
||||
SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
SET VS_DIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
||||
SET PROJECT_DIR=%~dp0
|
||||
SET MICROMAMBA_EXE=%~dp0micromamba.exe
|
||||
SET MAMBA_ROOT_PREFIX=%PROJECT_DIR%\micromamba
|
||||
SET PYTHONDONTWRITEBYTECODE=1
|
||||
SET GDOWN_CACHE=cache\gdown
|
||||
SET TORCH_HOME=cache\torch
|
||||
SET HF_HOME=cache\huggingface
|
||||
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\openpose
|
||||
IF EXIST %VS_VCVARS% CALL %VS_VCVARS%
|
||||
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
|
||||
start cmd /k "%~dp0condabin\micromamba.bat" activate openpose
|
@ -1,18 +1,2 @@
|
||||
@echo off
|
||||
|
||||
REM 设置环境变量
|
||||
SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
SET PATH="%CUDA_HOME%\bin;%PATH%"
|
||||
SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
SET VS_DIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
||||
SET PROJECT_DIR=%~dp0
|
||||
SET MICROMAMBA_EXE=%~dp0micromamba.exe
|
||||
SET MAMBA_ROOT_PREFIX=%PROJECT_DIR%\micromamba
|
||||
SET PYTHONDONTWRITEBYTECODE=1
|
||||
SET GDOWN_CACHE=cache\gdown
|
||||
SET TORCH_HOME=cache\torch
|
||||
SET HF_HOME=cache\huggingface
|
||||
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\pixie-env
|
||||
IF EXIST %VS_VCVARS% CALL %VS_VCVARS%
|
||||
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
|
||||
start cmd /k "%~dp0condabin\micromamba.bat" activate pixie-env
|
@ -1,6 +1,7 @@
|
||||
@echo off
|
||||
|
||||
@CALL SET PROJECT_DIR=%~dp0
|
||||
<<<<<<< Updated upstream
|
||||
|
||||
@CALL python -m pip install --upgrade pip
|
||||
@CALL python -m pip install gdown
|
||||
@ -30,4 +31,49 @@
|
||||
@CALL cd %PROJECT_DIR%\resource\openpose
|
||||
@CALL python -m gdown 1Yn03cKKfVOq4qXmgBMQD20UMRRRkd_tV
|
||||
@CALL tar -xvzf models.tar.gz
|
||||
@CALL rm models.tar.gz
|
||||
@CALL rm models.tar.gz
|
||||
=======
|
||||
|
||||
@CALL python -m pip install --upgrade pip
|
||||
@CALL python -m pip install gdown
|
||||
|
||||
@CALL mkdir %PROJECT_DIR%\resource\NeuralHaircut\PIXIE
|
||||
@CALL mkdir %PROJECT_DIR%\resource\hyperIQA\pretrained
|
||||
@CALL mkdir %PROJECT_DIR%\resource\Matte-Anything\pretrained
|
||||
@CALL mkdir %PROJECT_DIR%\resource\openpose
|
||||
|
||||
@CALL cd %PROJECT_DIR%\resource\NeuralHaircut
|
||||
@CALL python -m gdown --folder https://drive.google.com/drive/folders/1TCdJ0CKR3Q6LviovndOkJaKm8S1T9F_8
|
||||
@CALL cd %PROJECT_DIR%\resource\NeuralHaircut\pretrained_models\diffusion_prior
|
||||
@CALL python -m gdown 1_9EOUXHayKiGH5nkrayncln3d6m1uV7f
|
||||
@CALL cd %PROJECT_DIR%\resource\NeuralHaircut\PIXIE
|
||||
@CALL python -m gdown 1mPcGu62YPc4MdkT8FFiOCP629xsENHZf
|
||||
@CALL tar -xvzf pixie_data.tar.gz ./
|
||||
@CALL rm pixie_data.tar.gz
|
||||
@CALL cd %PROJECT_DIR%\resource\hyperIQA\pretrained
|
||||
@CALL python -m gdown 1OOUmnbvpGea0LIGpIWEbOyxfWx6UCiiE
|
||||
@CALL cd %PROJECT_DIR%
|
||||
|
||||
@CALL cd %PROJECT_DIR%\resource\Matte-Anything\pretrained
|
||||
@CALL curl -L -o sam_vit_h_4b8939.pth https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
|
||||
@CALL curl -L -o groundingdino_swint_ogc.pth https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
|
||||
@CALL python -m gdown 1d97oKuITCeWgai2Tf3iNilt6rMSSYzkW
|
||||
|
||||
@CALL cd %PROJECT_DIR%\resource\openpose
|
||||
@CALL python -m gdown 1Yn03cKKfVOq4qXmgBMQD20UMRRRkd_tV
|
||||
@CALL tar -xvzf models.tar.gz
|
||||
@CALL rm models.tar.gz
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
|
263
install.bat
263
install.bat
@ -1,139 +1,146 @@
|
||||
@echo off
|
||||
|
||||
REM 统一环境变量设置格式
|
||||
set "PROJECT_DIR=%~dp0"
|
||||
set "CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
set "PATH=%CUDA_HOME%\bin;%PATH%"
|
||||
set "BLENDER_DIR=C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
set "VS_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
||||
set "VS_VCVARS=%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
||||
set "MICROMAMBA_EXE=%PROJECT_DIR%micromamba.exe"
|
||||
set "MAMBA_ROOT_PREFIX=%PROJECT_DIR%micromamba"
|
||||
set "PYTHONDONTWRITEBYTECODE=1"
|
||||
set "GDOWN_CACHE=%PROJECT_DIR%\cache\gdown"
|
||||
set "TORCH_HOME=%PROJECT_DIR%\cache\torch"
|
||||
set "HF_HOME=%PROJECT_DIR%\cache\huggingface"
|
||||
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
|
||||
@CALL SET PROJECT_DIR=%~dp0
|
||||
@CALL SET MICROMAMBA_EXE=%PROJECT_DIR%\micromamba.exe
|
||||
@CALL SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\"
|
||||
@CALL SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6\"
|
||||
@CALL SET VS_DIR="C:\Program Files\Microsoft Visual Studio\2022\Professional\"
|
||||
@CALL SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
||||
@CALL SET PATH=%CUDA_HOME%\bin;%PROJECT_DIR%\condabin;%PATH%
|
||||
|
||||
IF NOT EXIST "%CUDA_HOME%" (
|
||||
echo ERROR: CUDA_HOME path does not exist: %CUDA_HOME%
|
||||
exit /b 1
|
||||
)
|
||||
IF NOT EXIST "%BLENDER_DIR%" (
|
||||
echo ERROR: BLENDER_DIR path does not exist: %BLENDER_DIR%
|
||||
exit /b 1
|
||||
)
|
||||
IF NOT EXIST "%VS_DIR%" (
|
||||
echo ERROR: VS_DIR path does not exist: %VS_DIR%
|
||||
exit /b 1
|
||||
)
|
||||
IF NOT EXIST "%MICROMAMBA_EXE%" (
|
||||
echo ERROR: micromamba not found at %MICROMAMBA_EXE%
|
||||
echo Please install micromamba from https://mamba.readthedocs.io/en/latest/installation.html
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
{{ Gaussian Splatting Hair 环境 }}
|
||||
@CALL "%~dp0micromamba.exe" create -n gaussian_splatting_hair python=3.9 -c pytorch -c nvidia -c conda-forge -c anaconda -c fvcore -c iopath -c bottler -c nvidia -r "%~dp0\" -y
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL python -m pip install pip==23.3.1
|
||||
@CALL python -m pip install gdown==5.2.0
|
||||
@CALL python -m pip install -r requirements.txt
|
||||
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose --depth 1
|
||||
@CALL cd %PROJECT_DIR%\ext\openpose
|
||||
@CALL git submodule update --init --recursive --remote
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone https://github.com/hustvl/Matte-Anything
|
||||
@CALL cd %PROJECT_DIR%\ext\Matte-Anything
|
||||
@CALL git clone https://github.com/IDEA-Research/GroundingDINO.git
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone git@github.com:egorzakharov/NeuralHaircut.git --recursive
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone https://github.com/facebookresearch/pytorch3d
|
||||
@CALL cd %PROJECT_DIR%\ext\pytorch3d
|
||||
@CALL git checkout 2f11ddc5ee7d6bd56f2fb6744a16776fab6536f7
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone https://github.com/camenduru/simple-knn
|
||||
@CALL cd %PROJECT_DIR%\ext\diff_gaussian_rasterization_hair\third_party
|
||||
@CALL git clone https://github.com/g-truc/glm
|
||||
@CALL cd %PROJECT_DIR%\ext\diff_gaussian_rasterization_hair\third_party\glm
|
||||
@CALL git checkout 5c46b9c07008ae65cb81ab79cd677ecc1934b903
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone --recursive https://github.com/NVIDIAGameWorks/kaolin
|
||||
@CALL cd %PROJECT_DIR%\ext\kaolin
|
||||
@CALL git checkout v0.15.0
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone https://github.com/SSL92/hyperIQA %PROJECT_DIR%\ext\hyperIQA
|
||||
|
||||
@CALL copy %PROJECT_DIR%\resource\NeuralHaircut\pretrained_models\diffusion_prior %PROJECT_DIR%\ext\NeuralHaircut\pretrained_models\diffusion_prior
|
||||
@CALL copy %PROJECT_DIR%\resource\NeuralHaircut\PIXIE %PROJECT_DIR%\ext\NeuralHaircut\PIXIE
|
||||
@CALL copy %PROJECT_DIR%\resource\hyperIQA\pretrained %PROJECT_DIR%\ext\hyperIQA\pretrained
|
||||
@CALL copy %PROJECT_DIR%\resource\openpose %PROJECT_DIR%\ext\openpose
|
||||
@CALL cd %PROJECT_DIR%
|
||||
@CALL condabin\micromamba.bat deactivate gaussian_splatting_hair
|
||||
|
||||
{{ Matte Anything 环境 }}
|
||||
@CALL "%~dp0micromamba.exe" create -n matte_anything python=3.9 pytorch=2.0.0 pytorch-cuda=11.8 torchvision tensorboard timm=0.5.4 opencv=4.5.3 mkl=2024.0 setuptools=58.2.0 easydict wget scikit-image gradio=3.46.1 fairscale -c pytorch -c nvidia -c conda-forge -r "%~dp0\" -y
|
||||
@CALL condabin\micromamba.bat activate matte_anything
|
||||
@CALL mkdir %PROJECT_DIR%\ext\Matte-Anything
|
||||
@CALL cd %PROJECT_DIR%\ext\Matte-Anything
|
||||
@CALL git clone git@github.com:facebookresearch/segment-anything.git
|
||||
@CALL cd segment-anything
|
||||
@CALL pip install -e .
|
||||
@CALL cd %PROJECT_DIR%\ext\Matte-Anything
|
||||
@CALL git clone https://github.com/conansherry/detectron2
|
||||
@CALL cd detectron2
|
||||
@CALL pip install -e .
|
||||
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\GroundingDINO
|
||||
@CALL pip install -e .
|
||||
@CALL mkdir %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
||||
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
||||
@CALL copy %PROJECT_DIR%\resource\Matte-Anything\pretrained %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
||||
@CALL cd %PROJECT_DIR%
|
||||
@CALL condabin\micromamba.bat deactivate matte_anything
|
||||
|
||||
{{ OpenPose 环境 }}
|
||||
@CALL "%~dp0micromamba.exe" create -n openpose cmake=3.20 -c conda-forge -r "%~dp0\" -y
|
||||
@CALL condabin\micromamba.bat activate openpose
|
||||
@CALL cd %PROJECT_DIR%\ext\openpose
|
||||
@CALL git submodule update --init --recursive --remote
|
||||
@CALL copy %PROJECT_DIR%\resource\openpose %PROJECT_DIR%\ext\openpose
|
||||
@CALL mkdir build
|
||||
@CALL cd build
|
||||
@CALL %VS_VCVARS%
|
||||
@CALL cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 -DBUILD_PYTHON=true -DUSE_CUDNN=off
|
||||
@CALL cmake --build . --config Release
|
||||
@CALL cd %PROJECT_DIR%
|
||||
@CALL condabin\micromamba.bat deactivate openpose
|
||||
|
||||
{{ PIXIE 环境 }}
|
||||
@CALL "%~dp0micromamba.exe" create -n pixie-env python=3.8 pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 fvcore pytorch3d==0.7.5 kornia matplotlib -c pytorch -c nvidia -c fvcore -c conda-forge -c pytorch3d -r "%~dp0\" -y
|
||||
@CALL condabin\micromamba.bat activate pixie-env
|
||||
@CALL cd %PROJECT_DIR%\ext
|
||||
@CALL git clone https://github.com/yfeng95/PIXIE
|
||||
@CALL cd %PROJECT_DIR%\ext\PIXIE
|
||||
@CALL chmod +x fetch_model.sh && ./fetch_model.sh
|
||||
@CALL pip install pyyaml==5.4.1
|
||||
@CALL pip install git+https://github.com/1adrianb/face-alignment.git@54623537fd9618ca7c15688fd85aba706ad92b59
|
||||
@CALL cd %PROJECT_DIR%
|
||||
@CALL condabin\micromamba.bat deactivate pixie-env
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
REM 拉取所有外部库
|
||||
mkdir ext
|
||||
cd %PROJECT_DIR%\ext && git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose --depth 1
|
||||
cd %PROJECT_DIR%\ext\openpose && git submodule update --init --recursive --remote
|
||||
cd %PROJECT_DIR%\ext && git clone https://github.com/hustvl/Matte-Anything
|
||||
cd %PROJECT_DIR%\ext\Matte-Anything && git clone https://github.com/IDEA-Research/GroundingDINO.git
|
||||
cd %PROJECT_DIR%\ext && git clone git@github.com:egorzakharov/NeuralHaircut.git --recursive
|
||||
cd %PROJECT_DIR%\ext && git clone https://github.com/facebookresearch/pytorch3d
|
||||
cd %PROJECT_DIR%\ext\pytorch3d && git checkout 2f11ddc5ee7d6bd56f2fb6744a16776fab6536f7
|
||||
cd %PROJECT_DIR%\ext && git clone https://github.com/camenduru/simple-knn
|
||||
cd %PROJECT_DIR%\ext\diff_gaussian_rasterization_hair\third_party && git clone https://github.com/g-truc/glm
|
||||
cd %PROJECT_DIR%\ext\diff_gaussian_rasterization_hair\third_party\glm && git checkout 5c46b9c07008ae65cb81ab79cd677ecc1934b903
|
||||
cd %PROJECT_DIR%\ext && git clone --recursive https://github.com/NVIDIAGameWorks/kaolin
|
||||
cd %PROJECT_DIR%\ext\kaolin && git checkout v0.15.0
|
||||
cd %PROJECT_DIR%\ext && git clone https://github.com/SSL92/hyperIQA
|
||||
|
||||
REM 创建主环境
|
||||
%MICROMAMBA_EXE% create -y -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair python=3.9
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
pip install -r requirements.txt
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
|
||||
REM 创建 Matte-Anything 环境
|
||||
%MICROMAMBA_EXE% create -y -p %MAMBA_ROOT_PREFIX%\envs\matte_anything python=3.9
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\matte_anything
|
||||
pip install -r requirements_matte.txt
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
|
||||
REM 创建 PIXIE 环境
|
||||
%MICROMAMBA_EXE% create -y -p %MAMBA_ROOT_PREFIX%\envs\pixie-env python=3.8
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\pixie-env
|
||||
pip install -r requirements_pixie.txt
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
|
||||
REM 创建 OpenPose 环境
|
||||
%MICROMAMBA_EXE% create -y -p %MAMBA_ROOT_PREFIX%\envs\openpose python=3.9
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\openpose
|
||||
pip install -r requirements_openpose.txt
|
||||
REM 从resource文件夹拷贝Neural Haircut文件
|
||||
xcopy /E /I /Y %PROJECT_DIR%\resource\NeuralHaircut %PROJECT_DIR%\ext\NeuralHaircut
|
||||
xcopy /E /I /Y %PROJECT_DIR%\resource\hyperIQA\pretrained %PROJECT_DIR%\ext\hyperIQA\pretrained
|
||||
cd %PROJECT_DIR%
|
||||
REM 退出 OpenPose 环境
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
|
||||
REM Matte-Anything
|
||||
%MICROMAMBA_EXE% create -y -n matte_anything pytorch=2.0.0 pytorch-cuda=11.8 torchvision tensorboard timm=0.5.4 opencv=4.5.3 mkl=2024.0 setuptools=58.2.0 easydict wget scikit-image gradio=3.46.1 fairscale -c pytorch -c nvidia -c conda-forge
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\matte_anything
|
||||
REM 安装pip
|
||||
python -m pip install --upgrade pip
|
||||
REM 安装segment-anything
|
||||
pip install git+https://github.com/facebookresearch/segment-anything.git
|
||||
REM 安装detectron2
|
||||
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
|
||||
REM 安装GroundingDINO
|
||||
cd %PROJECT_DIR%\ext\Matte-Anything\GroundingDINO
|
||||
pip install -e .
|
||||
REM 安装supervision 修复GroundingDINO错误
|
||||
pip install supervision==0.22.0
|
||||
REM 创建pretrained文件夹
|
||||
cd %PROJECT_DIR%\ext\Matte-Anything && mkdir pretrained
|
||||
cd %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
||||
xcopy /E /I /Y %PROJECT_DIR%\resource\Matte-Anything\pretrained\sam_vit_h_4b8939.pth %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
||||
xcopy /E /I /Y %PROJECT_DIR%\resource\Matte-Anything\pretrained\groundingdino_swint_ogc.pth %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
||||
REM 退出matte_anything环境
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
REM 进入gaussian_splatting_hair环境
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
REM 下载Neural Haircut文件
|
||||
xcopy /E /I /Y %PROJECT_DIR%\resource\Matte-Anything\pretrained\model_best.pth %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
||||
REM 退出gaussian_splatting_hair环境
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
|
||||
REM OpenPose
|
||||
cd %PROJECT_DIR%\ext\openpose
|
||||
xcopy /E /I /Y %PROJECT_DIR%\resource\openpose\models %PROJECT_DIR%\ext\openpose\models
|
||||
REM 更新openpose子模块
|
||||
git submodule update --init --recursive --remote
|
||||
REM 创建openpose环境 避免cmake错误
|
||||
%MICROMAMBA_EXE% create -y -p %MAMBA_ROOT_PREFIX%\envs\openpose cmake=3.20 -c conda-forge
|
||||
REM 进入openpose环境
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\openpose
|
||||
REM 创建build文件夹
|
||||
mkdir build
|
||||
cd build
|
||||
REM 调用Visual Studio环境
|
||||
CALL %VS_VCVARS%
|
||||
REM 使用Visual Studio 2019构建
|
||||
cmake .. -DBUILD_PYTHON=true -DUSE_CUDNN=off -DBUILD_CAFFE=false -G "Visual Studio 16 2019" -A x64
|
||||
cmake --build . --config Release
|
||||
REM 退出openpose环境
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
|
||||
REM PIXIE
|
||||
cd %PROJECT_DIR%\ext && git clone https://github.com/yfeng95/PIXIE
|
||||
cd %PROJECT_DIR%\ext\PIXIE
|
||||
REM 创建data目录
|
||||
mkdir data 2>nul
|
||||
cd data
|
||||
REM 从resource拷贝PIXIE模型文件
|
||||
xcopy /E /I /Y %PROJECT_DIR%\resource\PIXIE\data %PROJECT_DIR%\ext\PIXIE\data
|
||||
cd ..
|
||||
|
||||
REM 创建pixie环境
|
||||
%MICROMAMBA_EXE% create -y -p %MAMBA_ROOT_PREFIX%\envs\pixie-env python=3.8 pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 ^
|
||||
pytorch-cuda=11.8 fvcore pytorch3d==0.7.5 kornia matplotlib ^
|
||||
-c pytorch -c nvidia -c fvcore -c conda-forge -c pytorch3d
|
||||
REM 进入pixie环境
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\pixie-env
|
||||
REM 安装pip
|
||||
python -m pip install --upgrade pip
|
||||
REM 安装pyyaml
|
||||
pip install pyyaml==5.4.1
|
||||
REM 安装face-alignment
|
||||
pip install "git+https://github.com/1adrianb/face-alignment.git@54623537fd9618ca7c15688fd85aba706ad92b59"
|
||||
REM 退出pixie环境
|
||||
CALL %MICROMAMBA_EXE% deactivate
|
||||
|
||||
REM 安装pip包
|
||||
pip install pysdf==0.1.9 clean-fid==0.1.35 face-alignment==1.4.1 clip==0.2.0 ^
|
||||
torchdiffeq==0.2.3 torchsde==0.2.5 resize-right==0.0.2
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Core dependencies from environment.yml
|
||||
python==3.9
|
||||
pip==23.3.1
|
||||
setuptools==69.5.1
|
||||
gcc==10.4.0
|
||||
gxx==10.4.0
|
||||
gxx_linux-64==10.4.0
|
||||
plyfile==0.8.1
|
||||
pytorch==2.1.1
|
||||
torchvision==0.16.1
|
||||
@ -23,7 +23,6 @@ tqdm==4.66.5
|
||||
gdown==5.2.0
|
||||
colmap==3.10
|
||||
|
||||
# Pip packages
|
||||
pysdf==0.1.9
|
||||
clean-fid==0.1.35
|
||||
face-alignment==1.4.1
|
||||
@ -31,16 +30,3 @@ clip==0.2.0
|
||||
torchdiffeq==0.2.3
|
||||
torchsde==0.2.5
|
||||
resize-right==0.0.2
|
||||
|
||||
# Local packages
|
||||
-e ./ext/pytorch3d
|
||||
-e ./ext/NeuralHaircut/npbgpp
|
||||
-e ./ext/simple-knn
|
||||
-e ./ext/diff_gaussian_rasterization_hair
|
||||
-e ./ext/kaolin
|
||||
|
||||
# Development tools
|
||||
pytest
|
||||
black
|
||||
flake8
|
||||
ipython
|
@ -1,18 +0,0 @@
|
||||
pytorch==2.0.0
|
||||
pytorch-cuda==11.8
|
||||
torchvision
|
||||
tensorboard
|
||||
timm==0.5.4
|
||||
opencv==4.5.3
|
||||
mkl==2024.0
|
||||
setuptools==58.2.0
|
||||
easydict
|
||||
wget
|
||||
scikit-image
|
||||
gradio==3.46.1
|
||||
fairscale
|
||||
|
||||
# Git packages
|
||||
git+https://github.com/facebookresearch/segment-anything.git
|
||||
git+https://github.com/facebookresearch/detectron2.git
|
||||
supervision==0.22.0
|
@ -1 +0,0 @@
|
||||
cmake==3.20
|
@ -1,13 +0,0 @@
|
||||
python==3.8
|
||||
pytorch==2.0.0
|
||||
torchvision==0.15.0
|
||||
torchaudio==2.0.0
|
||||
pytorch-cuda==11.8
|
||||
fvcore
|
||||
pytorch3d==0.7.5
|
||||
kornia
|
||||
matplotlib
|
||||
pyyaml==5.4.1
|
||||
|
||||
# Git packages
|
||||
git+https://github.com/1adrianb/face-alignment.git@54623537fd9618ca7c15688fd85aba706ad92b59
|
379
run.bat
379
run.bat
@ -1,343 +1,318 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM 设置环境变量
|
||||
SET MICROMAMBA_EXE=%~dp0micromamba.exe
|
||||
SET MAMBA_ROOT_PREFIX=%~dp0micromamba
|
||||
SET CUDA_VISIBLE_DEVICES=0
|
||||
SET CAMERA=PINHOLE
|
||||
SET EXP_NAME_1=stage1
|
||||
SET EXP_NAME_2=stage2
|
||||
SET EXP_NAME_3=stage3
|
||||
SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6"
|
||||
SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
||||
set "PATH=%CUDA_HOME%\bin;%PATH%"
|
||||
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
|
||||
@CALL SET PROJECT_DIR=%~dp0
|
||||
@CALL SET MICROMAMBA_EXE=%PROJECT_DIR%\micromamba.exe
|
||||
@CALL SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\"
|
||||
@CALL SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6\"
|
||||
@CALL SET VS_DIR="C:\Program Files\Microsoft Visual Studio\2022\Professional\"
|
||||
@CALL SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
||||
@CALL SET PATH=%CUDA_HOME%\bin;%PROJECT_DIR%\condabin;%PATH%
|
||||
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
|
||||
REM 确保以下环境变量可用:
|
||||
REM PROJECT_DIR 和 DATA_PATH
|
||||
|
||||
REM 检查必要的环境变量
|
||||
IF NOT DEFINED PROJECT_DIR (
|
||||
echo 错误:未设置PROJECT_DIR环境变量
|
||||
exit /b 1
|
||||
IF "%PROJECT_DIR%"=="" (
|
||||
echo ERROR: PROJECT_DIR environment variable is not set
|
||||
@exit /b 1
|
||||
)
|
||||
IF NOT DEFINED DATA_PATH (
|
||||
echo 错误:未设置DATA_PATH环境变量
|
||||
exit /b 1
|
||||
IF "%DATA_PATH%"=="" (
|
||||
echo ERROR: DATA_PATH environment variable is not set
|
||||
@exit /b 1
|
||||
)
|
||||
IF NOT EXIST "%BLENDER_DIR%" (
|
||||
echo ERROR: BLENDER_DIR path does not exist: %BLENDER_DIR%
|
||||
exit /b 1
|
||||
@exit /b 1
|
||||
)
|
||||
IF NOT EXIST "%MICROMAMBA_EXE%" (
|
||||
echo ERROR: micromamba not found at %MICROMAMBA_EXE%
|
||||
echo Please install micromamba from https://mamba.readthedocs.io/en/latest/installation.html
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM 检查输入视频
|
||||
IF NOT EXIST "%DATA_PATH%\raw.mp4" (
|
||||
echo 错误:未找到输入视频文件 %DATA_PATH%\raw.mp4
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM 检查视频格式和分辨率
|
||||
ffprobe -v error -select_streams v:0 -show_entries stream=width,height,duration -of csv=p=0 "%DATA_PATH%\raw.mp4" || (
|
||||
echo 错误:无法读取视频信息,请确保视频格式正确
|
||||
exit /b 1
|
||||
@echo Please install micromamba from https://mamba.readthedocs.io/en/latest/installation.html
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM ##################
|
||||
REM # 预处理阶段 #
|
||||
REM ##################
|
||||
|
||||
REM 添加进度显示
|
||||
echo [1/3] 预处理阶段开始...
|
||||
|
||||
REM 将原始图像整理成3D Gaussian Splatting格式
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python preprocess_raw_images.py --data_path %DATA_PATH%
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python preprocess_raw_images.py --data_path %DATA_PATH%
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行COLMAP重建并去畸变图像和相机
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
pushd %PROJECT_DIR%\src
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python convert.py -s %DATA_PATH% --camera %CAMERA% --max_size 1024
|
||||
popd
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python convert.py -s %DATA_PATH% --camera %CAMERA% --max_size 1024
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行Matte-Anything
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\matte_anything
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python calc_masks.py --data_path %DATA_PATH% --image_format png --max_size 2048
|
||||
@CALL condabin\micromamba.bat activate matte_anything
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python calc_masks.py --data_path %DATA_PATH% --image_format png --max_size 2048
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 使用IQA分数过滤图像
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python filter_extra_images.py --data_path %DATA_PATH% --max_imgs 128
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python filter_extra_images.py --data_path %DATA_PATH% --max_imgs 128
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 调整图像大小
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python resize_images.py --data_path %DATA_PATH%
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python resize_images.py --data_path %DATA_PATH%
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 计算方向图
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python calc_orientation_maps.py --img_path %DATA_PATH%\images_2 --mask_path %DATA_PATH%\masks_2\hair --orient_dir %DATA_PATH%\orientations_2\angles --conf_dir %DATA_PATH%\orientations_2\vars --filtered_img_dir %DATA_PATH%\orientations_2\filtered_imgs --vis_img_dir %DATA_PATH%\orientations_2\vis_imgs
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python calc_orientation_maps.py --img_path %DATA_PATH%\images_2 --mask_path %DATA_PATH%\masks_2\hair --orient_dir %DATA_PATH%\orientations_2\angles --conf_dir %DATA_PATH%\orientations_2\vars --filtered_img_dir %DATA_PATH%\orientations_2\filtered_imgs --vis_img_dir %DATA_PATH%\orientations_2\vis_imgs
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行OpenPose
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\openpose
|
||||
cd %PROJECT_DIR%\ext\openpose
|
||||
mkdir %DATA_PATH%\openpose
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
"%PROJECT_DIR%\ext\openpose\build\x64\Release\OpenPoseDemo.exe" --image_dir %DATA_PATH%\images_4 --scale_number 4 --scale_gap 0.25 --face --hand --display 0 --write_json %DATA_PATH%\openpose\json --write_images %DATA_PATH%\openpose\images --write_images_format jpg
|
||||
@CALL condabin\micromamba.bat activate openpose
|
||||
@CALL cd %PROJECT_DIR%\ext\openpose
|
||||
@CALL mkdir %DATA_PATH%\openpose
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL "%PROJECT_DIR%\ext\openpose\build\x64\Release\OpenPoseDemo.exe" --image_dir %DATA_PATH%\images_4 --scale_number 4 --scale_gap 0.25 --face --hand --display 0 --write_json %DATA_PATH%\openpose\json --write_images %DATA_PATH%\openpose\images --write_images_format jpg
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行Face-Alignment
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python calc_face_alignment.py --data_path %DATA_PATH% --image_dir "images_4"
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python calc_face_alignment.py --data_path %DATA_PATH% --image_dir "images_4"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行PIXIE
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\pixie-env
|
||||
cd %PROJECT_DIR%\ext\PIXIE
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python demos\demo_fit_face.py -i %DATA_PATH%\images_4 -s %DATA_PATH%\pixie --saveParam True --lightTex False --useTex False --rasterizer_type pytorch3d
|
||||
@CALL condabin\micromamba.bat activate pixie-env
|
||||
@CALL cd %PROJECT_DIR%\ext\PIXIE
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python demos\demo_fit_face.py -i %DATA_PATH%\images_4 -s %DATA_PATH%\pixie --saveParam True --lightTex False --useTex False --rasterizer_type pytorch3d
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 合并所有PIXIE预测到单个文件
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python merge_smplx_predictions.py --data_path %DATA_PATH%
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python merge_smplx_predictions.py --data_path %DATA_PATH%
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 将COLMAP相机转换为txt
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
mkdir %DATA_PATH%\sparse_txt
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
colmap model_converter --input_path %DATA_PATH%\sparse\0 --output_path %DATA_PATH%\sparse_txt --output_type TXT
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL mkdir %DATA_PATH%\sparse_txt
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL colmap model_converter --input_path %DATA_PATH%\sparse\0 --output_path %DATA_PATH%\sparse_txt --output_type TXT
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 将COLMAP相机转换为H3DS格式
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python colmap_parsing.py --path_to_scene %DATA_PATH%
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python colmap_parsing.py --path_to_scene %DATA_PATH%
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 删除原始文件以节省磁盘空间
|
||||
rmdir /s /q %DATA_PATH%\input %DATA_PATH%\images %DATA_PATH%\masks %DATA_PATH%\iqa*
|
||||
@CALL rmdir /s /q %DATA_PATH%\input %DATA_PATH%\images %DATA_PATH%\masks %DATA_PATH%\iqa*
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 清理临时文件
|
||||
del /f /s /q %DATA_PATH%\*.tmp >nul 2>&1
|
||||
@CALL del /f /s /q %DATA_PATH%\*.tmp >nul 2>&1
|
||||
|
||||
REM ##################
|
||||
REM # 重建阶段 #
|
||||
REM ##################
|
||||
|
||||
REM 添加进度显示
|
||||
echo [2/3] 重建阶段开始...
|
||||
|
||||
set EXP_PATH_1=%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%
|
||||
|
||||
REM 运行3D Gaussian Splatting重建
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python train_gaussians.py -s %DATA_PATH% -m "%EXP_PATH_1%" -r 1 --port "888%CUDA_VISIBLE_DEVICES%" --trainable_cameras --trainable_intrinsics --use_barf --lambda_dorient 0.1
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python train_gaussians.py -s %DATA_PATH% -m "%EXP_PATH_1%" -r 1 --port "888%GPU%" --trainable_cameras --trainable_intrinsics --use_barf --lambda_dorient 0.1
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行FLAME网格拟合
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\ext\NeuralHaircut\src\multiview_optimization
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\ext\NeuralHaircut\src\multiview_optimization
|
||||
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python fit.py --conf confs\train_person_1.conf --batch_size 1 --train_rotation True --fixed_images True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1 --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python fit.py --conf confs\train_person_1.conf --batch_size 1 --train_rotation True --fixed_images True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1 --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
python fit.py --conf confs\train_person_1.conf --batch_size 4 --train_rotation True --fixed_images True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1\opt_params_final --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
|
||||
@CALL python fit.py --conf confs\train_person_1.conf --batch_size 4 --train_rotation True --fixed_images True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1\opt_params_final --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
python fit.py --conf confs\train_person_1_.conf --batch_size 32 --train_rotation True --train_shape True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2\opt_params_final --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
|
||||
@CALL python fit.py --conf confs\train_person_1_.conf --batch_size 32 --train_rotation True --train_shape True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2\opt_params_final --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 裁剪重建的场景
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python scale_scene_into_sphere.py --path_to_data %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python scale_scene_into_sphere.py --path_to_data %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 移除与FLAME头部网格相交的头发高斯体
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python filter_flame_intersections.py --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000 --project_dir %PROJECT_DIR%\ext\NeuralHaircut
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python filter_flame_intersections.py --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000 --project_dir %PROJECT_DIR%\ext\NeuralHaircut
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 为训练视图运行渲染
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python render_gaussians.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --skip_test --scene_suffix "_cropped" --iteration 30000 --trainable_cameras --trainable_intrinsics --use_barf
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python render_gaussians.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --skip_test --scene_suffix "_cropped" --iteration 30000 --trainable_cameras --trainable_intrinsics --use_barf
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 获取FLAME网格头皮图
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python extract_non_visible_head_scalp.py --project_dir %PROJECT_DIR%\ext\NeuralHaircut --data_dir %DATA_PATH% --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% --cams_path %DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\cameras\30000_matrices.pkl -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%"
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python extract_non_visible_head_scalp.py --project_dir %PROJECT_DIR%\ext\NeuralHaircut --data_dir %DATA_PATH% --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% --cams_path %DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\cameras\30000_matrices.pkl -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行潜在头发股线重建
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python train_latent_strands.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 --model_path_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%" --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 --load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 --trainable_cameras --trainable_intrinsics --use_barf --iterations 20000 --port "800%CUDA_VISIBLE_DEVICES%"
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python train_latent_strands.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 --model_path_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%" --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 --load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 --trainable_cameras --trainable_intrinsics --use_barf --iterations 20000 --port "800%GPU%"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 运行头发股线重建
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python train_strands.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 --model_path_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" --start_checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 --load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 --position_lr_init 0.0000016 --position_lr_max_steps 10000 --trainable_cameras --trainable_intrinsics --use_barf --iterations 10000 --port "800%CUDA_VISIBLE_DEVICES%"
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python train_strands.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 --model_path_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" --start_checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 --load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 --position_lr_init 0.0000016 --position_lr_max_steps 10000 --trainable_cameras --trainable_intrinsics --use_barf --iterations 10000 --port "800%GPU%"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
rmdir /s /q "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\train_cropped"
|
||||
@CALL rmdir /s /q "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\train_cropped"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM ##################
|
||||
REM # 可视化阶段 #
|
||||
REM ##################
|
||||
|
||||
REM 添加进度显示
|
||||
echo [3/3] 可视化阶段开始...
|
||||
|
||||
REM 导出结果的股线为pkl和ply格式
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\preprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python export_curves.py --data_dir %DATA_PATH% --model_name %EXP_NAME_3% --iter 10000 --flame_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3\mesh_final.obj" --scalp_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\scalp_data\scalp.obj" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml"
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\preprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python export_curves.py --data_dir %DATA_PATH% --model_name %EXP_NAME_3% --iter 10000 --flame_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3\mesh_final.obj" --scalp_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\scalp_data\scalp.obj" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 渲染可视化
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\postprocessing
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python render_video.py --blender_path "%BLENDER_DIR%" --input_path "%DATA_PATH%" --exp_name_1 "%EXP_NAME_1%" --exp_name_3 "%EXP_NAME_3%"
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\postprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python render_video.py --blender_path "%BLENDER_DIR%" --input_path "%DATA_PATH%" --exp_name_1 "%EXP_NAME_1%" --exp_name_3 "%EXP_NAME_3%"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 渲染股线
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python render_strands.py -s %DATA_PATH% --data_dir "%DATA_PATH%" --data_device 'cpu' --skip_test -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iteration 30000 --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --model_hair_path "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" --checkpoint_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%\checkpoints\10000.pth" --pointcloud_path_head "%EXP_PATH_1%\point_cloud\iteration_30000\raw_point_cloud.ply" --interpolate_cameras
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python render_strands.py -s %DATA_PATH% --data_dir "%DATA_PATH%" --data_device 'cpu' --skip_test -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iteration 30000 --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --model_hair_path "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" --checkpoint_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%\checkpoints\10000.pth" --pointcloud_path_head "%EXP_PATH_1%\point_cloud\iteration_30000\raw_point_cloud.ply" --interpolate_cameras
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
||||
REM 制作视频
|
||||
CALL %MICROMAMBA_EXE% activate -p %MAMBA_ROOT_PREFIX%\envs\gaussian_splatting_hair
|
||||
cd %PROJECT_DIR%\src\postprocessing
|
||||
echo 正在生成最终视频...
|
||||
set CUDA_VISIBLE_DEVICES=%CUDA_VISIBLE_DEVICES%
|
||||
python concat_video.py --input_path "%DATA_PATH%" --exp_name_3 "%EXP_NAME_3%"
|
||||
@CALL condabin\micromamba.bat activate gaussian_splatting_hair
|
||||
@CALL cd %PROJECT_DIR%\src\postprocessing
|
||||
@CALL set CUDA_VISIBLE_DEVICES=%GPU%
|
||||
@CALL python concat_video.py --input_path "%DATA_PATH%" --exp_name_3 "%EXP_NAME_3%"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo ERROR: Failed to run command
|
||||
exit /b 1
|
||||
@echo ERROR: Failed to run command
|
||||
@exit /b 1
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user