本教程使用的环境及版本
- 操作系统:Ubuntu 18.04.5(无GUI)
- GPU:RTX 3090
- cuda:11.3
- cmake:3.24
- GCC:7.5
- G++:7.5
- python:3.9
- OptiX:7.5
- COLMAP
Instant-ngp 训练数据集
参考地址:https://www.jianshu.com/p/319a4846946b
Instant-ngp官方文档地址
https://github.com/NVlabs/instant-ngp
instant-ngp官方要求环境配置(Requirements)
- An NVIDIA GPU; tensor cores increase performance when available. All shown results come from an RTX 3090.
- A C++14 capable compiler. The following choices are recommended and have been tested:
- Windows: Visual Studio 2019
- Linux: GCC/G++ 7.5 or higher
- CUDA v10.2 or higher and CMake v3.21 or higher.
-
(optional) Python 3.7 or higher for interactive bindings. Also, run
pip install -r requirements.txt
. -
(optional) OptiX 7.3 or higher for faster mesh SDF training. Set the environment variable
OptiX_INSTALL_DIR
to the installation directory if it is not discovered automatically. - (optional) Vulkan SDK for DLSS support.
目的
- linux完成部署instant-ngp
基础环境依赖安装
- 执行以下命令安装依赖
sudo apt-get install build-essential git python3-dev python3-pip libopenexr-dev libxi-dev \
libglfw3-dev libglew-dev libomp-dev libxinerama-dev libxcursor-dev
安装CUDA
- 下载对应版本CUDA进行安装
- 注:需要将cuda安装到 /usr/local 目录下
- 安装流程参考:https://zhuanlan.zhihu.com/p/79059379
安装cmake
- cmake安装包:链接: https://pan.baidu.com/s/1hTCwoYWq50D_lK2OIav2Lg 密码: fs26
- 1.从官网下载cmake安装包,输入指令解压缩
sudo tar -zxvf cmake-3.24.0-rc1.tar.gz
- 2.进入解压缩后的文件夹中执行
sudo ./bootstrap
sudo make
sudo make install
安装GCC、G++
- 我的系统默认GCC/G++版本为7.5,符合instant-ngp安装要求(如版本不符合,参考以下流程更新)
- 流程参考:https://blog.csdn.net/liuchang__/article/details/78485498
安装OptiX
- OptiX安装脚本:链接: https://pan.baidu.com/s/16ZY-tg5xo1cHtNPBfY1rYw 密码: 10ku
- 注意:需要将Optix安装到 /usr/local 目录下
- 下载Optix安装脚本到 /usr/local 目录
- 在 /usr/local 目录中执行
bash NVIDIA-OptiX-SDK-7.5.0-linux64-x86_64.sh
-
执行完安装脚本后,会在/usr/local下生成 NVIDIA-OptiX-SDK-7.5.0-linux64-x86_64/ 目录
image.png 设置OptiX_INSTALL_DIR为环境变量,在 /root/.bashrc 文件最后添加以下内容
export OptiX_INSTALL_DIR="/usr/local/NVIDIA-OptiX-SDK-7.5.0-linux64-x86_64"
image.png
- 安装完成
安装COLMAP
- 1.安装依赖包
sudo apt-get install \
git \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libsuitesparse-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgflags-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libcgal-qt5-dev
- 2.安装ceres-solver
注意,不能克隆这个仓库的master分支,而要手动切换到2.0分支或2.1分支,否则会导致安装失败!
sudo apt-get install libatlas-base-dev libsuitesparse-dev
git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver
git checkout 2.1.0
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make -j
sudo make install
- 3.安装colmap
git clone https://github.com/colmap/colmap
cd colmap
git checkout dev
mkdir build
cd build
cmake ..
make -j
sudo make install
- 4.验证colmap
colmap -h
# 有GUI的可执行以下命令
colmap gui
部署instant-ngp
- 完整代码包:链接: https://pan.baidu.com/s/1JeF7pQZo2kIdVkXLP0D4Zw 密码: i45n
- 1.clone项目代码到项目目录
git clone --recursive https://github.com/nvlabs/instant-ngp
cd instant-ngp
- 2.使用cmake构建项目
cmake . -B build
cmake --build build --config RelWithDebInfo -j 16
- 3.使用测试数据测试(非GUI版本)
./build/testbed --no-gui --scene data/nerf/fox
注意:非GUI版本下执行该命令后训练不会停止,需要手动取消
window10部署instant-ngp
- 文档参考:https://github.com/bycloudai/instant-ngp-Windows
- 视频教程参考(挂VPN):https://www.youtube.com/watch?v=kq9xlvz73Rg
- 建议视频结合文档进行查看
文献参考
https://github.com/NVlabs/instant-ngp
https://github.com/bycloudai/instant-ngp-Windows
https://zhuanlan.zhihu.com/p/79059379
https://www.cnblogs.com/AbnerShen/p/7399010.html
https://blog.csdn.net/weixin_46132232/article/details/124211233