Running Note for Rigid 3D Scene Flow

Abstract: Scene flow, which is a 3D version of optical flow, represents how each point in an image or point cloud changes in the two preceding and following frames. One paper in CVPR 2021 illustrates a weakly supervised learning of Rigid 3D Scene Flow approach. This article focuses on documenting running process of the official code.

一、安装环境

首先按照 Rigid3DSceneFlow的官方文档安装环境:

1
2
3
4
5
6
7
export CXX=g++-7
conda config --append channels conda-forge
conda create --name rigid_3dsf python=3.7
source activate rigid_3dsf
conda install --file requirements.txt
conda install -c open3d-admin open3d=0.9.0.0
conda install -c intel scikit-learn

注:在我电脑里,所有的安装环境是安装在了py3-mink这个环境名里

1
2
conda create -n py3-mink python=3.7
conda activate py3-mink

二、编译MinkowskiEngine

接下来是安装MinkowskiEngine:

首先安装Pytorch,我的电脑安装的CUDA 11.3,所以需要安装对应版本的Pytorch。

第一个需要注意的点是不能用Pytorch官网提供的conda安装,因为安装上的是CPU版本,即使你选择的是GPU,所以需要用pip安装方式。

第二个需要注意的点是,不能安装最新版的Pytorch(1.11.0)和CUDA11.3版本,因为MinkowskiEngine会编译不过(这个问题折腾了一周多的时间)……实践证明,可以编译得过的是如下版本,可以在这里找到:INSTALLING PREVIOUS VERSIONS OF PYTORCH

1
2
conda install openblas-devel -c anaconda
pip install torch==1.10.0+cu111 torchvision==0.11.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html

在正式编译之前还需要确认g++版本,需要g++-7才可以(我的电脑之前是g++-5),具体操作和切换方法参考:安装g++版本7与g++多版本共存

然后就可以编译MinkowskiEngine了:

1
2
3
4
5
6
7
8
9
10
# Install MinkowskiEngine

# Uncomment the following line to specify the cuda home. Make sure `$CUDA_HOME/nvcc --version` is 11.X
# export CUDA_HOME=/usr/local/cuda-11.1
pip install -U git+https://github.com/NVIDIA/MinkowskiEngine -v --no-deps --install-option="--blas_include_dirs=${CONDA_PREFIX}/include" --install-option="--blas=openblas"

# Or if you want local MinkowskiEngine
git clone https://github.com/NVIDIA/MinkowskiEngine.git
cd MinkowskiEngine
python setup.py install --blas_include_dirs=${CONDA_PREFIX}/include --blas=openblas

三、运行Rigid3DSceneFlow

以上便是Rigid3DSceneFlow的环境安装部分,接下来的数据与模型下载和运行就可以按照Rigid3DSceneFlow的描述继续进行了,没啥大问题。

唯一需要注意的一点是,在运行eval.py的时候会报错AttributeError: module 'open3d' has no attribute 'pipelines',是open3d版本更新导致的。解决方法是:搜索文件中出现的 o3d.piplines.xxx ,把.pipelines 删掉,改成o3d.xxx。参考UBUNTU16中OPEN3D算法测试笔记

但是这个工程没法可视化,也没提供可视化代码,需要自己编写代码【TODO】,用KeyShot显示点云,大致流程参考:https://github.com/zgojcic/Rigid3DSceneFlow/issues/3