前言
本文复现的论文都是出自同一位作者,主要研究的问题是物体姿态检测,其中有基于CAD模型的、不基于CAD模型的方法到模型重建的方法,值得学习。
BundleSDF
一、构建环境
项目地址:https://github.com/NVlabs/BundleSDF
BundleSDF中没有提供官方的docker image,需要自己构建。构建过程中可能会遇到以下问题:
-
缺少libfreeimage.so文件。解决方法:下载该文件,修改dockerfile,将文件从本机复制过去
#git clone https://github.com/imageio/imageio-binaries.git #需要的文件在这个仓库里 # 在docker file中添加 COPY ./imageio-binaries/freeimage/libfreeimage-3.16.0-linux64.so /.imageio/freeimage #RUN imageio_download_bin freeimage
-
下载对应包时速度较慢。解决方法:更换 pip 源
# 在docker file中添加 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple &&\
接下来需要在容器中启动显卡,需要下载相应的驱动:
# nvidia-container-runtime-script.sh
sudo curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
sudo curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | \
sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
bash nvidia-container-runtime-script.sh
sudo apt-get install -y nvidia-container-toolkit
which nvidia-container-runtime
systemctl restart docker
二、推理
-
`GLIBCXX_3.4.29’ not found
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29’ not found (required by /opt/conda/envs/py38/lib/python3.8/site-packages/scipy/spatial/_ckdtree.cpython-38-x86_64-linux-gnu.so)
pip install scipy==1.8 -
Unable to find a valid cuDNN algorithm to run convolution
这里是因为显卡显存不够了,所以需要减小batch size。
修改了 loftr_wrapper.py 中 batch_size=1
三、结果
我的显卡内存不够,所以推理示例数据时只推理了1500张左右,生成的结果保存在/path/to/output/mech_cleaned.obj&&textured_mesh.obj,在Meshlab中查看重建出来的图如下:
BundleTrack
项目地址:https://github.com/wenbowen123/BundleTrack
遇到的问题:
- illegal instruction (core dumped)
- OpenCV Error no kernel image is available
- feature detection FAIL, ERROR
由于我的显卡比较新,所以在编译时有两个注意的点:
- 下载镜像选择3090的Tag,因为初版使用的CUDA是10.1
- 编译文件时在CMakeLists.txtCUDA编译选项的代码中添加 -gencode arch=compute_86,code=sm_86
se(3)TrackNet
项目地址https://github.com/wenbowen123/iros20-6d-pose-tracking
在1660S显卡上运行报错
-
OpenGL报错上面说
changing -e "DISPLAY=unix:0.0" to -e "DISPLAY=$DISPLAY" in the run_container.sh
-
修改之后,并报了新的错:
OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling
解决方法:没解决,换电脑。
在4060Ti显卡上运行报错
-
CuDNN error while running predict.sh
解决方法:更换Pytorch和CUDA版本# 安装CUDA,注意这个不一定是必须的,因为在下面安装Pytorch的时候,安装了1.10+cu111版本,所以程序运行时调用的也是cu111,但我先安装了CUDA,以作记录 # 进入安装流程时注意不要勾选安装驱动 cat /etc/os-release # 查看Linux版本 wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux.run sudo sh cuda_11.3.1_465.19.01_linux.run #安装pytorch pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html
-
运行容器
在run_container.sh
中加入/path/to/your/se(3)TrackNet
把nvidia-docker run
换成docker run --gpus all
DISPLAY=unix:0.0
不需要改 -
结果
总结
- 以上只是我的个人经验,不同人的设备有不同的错误出现,要多尝试
- 就单纯跑通代码而言,作者已经给了很详细的步骤,我们只需要耐心一些就可以,其中问题多出于自己设备版本不适配上,如CUDA、Pytroch、显卡型号、CPU型号。
- 跑通代码只是第一步,仍需进一步学习。