1 环境配置
下载项目,一定要 git 下载全项目,下载完后要检查third_parities 里面的coslam和neural_slam_eval 文件全不全。
git clone --recursive https://github.com/oppo-us-research/NARUTO.git
环境配置
注意
bash scripts/installation/conda_env/build.sh
这个安装文件里面要确定 habitat 按照这个源下载好,最好能够联网按照脚本下载齐全。
GitHub - Huangying-Zhan/habitat-sim: A flexible, high-performance 3D simulator for Embodied AI research.
如果联网下载失败,则将起更改为如下
ROOT=${PWD}
### create conda environment ###
conda create -y -n naruto python=3.8 cmake=3.14.0
### activate conda environment ###
conda activate naruto
# ### Setup habitat-sim ###
cd ${ROOT}/third_parties
#git clone git@github.com:Huangying-Zhan/habitat-sim.git habitat_sim
git clone https://github.com/Huangying-Zhan/habitat-sim habitat_sim
cd habitat_sim
pip install -r requirements.txt
python setup.py install --headless --bullet
### extra installation ###
pip install opencv-python
conda install -y ipython
pip install mmcv==2.0.0
### CoSLAM installation ###
cd ${ROOT}/third_parties/coslam
git checkout 3bb904e
pip install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu113/torch_stable.html
pip install -r requirements.txt
cd external/NumpyMarchingCubes
python setup.py install
### NARUTO installation ###
pip install -r ${ROOT}/envs/requirements.txt
安装完毕后,cmake 总是遇到问题,建议
pip install cmake==3.14.3
总算安装完成。
2 下载数据
按照项目的readme 没问题
# Download Replica data and save as data/replica_v1.
# This process can take a while.
bash scripts/data/replica_download.sh data/replica_v1# Once the donwload is completed, create modified Habitat Simulator configs that adjust the coordinate system direction.
# P.S. we adjust the config so the coordinates matches with the mesh coordinates.
bash scripts/data/replica_update.sh data/replica_v1
# Download Replica (SLAM) Data and save as data/Replica bash scripts/data/replica_slam_download.sh
3 运行
bash scripts/naruto/run_replica.sh {SceneName/all} {NUM_TRIAL} {EXP_NAME} {ENABLE_VIS} # Run MP3D bash scripts/naruto/run_mp3d.sh {SceneName/all} {NUM_TRIAL} {EXP_NAME} {ENABLE_VIS} # examples bash scripts/naruto/run_replica.sh office0 1 NARUTO 1 bash scripts/naruto/run_mp3d.sh gZ6f7yhEvPG 1 NARUTO 0 bash scripts/naruto/run_replica.sh all 5 NARUTO 0
bash scripts/naruto/run_replica.sh office0 1 NARUTO 1
#报错0 路径和文件名
解决:
定位到NARUTO/src/simulator/habitat_utils.py", line 198,
in make_configuration
assert os.path.exists(backend_cfg.scene_id)
没有这个文件的路径,这个文件打印出来,发现
而在data文件夹下面找到的是不带SDK的json文件,于是更改文件名。
再运行,还是不行。发现data下的scene 名为room_0,config 中均为room0, 遂将data下的文件夹更名。
可以运行起来了,
#1报错:tiny-cudann安装出错
Failed to build tinycudann; Could not build wheels for tinycudann; Could not find filesystem; xxx.so.xx no such file or directory #337
User
In file included from /home/xxx/NARUTO/tiny-cuda-nn/include/tiny-cuda-nn/cpp_api.h:32:0,
from /home/xxx/NARUTO/tiny-cuda-nn/include/tiny-cuda-nn/common_host.h:33,
from ../../src/common_host.cu:31:
/home/xxx/NARUTO/tiny-cuda-nn/dependencies/json/json.hpp:3954:14: 致命错误:filesystem:没有那个文件或目录
#include <filesystem>
^~~~~~~~~~~~
编译中断。
error: command '/home/xxx/cuda-11.3/bin/nvcc' failed with exit code 1
参考:https://github.com/NVlabs/tiny-cuda-nn/issues/337
解决方案:
将gcc和g++升级到9.0以上版本。
#2报错 open3d安装出错
evaluation过程中又有新的报错
OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /home/wsx/anaconda3/envs/naruto/lib/python3.8/site-packages/open3d/cpu/pybind.cpython-38-x86_64-linux-gnu.so)
这个错误表明您的程序或库依赖于 GLIBC 的 2.27 版本,但您的系统上安装的 GLIBC 版本低于 2.27。导致这种情况的原因可能是:
- 您的系统未安装或未正确配置 GLIBC 2.27。
- 您的程序或库要求 GLIBC 2.27,但您的系统中的版本较低或者较高
参考:Build from source - Open3D 0.18.0 documentation
==> Evaluating reconstruction result [accuracy, completeness, and completion ratio]
Traceback (most recent call last):
File "src/evaluation/eval_recon.py", line 34, in <module>
from third_parties.neural_slam_eval.eval_recon import calc_3d_mesh_metric, get_align_transformation
File "/home/wsx/NARUTO/third_parties/neural_slam_eval/eval_recon.py", line 7, in <module>
import open3d as o3d
File "/home/wsx/anaconda3/envs/naruto/lib/python3.8/site-packages/open3d/__init__.py", line 56, in <module>
_CDLL(str(next((_Path(__file__).parent / 'cpu').glob('pybind*'))))
File "/home/wsx/anaconda3/envs/naruto/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /home/wsx/anaconda3/envs/naruto/lib/python3.8/site-packages/open3d/cpu/pybind.cpython-38-x86_64-linux-gnu.so)
==> Evaluating reconstruction result [MAD]
原因是ubuntu 16.04 里面没有open3d 0.10 版本之后需要的GLIBC_2.27。
解决方案:
参考这个[教程] Ubuntu16.04系统安装Open3D_open3d移植到ubuntu-CSDN博客
如果想要在Ubuntu16.04的系统上使用Open3D该怎么办呢?
可以通过编译源码的方式进行安装:
(1)从github上下载Open3D的源码,
git clone https://github.com/isl-org/Open3D
(2)切换到v0.6.0版本,(0.12.0,0.13.0需要cmake=3.17,3.18)
git checkout v0.6.0
(3)再下载子模块的代码
git submodule update --init --recursive
这一步是下载子模块3rdparty的代码,如果下载的比较慢,同样可以先把仓库导入到gitee,再把.gitmodules文件中的url修改为gitee中的仓库地址即可。
(4)安装依赖
bash util/scripts/install-deps-ubuntu.sh
(5)按顺序执行下面的命令编译C++库
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/Open3D/ -DBUILD_EIGEN3=ON -DBUILD_GLEW=ON -DBUILD_GLFW=ON -DBUILD_JSONCPP=ON -DBUILD_PNG=ON -DENABLE_JUPYTER=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
#注意DPYTHON_EXECUTABLE=/usr/bin/python3 根据自己环境的版本定义,如本文的
anaconda 虚拟环境naruto 则该命令改为
cmake -DCMAKE_INSTALL_PREFIX=/opt/Open3D/ -DBUILD_EIGEN3=ON -DBUILD_GLEW=ON -DBUILD_GLFW=ON -DBUILD_JSONCPP=ON -DBUILD_PNG=ON -DENABLE_JUPYTER=OFF -DPYTHON_EXECUTABLE=/home/usrname/anaconda3/envs/naruto/bin/python3.8 ..
make -j$(nproc)
sudo make install
(6)编译Python库
make pip-package
(7)编译成功后,会在lib/python_package/pip_package/目录下生成对应Python版本的.whl包,用pip命令安装一下就可以了。
pip3 install lib/python_package/pip_package/open3d-0.6.0.0-cp38-cp38-linux_x86_64.whl
(8)安装成功后可以再验证一下:
python3 -c "import open3d"
如果没有输出错误,就说明已经可以用了。
#3 报错:trimesh版本调整
Pixels to save: 40800 Traceback (most recent call last): File "src/evaluation/eval_mad.py", line 87, in <module> gt_pc = trimesh.sample.sample_surface(mesh_gt, 200000, seed=0)[0] # N,3 TypeError: sample_surface() got an unexpected keyword argument 'seed',如下
这个错误提示表明在调用 trimesh.sample.sample_surface()
函数时,出现了意外的关键字参数 'seed'。这可能是因为你使用的 trimesh 版本与你所查看的文档不匹配,导致文档中提到的参数在你使用的版本中不存在。
解决方案:
更新 trimesh 库 (参考naruto工程的requirements 文件)
pip install trimesh==3.23.5
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting trimesh==3.23.5
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c9/10/c5925a556ae5eebca155524443cb94d84ba5715b56085fbbdd8438eb5509/trimesh-3.23.5-py3-none-any.whl (685 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 685.4/685.4 kB 2.2 MB/s eta 0:00:00
Requirement already satisfied: numpy in /home/wsx/anaconda3/envs/naruto/lib/python3.8/site-packages (from trimesh==3.23.5) (1.22.4)
Installing collected packages: trimesh
Attempting uninstall: trimesh
Found existing installation: trimesh 3.21.5
Uninstalling trimesh-3.21.5:
Successfully uninstalled trimesh-3.21.5
Successfully installed trimesh-3.23.5
ok