We implement DeepIM in PyTorch in this project.
DeepIM is a deep neural network for 6D pose matching. Given an initial pose estimation, DeepIM is able to iteratively refine the pose by matching the rendered image against the observed image. The network is trained to predict a relative pose transformation using an untangled representation of 3D location and 3D orientation and an iterative training process. pdf, Project
DeepIM-PyTorch is released under the NVIDIA Source Code License (refer to the LICENSE file for details).
If you find DeepIM useful in your research, please consider citing:
@inproceedings{li2017deepim,
Author = {Yi Li and Gu Wang and Xiangyang Ji and Yu Xiang and Dieter Fox},
Title = {{DeepIM}: Deep Iterative Matching for {6D} Pose Estimation},
booktitle = {European Conference Computer Vision (ECCV)},
Year = {2018}
}
- Ubuntu 16.04 or above
- PyTorch 0.4.1 or above
- CUDA 9.1 or above
Use python3. If ROS is needed, compile with python2.
-
Install PyTorch.
-
Install python packages
pip install -r requirement.txt
-
Initialize the submodules in ycb_render
git submodule update --init --recursive
-
Compile the point matching loss layer in $ROOT/lib.
cd $ROOT/lib/point_matching_loss sudo python setup.py install
-
Compile cython components
cd $ROOT/lib/utils python setup.py build_ext --inplace
-
Compile the ycb_render in $ROOT/ycb_render
cd $ROOT/ycb_render sudo python setup.py develop
-
3D models of YCB Objects we used here (3G). Save under $ROOT/data or use a symbol link.
-
Our pre-trained checkpoints here (3.6G). Save under $ROOT/data or use a symbol link.
-
Our real-world images with pose annotations for 20 YCB objects collected via robot interation here (53G). Check our ICRA 2020 paper for details.
-
Download 3D models and our pre-trained checkpoints first.
-
run the following script
# testing on color ./experiments/scripts/demo.sh # testing on RGB-D ./experiments/scripts/demo_rgbd.sh
-
Download background images, and save to $ROOT/data or use symbol links.
-
Download the pre-trained FlowNetSimple weights from here (148M). Put the weight file to $ROOT/data/checkpoints. If our pre-trained models are already downloaded, the FlowNetSimpe checkpoint should be in $ROOT/data/checkpoints already.
-
Training and testing for 20 YCB objects with synthetic data. Modify the configuration file for training on a subset of these objects.
cd $ROOT # multi-gpu training, we used 4 GPUs ./experiments/scripts/ycb_object_flow_train.sh # testing, $GPU_ID can be 0, 1, etc. ./experiments/scripts/ycb_object_flow_test.sh $GPU_ID $EPOCH
-
Download the YCB-Video dataset from here.
-
Create a symlink for the YCB-Video dataset
cd $ROOT/data/YCB_Video ln -s $ycb_data data
-
Download the PoseCNN results on the keyframes from here. Save to $ROOT/data/YCB_Video.
-
Training and testing on the YCB-Video dataset
cd $ROOT # multiple GPU training, we used 4 GPUs ./experiments/scripts/ycb_video_flow_train.sh # testing, $GPU_ID can be 0, 1, etc. ./experiments/scripts/ycb_video_flow_test.sh $GPU_ID $EPOCH
-
Download the DexYCB dataset from here.
-
Download PoseCNN results on the DexYCB dataset from here.
-
Create a symlink for the DexYCB dataset and the PoseCNN results
cd $ROOT/data/DEX_YCB ln -s $dex_ycb_data data ln -s $results_posecnn_data results_posecnn
-
Training and testing on the DexYCB dataset
cd $ROOT # multi-gpu training for different splits, we used 4 GPUs ./experiments/scripts/dex_ycb_flow_train_s0.sh ./experiments/scripts/dex_ycb_flow_train_s1.sh ./experiments/scripts/dex_ycb_flow_train_s2.sh ./experiments/scripts/dex_ycb_flow_train_s3.sh # use RGB and depth ./experiments/scripts/dex_ycb_flow_rgbd_train_s0.sh ./experiments/scripts/dex_ycb_flow_rgbd_train_s1.sh ./experiments/scripts/dex_ycb_flow_rgbd_train_s2.sh ./experiments/scripts/dex_ycb_flow_rgbd_train_s3.sh # testing, $GPU_ID can be 0, 1, etc. # our trained models are in checkpoints.zip ./experiments/scripts/dex_ycb_flow_test_s0.sh $GPU_ID $EPOCH ./experiments/scripts/dex_ycb_flow_test_s1.sh $GPU_ID $EPOCH ./experiments/scripts/dex_ycb_flow_test_s2.sh $GPU_ID $EPOCH ./experiments/scripts/dex_ycb_flow_test_s3.sh $GPU_ID $EPOCH # test RGB-D version ./experiments/scripts/dex_ycb_flow_rgbd_test_s0.sh $GPU_ID $EPOCH ./experiments/scripts/dex_ycb_flow_rgbd_test_s1.sh $GPU_ID $EPOCH ./experiments/scripts/dex_ycb_flow_rgbd_test_s2.sh $GPU_ID $EPOCH ./experiments/scripts/dex_ycb_flow_rgbd_test_s3.sh $GPU_ID $EPOCH
-
Python2 is needed for ROS.
-
Make sure our pretrained checkpoints are downloaded.
-
Make sure PoseCNN is running to provide initial pose estimation to DeepIM.
# start realsense
roslaunch realsense2_camera rs_aligned_depth.launch tf_prefix:=measured/camera
# start PoseCNN
# run deepim with color only, $GPU_ID can be 0, 1, etc.
./experiments/scripts/ros_ycb_object_test.sh $GPU_ID
# or run deepim with RGB-D, $GPU_ID can be 0, 1, etc.
./experiments/scripts/ros_ycb_object_rgbd_test.sh $GPU_ID
Our example: