GitHub地址:GitHub - hustvl/HAIS: Hierarchical Aggregation for 3D Instance Segmentation (ICCV 2021)
我的配置:
Ubuntu 18.04.6
显卡:RTX3090
cuda:11.7
1) Environment
首先创建一个虚拟环境并激活
conda create -n hais python=3.7
conda activate hais
2) 克隆项目
git clone https://github.com/hustvl/HAIS.git --recursive
3) 安装依赖包
cd HAIS
pip install -r requirements.txt #注意把文档里面的第一行删掉,我们要自己指定torch版本
conda install -c bioconda google-sparsehash
注意根据你的显卡、cuda版本来安装pytorch,我这里用的是conda命令,我pip安装的最终无法运行训练。
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
4) 安装编译 spconv ,这一步应该是最容易出问题的。
- spconv 1.0,兼容CUDA < 11和pytorch < 1.5,默认情况下已经在步骤2中递归地克隆到HAIS/lib/spconv中。对于更高版本的CUDA和pytorch,建议使用spconv 1.2。用spconv的这个分支替换HAIS/lib/spconv。
这里我的cuda版本11.7和pytorch1.8要求必须安装spconv1.2版本,于是要先执行git操作,替换掉原代码中的spconv文件夹。如果执意要用作者给出的1.0版本 编译会报错的。
git clone https://github.com/outsidercsy/spconv.git --recursive
- 安装依赖.
conda install libboost
conda install -c daleydeng gcc-5 # (optional, install gcc-5.4 in conda env)
- 编译 spconv library.
cd HAIS/lib/spconv
python setup.py bdist_wheel
- 安装生成的 .whl file.
cd HAIS/lib/spconv/dist
pip install {wheel_file_name}.whl
5) 编译额外的C++ and CUDA ops.
cd HAIS/lib/hais_ops
export CPLUS_INCLUDE_PATH={conda_env_path}/hais/include:$CPLUS_INCLUDE_PATH
python setup.py build_ext develop
{conda_env_path} is the location of the created conda environment, e.g., /anaconda3/envs.