【bug】diff-gaussian-rasterization Windows下编译 bug 解决

问题1 vcvarsall.bat" x86_amd64 && set

具体问题

\x00\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00\r\x00\n\x00’
error: Error executing cmd /u /c “F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat” x86_amd64 && set

原因

这个是跨平台编译(32位→64位),大概率会失败,因为你已经在 64 位开发者 PowerShell 里了。
PyTorch 的 cpp_extension 依然会默认调用 x86_amd64,所以必须强制改成 x64 才行。

解决方式

设置环境变量

$env:PLATFORM="x64"
$env:DISTUTILS_USE_SDK="1"

问题2 “crtdefs.h”: No such file or directory

具体问题

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include\crt/host_config.h(231): fatal error C1083: 无法打开包括文件: “crtdefs.h”: No such file or directory
error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc’ failed with exit code 2

原因

1、Windows SDK 或 MSVC 头文件没装全 或者路径不对
2、CUDA 用的 nvcc 指向了错误的编译器

解决方法

cuda我是有安装的,系统路径也是有的。
vs 2022也有安装,路径也有,但还是要增加以下环境变量,增加后可以解决

$env:INCLUDE="$env:INCLUDE;F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include"

问题3 crtdefs.h(10): fatal error C1083: 无法打开包括文件: “corecrt.h”: No such file or directory

具体问题

F:/Program Files (x86)/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/include\crtdefs.h(10): fatal error C1083: 无法打开包括文件: “corecrt.h”: No such file or directory
error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc’ failed with exit code 2

原因

你现在这个错误说明我们虽然把 crtdefs.h 找到了,但它自己还依赖 corecrt.h,而这个文件是在 Windows SDK 里,不在 MSVC 目录下。

解决

一开始忽略了Windows SDK这个东西,竟然是有用的,增加以下环境变量
$winSDK = “F:\Windows Kits\10\Include\10.0.22000.0”

$env:INCLUDE="$env:INCLUDE;$winSDK\ucrt;$winSDK\shared;$winSDK\um"

问题4 LINK : fatal error LNK1104: 无法打开文件“msvcprt.lib”

原因

LINK : fatal error LNK1104: 无法打开文件“msvcprt.lib” 表示链接器找不到 MSVC的标准C++运行库静态库文件,这是链接阶段必需的库。

解决

$msvcLib = "F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x64"
$env:LIB="$env:LIB;$msvcLib"

问题5 LINK : fatal error LNK1104: 无法打开文件“uuid.lib”

原因

LINK : fatal error LNK1104: 无法打开文件“uuid.lib” 表示链接器找不到 Windows SDK 的 uuid.lib,这是一个系统库,通常在 Windows SDK 的 Lib 目录下。

解决

$winSdkLib = "F:\Windows Kits\10\Lib\10.0.22000.0"
$env:LIB="$env:LIB;$winSdkLib\um\x64;$winSdkLib\ucrt\x64"

问题6 LINK : fatal error LNK1158: 无法运行“rc.exe”

具体问题

正在创建库 build\temp.win-amd64-cpython-38\Release\cuda_rasterizer_C.cp38-win_amd64.lib 和对象 build\temp.win-amd64-cpython-38\Release\cuda_rasterizer_C.cp38-win_amd64.exp
正在生成代码
已完成代码的生成
LINK : fatal error LNK1158: 无法运行“rc.exe”
error: command ‘F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\Hostx64\x64\link.exe’ failed with exit code 1158

原因

LINK : fatal error LNK1158: 无法运行“rc.exe” 错误表示链接器找不到 资源编译器 rc.exe,它是生成 Windows 资源文件(.res)的工具,位于 Windows SDK 目录里。

解决

$env:PATH="$env:PATH;F:\Windows Kits\10\bin\10.0.22000.0\x64"

