环境配置
https://github.com/gengshan-y/rigidmask
1.拉取代码
git clone https://github.com/gengshan-y/rigidmask.git
cd rigidmask
2.创建conda环境,修改rigidmask.yml
name: rigidmask
channels:- pytorch- pytorch3d- conda-forge- defaults
dependencies:- python=3.7- numba- tqdm- tbb- joblib- h5py- pytorch=1.7.0- torchvision=0.8.0- cudatoolkit=11.0- pip:- absl-py==0.11.0- cachetools==4.1.1- chardet==3.0.4- cloudpickle==1.6.0- cython==0.29.21- dataclasses==0.6
# - dcnv2==0.1- future==0.18.2- fvcore==0.1.2.post20201122- google-auth==1.23.0- google-auth-oauthlib==0.4.2- grpcio==1.34.0- idna==2.10- joblib==0.17.0
# - kornia==0.4.2+74cc0cf- markdown==3.3.3
# - ngransac==0.0.0- oauthlib==3.1.0# - opencv-python==4.4.0.46- portalocker==2.0.0- protobuf==3.14.0- pyasn1==0.4.8- pyasn1-modules==0.2.8
# - pycocotools==2.0.2- pydot==1.4.1- pypng==0.0.20- pyyaml==5.3.1- requests==2.25.0- requests-oauthlib==1.3.0- rsa==4.6- tabulate==0.8.7- tensorboard==2.4.0- tensorboard-plugin-wit==1.7.0- termcolor==1.1.0- tqdm==4.54.0- urllib3==1.26.2- werkzeug==1.0.1- yacs==0.1.8- imageio==2.9.0- trimesh==3.9.3
conda env create -f rigidmask.yml
conda activate rigidmask
pip install scipy==1.2.0
pip install timm==0.6.5
pip install pytorch3d-0.2.5
pip install opencv-python==3.4.9.33
pip install opencv-contrib-python==3.4.9.33
conda install -c conda-forge kornia=0.5.3 # install a compatible korna version
python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu110/torch1.7/index.html
# sudo apt-get install libopencv-dev
conda install libopencv
DCNv2和ngransac
cd models/networks/DCNv2/; python setup.py install; cd -
cd models/ngransac/; python setup.py install; cd -
测试
1.下载数据集和模型
KITTI-SF: https://s3.eu-central-1.amazonaws.com/avg-kitti/data_scene_flow.zip
Sintel rigidity map : http://files.is.tue.mpg.de/jwulff/mrflow/sintel_rigiditymaps.zip
gdown https://drive.google.com/uc?id=1Up2cPCjzd_HGafw1AB2ijGmiKqaX5KTi -O ./input.tar.gz
gdown https://drive.google.com/uc?id=12C7rl5xS66NpmvtTfikr_2HWL5SakLVY -O ./rigidmask-sf-precomputed.zip
tar -xzvf ./input.tar.gz
unzip ./rigidmask-sf-precomputed.zip -d precomputed/
2.测试一下
# modelname=rigidmask-sf
# CUDA_VISIBLE_DEVICES=1
# python submission.py --dataset seq-coral --datapath input/imgs/coral/ --outdir ./weights/$modelname/ --loadmodel ./weights/$modelname/weights.pth --testres 1
# python eval/generate_visual.py --datapath weights/$modelname/seq-coral/ --imgpath input/imgs/coralmodelname=rigidmask-sf
CUDA_VISIBLE_DEVICES=1
python submission.py --dataset seq-kitti --datapath input/imgs/kitti_2011_09_30_drive_0028_sync_11xx/ --outdir ./weights/$modelname/ --loadmodel ./weights/$modelname/weights.pth --testres 1.2 --refine
python eval/generate_visual.py --datapath weights/$modelname/seq-kitti/ --imgpath input/imgs/kitti_2011_09_30_drive_0028_sync_11xx
# python eval/render_scene.py --inpath weights/rigidmask-sf/seq-kitti/pc0-0000001110.ply