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_transformationFile "/home/wsx/NARUTO/third_parties/neural_slam_eval/eval_recon.py", line 7, in <module>import open3d as o3dFile "/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.5Downloading 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: trimeshAttempting uninstall: trimeshFound existing installation: trimesh 3.21.5Uninstalling trimesh-3.21.5:Successfully uninstalled trimesh-3.21.5
Successfully installed trimesh-3.23.5
ok