成功了
![外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传](https://img-home.csdnimg.cn/images/20230724024159.png?origin_url=%2Fydocs%2Fcollab%2Fapi%2Fv1%2Fdrive%2Fdownload%2F147n29ueoc39h9qvba2k08ia0oimpu&pos_id=img-WsCmezi7-1754915240502

Gaussian Haircut - 了解项目: - 了解 [GaussianHaircut](https://eth-ait.github.io/GaussianHaircut/) ; - 先了解该项目: [GaussianHaircut](https://github.com/eth-ait/GaussianHaircut) , use context7 ; - 把这个项目改成WIndows的项目: - 参考install.sh和run.sh, 新建两个bat文件: install.bat 和 run.bat ; - 安装部署的时候验证必须的软件是否正确安装, 如果没有, 则帮助下载安装 ; - 用./micromamba.exe 来创建和管理虚拟环境 ; - 重写Readme,用中文, 并标注所需要安装的软件如: Blender, CMake, CUDA, Colmap(https://github.com/colmap/colmap/releases), use context7 ; - 注意环境变量要设置正确 - Code Rules: - 文件修改完成后则用命令行运行测试, 并修正Bug - 不要随意新建文件导致混乱 - 默认环境变量: - PROJECT_DIR=%CD% - DATA_PATH=%PROJECT_DIR%\data - ENV_PATH=%PROJECT_DIR%\envs - MAMBA=%PROJECT_DIR%\micromamba.exe - CUDA_DIR=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 - BLENDER_DIR=C:\Program Files\Blender Foundation\Blender 3.6 - COLMAP_DIR=C:\Colmap\bin - CMAKE_DIR=C:\Program Files\CMake\bin - GIT_DIR=C:\Program Files\Git\bin - VCVARS_DIR=C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build - install.bat 安装主要步骤: 1 环境检查与设置环境变量 2 用micromamba设置虚拟环境,并测试 3 拉取代码与依赖 4 构建必要模块(如pytorch,openpose,pixie,detectron2 等等) 5 下载大模型 6 测试 - run.bat 运行主要步骤: - 预处理: - 将原始图像排列成 3D 高斯 Splatting 格式 - 运行 COLMAP 重建并对图像和相机进行去畸变 - 运行 Matte-Anything - 调整图像大小 - 使用图像的 IQA 分数进行过滤 - 计算方向图 - 运行 OpenPose - 运行 Face-Alignment - 运行 PIXIE - 将所有 PIXIE 预测合并到一个文件中 - 将 COLMAP 相机转换为 txt 格式 - 将 COLMAP 相机转换为 H3DS 格式 - 删除原始文件以节省磁盘空间 - 重建: - 运行 3D 高斯 Splatting 重建 - 运行 FLAME 网格拟合 - 裁剪重建场景 - 移除与 FLAME 头部网格相交的头发高斯分布 - 运行训练视图渲染 - 获取 FLAME 网格头皮图 - 运行潜在发束重建 - 运行发束重建 - 可视化: - 将生成的发束导出为 pkl 和 ply 文件 - 渲染可视化效果 - 渲染线条 - 制作视频 - 必要参考: - [Gaussianhaircut](https://eth-ait.github.io/GaussianHaircut/), use context7 ; - [NeuralHaircut](https://github.com/egorzakharov/NeuralHaircut), use context7 ; - [micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html), use context7 ; - [diff_gaussian_rasterization_hair](https://github.com/g-truc/glm), use context7 ; - [Matte-Anything](https://github.com/hustvl/Matte-Anything), use context7 ; - [detectron2](https://github.com/facebookresearch/detectron2), use context7 ; - [colmap](https://colmap.github.io/), use context7 ; - [openpose](https://github.com/CMU-Perceptual-Computing-Lab/openpose), use context7 ; - [pytorch3d](https://github.com/facebookresearch/pytorch3d), use context7 ; - [simple-knn](https://github.com/camenduru/simple-knn), use context7 ; - [kaolin](https://github.com/NVIDIA/kaolin), use context7 ; - [hyperIQA](https://github.com/SSL92/hyperIQA), use context7 ; ``` # Prerequisites: # # 1. Install CUDA 11.8 # Follow intructions on https://developer.nvidia.com/cuda-11-8-0-download-archive # Make sure that # - PATH includes <CUDA_DIR>/bin # - LD_LIBRARY_PATH includes <CUDA_DIR>/lib64 # If needed, restart bash environment # The environment was tested only with this CUDA version # 2. Install Blender 3.6 to create strand visualizations # Follow instructions on https://www.blender.org/download/lts/3-6 # # Need to use this to activate conda environments eval "$(conda shell.bash hook)" # Save parent dir PROJECT_DIR=$PWD # Pull all external libraries 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 [email protected]: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 # Install environment cd $PROJECT_DIR && conda env create -f environment.yml conda activate gaussian_splatting_hair # Download Neural Haircut files cd $PROJECT_DIR/ext/NeuralHaircut gdown --folder https://drive.google.com/drive/folders/1TCdJ0CKR3Q6LviovndOkJaKm8S1T9F_8 cd $PROJECT_DIR/ext/NeuralHaircut/pretrained_models/diffusion_prior # downloads updated diffusion prior gdown 1_9EOUXHayKiGH5nkrayncln3d6m1uV7f cd $PROJECT_DIR/ext/NeuralHaircut/PIXIE gdown 1mPcGu62YPc4MdkT8FFiOCP629xsENHZf && tar -xvzf pixie_data.tar.gz ./ && rm pixie_data.tar.gz cd $PROJECT_DIR/ext/hyperIQA && mkdir pretrained && cd pretrained gdown 1OOUmnbvpGea0LIGpIWEbOyxfWx6UCiiE cd $PROJECT_DIR # Matte-Anything conda 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 # this worked better than the official installation config conda deactivate && conda activate matte_anything pip install git+https://github.com/facebookresearch/segment-anything.git python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' cd $PROJECT_DIR/ext/Matte-Anything/GroundingDINO && pip install -e . pip install supervision==0.22.0 # fixes the GroundingDINO error cd $PROJECT_DIR/ext/Matte-Anything && mkdir pretrained cd $PROJECT_DIR/ext/Matte-Anything/pretrained wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth wget https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth conda deactivate && conda activate gaussian_splatting_hair gdown 1d97oKuITCeWgai2Tf3iNilt6rMSSYzkW # OpenPose cd $PROJECT_DIR/ext/openpose gdown 1Yn03cKKfVOq4qXmgBMQD20UMRRRkd_tV && tar -xvzf models.tar.gz && rm models.tar.gz # downloads openpose checkpoint conda deactivate git submodule update --init --recursive --remote conda create -y -n openpose cmake=3.20 -c conda-forge # needed to avoid cmake complining error conda activate openpose sudo apt install libopencv-dev # installation instructions are from EasyMocap, in case of problems refer to the official OpenPose docs sudo apt install protobuf-compiler libgoogle-glog-dev sudo apt install libboost-all-dev libhdf5-dev libatlas-base-dev mkdir build cd build cmake .. -DBUILD_PYTHON=true -DUSE_CUDNN=off make -j8 conda deactivate # PIXIE cd $PROJECT_DIR/ext && git clone https://github.com/yfeng95/PIXIE cd $PROJECT_DIR/ext/PIXIE chmod +x fetch_model.sh && ./fetch_model.sh conda create -y -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 # this environment works with RTX 4090 conda activate pixie-env pip install pyyaml==5.4.1 pip install git+https://github.com/1adrianb/face-alignment.git@54623537fd9618ca7c15688fd85aba706ad92b59 # install this commit to avoid error ``` 将这段代码装成windows的bat,并保证代码运行无误,注意有一些部分是需要构建的
05-14
### 安装 `depth-diff-gaussian-rasterization` 指南 对于遇到的安装问题,确保所使用的库版本是最新的可以有效减少错误的发生。当面对类似于 `TypeError: GaussianRasterizationSettings.__new__() got an unexpected keyword argument 'antialiasing'` 的报错时,应该确认 `diff-gaussian-rasterization` 是否已经更新到了最新版本[^1]。 #### 准备工作 在开始之前,请先卸载任何旧版本的 `diff-gaussian-rasterization` 或者其他可能冲突的相关软件包。这一步骤有助于避免新旧版本之间的兼容性问题。 ```bash pip uninstall diff-gaussian-rasterization ``` #### 获取最新的源码 前往官方 GitHub 仓库获取指定提交哈希值下的稳定版本: - 访问链接:[diff-gaussian-rasterization](https://github.com/graphdeco-inria/diff-gaussian-rasterization/tree/9c5c2028f6fbee2be239bc4c9421ff894fe4fbe0) 克隆此特定分支至本地计算机并进入项目文件夹: ```bash git clone https://github.com/graphdeco-inria/diff-gaussian-rasterization.git -b 9c5c2028f6fbee2be239bc4c9421ff894fe4fbe0 cd diff-gaussian-rasterization/ ``` #### 安装依赖项 按照 README 文件中的指示来设置环境变量以及安装必要的 Python 库和其他工具链。通常情况下会有一个 setup.py 脚本用于简化整个过程: ```bash pip install -r requirements.txt python setup.py develop ``` #### 验证安装成功与否 完成上述操作之后可以通过运行测试样例验证是否一切正常运作。如果一切顺利,则说明 `depth-diff-gaussian-rasterization` 已经被正确配置好了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qianx77

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值