本方法在多次重装系统后多次配置仍成功。为保证下列步骤顺利运行,前提为:在电脑上已成功配置orbslam2,电脑已确保外网下载顺利。本方法仅在ubuntu18.04上配置。
git clone https://github.com/BertaBescos/DynaSLAM.git
pip install keras==2.0.9 -i https://pypi.tuna.tsinghua.edu.cn/simple/
若缺少pip命令,安装即可。
sudo apt install python-pip
https://pypi.tuna.tsinghua.edu.cn/simple/
下载tensorflow-1.12.3-cp27-cp27mu-manylinux1_x86_64.whl
到下载tensorflow-1.12.3-cp27-cp27mu-manylinux1_x86_64.whl的位置如/home 执行以下命令:
sudo pip install tensorflow-1.12.3-cp27-cp27mu-manylinux1_x86_64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple/
sudo apt-get install libblas-dev liblapack-dev
sudo pip install scikit-image
sudo apt-get install libboost-all-dev
sudo apt install libcanberra-gtk-module -y
pip install protobuf==3.17.3
cd coco/PythonAPI
make
sudo make install
运行完成后将coco/PythonAPI/中的pycocotools文件夹复制到Dynaslam/src/python
第17行改为:ROOT_DIR = "./"
Releases · matterport/Mask_RCNN · GitHub
python Check.py
解压提取文件。
打开终端,安装gcc-5/g++-5
sudo apt-get install gcc-5
sudo apt-get install g++-5
cd ..
cd ..
cd /usr/bin
sudo rm gcc
sudo ln -s gcc-5 gcc
sudo rm g++
sudo ln -s g++-5 g++
进入opencv-2.4.11文件夹
https://pan.baidu.com/share/init?surl=FB3R7dQx1UO6TU3tSuuKdw
提取码:dyna
cd opencv-2.4.11
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=bulid -D ENABLE_PRECOMPILED_HEADERS=OFF -D WITH_FFMPEG=OFF -D CMAKE_INSTALL_PREFIX=/usr/local/opencv2.4.11 -D CUDA_GENERATION=Kepler ..
注意:安装路径在usr/local/opencv2.4.11
打开终端
cd ..
cd ..
cd /usr/bin
sudo rm gcc
sudo ln -s gcc-7 gcc
sudo rm g++
sudo ln -s g++-7 g++
找到opencv-2.4.11/build/modules/contrib/CMakeFiles/opencv_contrib.dir/flags.make文件,删掉-Werror=address,然后make,建议多线程编译,我电脑是8核。
sudo make -j8
sudo make install
#add_executable(mono_carla)
#Examples/Monocular/mono_carla.cc)
#target_link_libraries(mono_carla ${PROJECT_NAME})
if(!im.empty()){cv::imshow("DynaSLAM: Current Frame",im);}
if(!im_dyn.empty()){cv::imshow("DynaSLAM: Dynamic Frame", im_dyn);}
chmod +x build.sh
./build.sh
6.1 CMakeLists.txt " -march=native " 删除
6.2 对于5.2的操作,其实不影响编译。
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM3.yaml /home/ljq/TUM/rgbd_dataset_freiburg3_walking_xyz Examples/RGB-D/associations/fr3_walking_xyz.txt maskpath inpaintedFrame
./Examples/RGB-D/rgbd_tum是运行命令,Vocabulary/ORBvoc.txt Examples/RGB-D/TUM3.yaml是配置文件yaml路径,/home/ljq/TUM/rgbd_dataset_freiburg3_walking_xyz是我的fr3_walking_xyz路径,Examples/RGB-D/associations/fr3_walking_xyz.txt的fr3_walking_xyz.txt其实是TUM数据集执行python associate.py rgb.txt depth.txt > associations.txt后生成的associations.txt,在源码的associations中一共有8个。
其中maskpath和inpaintedFrame是自己创建的目录,maskpask如果不指定的话就不调用深度学习框架进行动态目标检测,inpaintedFrame如何不指定的话就不进行背景修复,运行中如果出现错误初始化不成功,可以在tum文件中修改(提高)特征点数目(gedit Examples/RGB-D/TUM3.yaml)(默认1000,改为3000)
参考自:[开源项目配置排坑]DynaSLAM - 知乎