Skip to content

lovish1234/ODP

Repository files navigation

Optional Depth Module for MaskRCNN

Joint work with Jianjin Xu and Zhaoyang Wang

This is the code base for reproducing the experiment.

This is demo video.

Runnning the code

Preparation

  1. Install maskrcnn-benchmark according to the instructions

  2. Prepare the NYUv2 dataset. Under the project root dir execute:

export DATA_HOME=./maskrcnn-benchmark/datasets/NYUv2/
mkdir $DATA_HOME
cp COCOLikeNYUV2.zip $DATA_HOME
cd $DATA_HOME
unzip COCOLikeNYUV2.zip
wget http://www.doc.ic.ac.uk/~ahanda/nyu_train_rgb.tgz
wget http://www.doc.ic.ac.uk/~ahanda/nyu_test_rgb.tgz
tar -xvf nyu_train_rgb.tgz
tar -xvf nyu_test_rgb.tgz

Under $DATA_HOME download the depth file from google drive.

  1. To train ED-MaskRCNN, you need to download all the estimated depth data from google drive and also place under $DATA_HOME.

Train networks

  1. RGB-MaskRCNN

python tools/train_net.py --config-file "configs/NYUBaselineFT.yaml"

  1. RGBD-MaskRCNN

python tools/train_net.py --config-file "configs/NYUDepthFT.yaml"

  1. ZD-MaskRCNN

python tools/train_net.py --config-file "configs/NYUProbDepthFT.yaml

  1. ED-MaskRCNN

Make sure preparation step 3 is completed, then run

python tools/train_net.py --config-file "configs/NYUProbDenseDepthPretrained.yaml"
  1. SPADE-MaskRCNN

First make sure RGB-MaskRCNN is trained. If you follow the standard instruction, the RGB-MaskRCNN should be stored in expr/nyuv2_baseline_26_maskrcnn. Then run the following command:

# extract the weight from checkpoint file
python tools/extract_weights.py expr/nyuv2_baseline_26_maskrcnn/model_final.pth pretrained/rgb_baseline_26_imagenet.pth
# option III
python tools/train_net.py --config-file "configs/NYUSPADEFinetune_onrgb.yaml"
# extract the weight from checkpoint file
python tools/extract_weights.py expr/nyuv2_spade_ft_1_imagenet/model_final.pth pretrained/spade_ft1_26_imagenet.pth
# option IV
python tools/train_net.py --config-file "configs/NYUSPADEFinetune_onspade.yaml"

Test the networks

Enter maskrcnn_benchmark folder. The script will test all the .pth file under <path of expr dir> with depth and without depth.

python tools/testall.py <path of expr> <path of config>
python collect_result.py
  1. RGB-MaskRCNN
python tools/testall.py expr/nyuv2_baseline_26_maskrcnn configs/NYUBaselineFT.yaml
  1. RGBD-MaskRCNN

  2. ZD-MaskRCNN

  3. ED-MaskRCNN

  4. SPADE-MaskRCNN

# testing model train by option I+II+III
python tools/testall.py expr/nyuv2_spade_ft_1_imagenet configs/NYUSPADE_26.yaml
# testing model trained by option I+II+III+IV
python tools/testall.py expr/nyuv2_spade_ft_2_imagenet configs/NYUSPADE_26.yaml

Visualize the results

This script will visualize all the results collected by collect_result.py.

python tools/visualize.py

About

Optional Depth Pathway for Mask R-CNN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published