当前位置: 首页 > news >正文

Linux(ubuntu18.04)下安装instant-ngp环境

Linux(ubuntu18.04)下安装instant-ngp环境

instant-ngp,我终于终于把这玩意给装好了!!!

1.instant-ngp的下载地址

https://github.com/NVlabs/instant-ngp

2.环境需求(必须全部符合,有一个错了就没了阿!!!)

(1)gpu;
(2)Linux: GCC/G++ 8 or higher;
(3)Linux: CUDA 10.2 or higher
(4)CMake v3.21 or higher.
(5)(optional) Python 3.7 or higher for interactive bindings. Also,

run pip install -r requirements.txt.

(6)(optional) OptiX 7.6 or higher for faster mesh SDF training.
(7)(optional) Vulkan SDK for DLSS support.

3.安装依赖

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

4.CUDA路径(添加到末尾)

 gedit ~/.bashrc export PATH="/usr/local/cuda-11.3/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.3/lib64:$LD_LIBRARY_PATH"~/.bashrc

5.拖拽(直接clone会失败哦,会导致子模块不全)

git clone --recursive https://github.com/NVlabs/instant-ngp
或者
git clone --recursive https://github.com/bycloudai/instant-ngp-Windows.git

6.cuda环境

conda create -n npg2 python=3.7conda activate conda activate npg2conda install pytorch==1.8.1 torchvision==0.9.1 torchaudio==0.8.1 cudatoolkit=11.3 -c pytorch -c conda-forge之前
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch

7.编译

cd instant-ngppip install -r requirements.txtcmake . -B build -DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.3/bin/nvcc
或者(不链接GL)
cmake -DNGP_BUILD_WITH_GUI=OFF . -B build -DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.3/bin/nvcccmake --build build --config RelWithDebInfo -j

8.运行

./build/testbed --scene data/nerf/fox

在这里插入图片描述

9.报错

错误:

/usr/bin/ld: 找不到 -lGL
collect2: error: ld returned 1 exit status
CMakeFiles/testbed.dir/build.make:116: recipe for target 'testbed' failed
make[2]: *** [testbed] Error 1
CMakeFiles/Makefile2:228: recipe for target 'CMakeFiles/testbed.dir/all' failed
make[1]: *** [CMakeFiles/testbed.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
/usr/bin/ld: 找不到 -lGL
collect2: error: ld returned 1 exit status
CMakeFiles/pyngp.dir/build.make:116: recipe for target 'pyngp.cpython-38-x86_64-linux-gnu.so' failed
make[2]: *** [pyngp.cpython-38-x86_64-linux-gnu.so] Error 1
CMakeFiles/Makefile2:256: recipe for target 'CMakeFiles/pyngp.dir/all' failed
make[1]: *** [CMakeFiles/pyngp.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2

解决方案:

sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev libgl1 -y
sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

10.自己的数据集(只有图片时)

(1)在data文件夹下新建一个叫做“bears”的文件夹。(这是我自己的数据集);
(2)将自己数据集装入文件夹中;
(3)运行colmap2代码

python scripts/colmap2nerf.py --colmap_matcher exhaustive --run_colmap --aabb_scale 16 --images <image/path>
<image/path> -- 我这里是data/bearspython scripts/colmap2nerf.py --colmap_matcher exhaustive --run_colmap --aabb_scale 16 --images data/bears

(4)将根目录中的文件compal.db,transforms.json和images放到bears下组成一个新的文件夹,再移动到nerf下
(5)数据格式如下
请添加图片描述
(6)修改transforms.json中的文件路径

将原来的的"file_path": "./data/instant-ngp/images/27.jpg"
修改为"file_path": "images/27.jpg"
也就是删掉前面的内容

(7)运行命令

./build/testbed --scene data/nerf/bears/

11.执行scripts/run.py

执行代码

python scripts/run.py --mode nerf --scene data/nerf/fox/python scripts/run.py --mode nerf --scene data/nerf/bears/ --test_transforms data/nerf/bears/transforms.jsonpython scripts/run.py --mode nerf --scene data/nerf/fox/ --test_transforms /home/hua/instant-ngp/data/nerf/fox/transforms.json

报错
(1)问题一:

No module named 'pyngp'

解决问题一:

查看build里面的pyngp.cpython-××m-x86_64-linux-gnu.so
对我而言:
pyngp.cpython-37m-x86_64-linux-gnu.so, which means it is compiled by python 3.7.
更改路径
pyngp_path = '/path/to/your/build'
sys.path.append(pyngp_path)
import pyngp as ngp

(2)问题二

Traceback (most recent call last):File "/home/hua/instant-ngp/scripts/run.py", line 28, in <module>import pyngp as ngp
ImportError: /home/hua/anaconda3/envs/npg2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/hua/instant-ngp/build/pyngp.cpython-37m-x86_64-linux-gnu.so)

解决问题二:

检查是否存在
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
建立软连接
cd /home/hua/anaconda3/envs/npg2/bin/../lib/
mv libstdc++.so.6 libstdc++.so.6.old
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
http://www.xdnf.cn/news/552457.html

相关文章:

  • JWT单双token实现机制记录
  • 精益数据分析(71/126):从移情到黏性——创业阶段的关键跨越与数据驱动策略
  • JavaScript性能优化实战(13):性能测试与持续优化
  • Mysql面经
  • 基于Python批量删除文件和批量增加文件
  • List介绍
  • Java操作Elasticsearch 之 [Java High Level REST Clientedit]
  • 数据库索引是什么,什么时候不适合使用?
  • 【深度学习实战】梯度爆炸怎么解决?
  • 量子通信技术:原理、应用与未来展望
  • 华三(H3C)IRF堆叠心跳的LACP MAD、BFD MAD和ARP MAD差异
  • 蓝桥杯2114 李白打酒加强版
  • JAVASE查漏补缺
  • CAP分布式理论
  • SpringBoot(三)--- 数据库基础
  • MySQL事务管理:事务控制与锁机制详解
  • 【Java实战】线程池 并发 并行 生命周期(详细解释)
  • idea本地debug断点小技巧
  • cplex12.9 安装教程以及下载
  • LabVIEW下AI开发
  • 在 Excel 中使用 C# .NET 用户定义函数 操作步骤
  • oracle以注释作为表头进行查询并导出
  • LeetCode 3024.三角形类型
  • EtherCAT转CANopen协议转换网关在电力行业的融合应用
  • 《微机原理与接口技术》第 7 章 输入/输出技术
  • 基于Yolov8+PyQT5的绝缘子识别系统
  • 《Effective Python》第三章 循环和迭代器——永远不要在迭代容器的同时修改它们
  • 推一帧,通一气:跨平台RTMP推流的内家功夫
  • 国产远程工具如何重新定义高效连接?——从协议支持到生态整合的全面解析
  • vue路由小案例