A Rao-Blackwellized Particle Filter for 6D Object Pose Tracking

Overview

PoseRBPF: A Rao-Blackwellized Particle Filter for 6D Object Pose Tracking

PoseRBPF

Citing PoseRBPF

If you find the PoseRBPF code useful, please consider citing:

@inproceedings{deng2019pose,
author    = {Xinke Deng and Arsalan Mousavian and Yu Xiang and Fei Xia and Timothy Bretl and Dieter Fox},
title     = {PoseRBPF: A Rao-Blackwellized Particle Filter for 6D Object Pose Tracking},
booktitle = {Robotics: Science and Systems (RSS)},
year      = {2019}
}
@inproceedings{deng2020self,
author    = {Xinke Deng and Yu Xiang and Arsalan Mousavian and Clemens Eppner and Timothy Bretl and Dieter Fox},
title     = {Self-supervised 6D Object Pose Estimation for Robot Manipulation},
booktitle = {International Conference on Robotics and Automation (ICRA)},
year      = {2020}
}

Installation

git clone https://github.com/NVlabs/PoseRBPF.git --recursive

Install dependencies:

  • install anaconda according to the official website.
  • create the virtual env with pose_rbpf_env.yml:
conda env create -f pose_rbpf_env.yml
conda activate pose_rbpf_env
  • compile the YCB Renderer according to the instruction.
  • compile the utility functions with:
sh build.sh

Download

Downolad files as needed. Extract CAD models under the cad_models directory, and extract model weights under the checkpoints directory.

A quick demo on the YCB Video Dataset

demo

  • The demo shows tracking 003_cracker_box on YCB Video Dataset.
  • Run script download_demo.sh to download checkpoint (434 MB), CAD models (743 MB), 2D detections (13 MB), and necessary data (3 GB) for the demo:
./scripts/download_demo.sh
  • Then you should have files organized like:
├── ...
├── PoseRBPF
|   |── cad_models
|   |   |── ycb_models
|   |   └── ...
|   |── checkpoints
|   |   |── ycb_ckpts_roi_rgbd
|   |   |── ycb_codebooks_roi_rgbd
|   |   |── ycb_configs_roi_rgbd
|   |   └── ... 
|   |── detections
|   |   |── posecnn_detections
|   |   |── tless_retina_detections 
|   |── config                      # configuration files for training and DPF
|   |── networks                    # auto-encoder networks
|   |── pose_rbpf                   # particle filters
|   └── ...
|── YCB_Video_Dataset               # to store ycb data
|   |── cameras
|   |── data 
|   |── image_sets 
|   |── keyframes 
|   |── poses
|   └── ...
└── ...
  • Run demo with 003_cracker_box. The results will be stored in ./results/
./scripts/run_demo.sh

Online Real-world Pose Estimation using ROS

ros_demo

  • Due to the incompatibility between ROS Kinetic and Python 3, the ROS node only runs with Python 2.7. We first create the virtual env with pose_rbpf_env_py2.yml:
conda env create -f pose_rbpf_env_py2.yml
conda activate pose_rbpf_env_py2
  • compile the YCB Renderer according to the instruction.
  • compile the utility functions with:
sh build.sh
  • Make sure you can run the demo above first.
  • Install ROS if it's not there:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
  • Update python packages:
conda install -c auto catkin_pkg
pip install -U rosdep rosinstall_generator wstool rosinstall six vcstools
pip install msgpack
pip install empy
  • Source ROS (every time before launching the node):
source /opt/ros/kinetic/setup.bash
  • Initialze rosdep:
sudo rosdep init
rosdep update

Single object tracking demo:

  • Download demo rosbag:
./scripts/download_ros_demo.sh
  • Run PoseCNN node (with roscore running in another terminal, download PoseCNN weights first):
./scripts/run_ros_demo_posecnn.sh
  • Run PoseRBPF node for RGB-D tracking (with roscore running in another terminal):
./scripts/run_ros_demo.sh
  • (Optional) For RGB tracking run this command instead:
./scripts/run_ros_demo_rgb.sh
  • Run RVIZ in the PoseRBPF directory:
rosrun rviz rviz -d ./ros/tracking.rviz
  • Once you see *** PoseRBPF Ready ... in the PoseRBPF terminal, run rosbag in another terminal, then you should be able to see the tracking demo:
rosbag play ./ros_data/demo_single.bag

Multiple object tracking demo:

  • Download demo rosbag:
./scripts/download_ros_demo_multiple.sh
  • Run PoseCNN node (with roscore running in another terminal, download PoseCNN weights first):
./scripts/run_ros_demo_posecnn.sh
  • Run PoseRBPF node with self-supervised trained RGB Auto-encoder weights:
./scripts/run_ros_demo_rgb_multiple_ssv.sh
  • (Optional) Run PoseRBPF node with RGB-D Auto-encoder weights instead:
./scripts/run_ros_demo_multiple.sh
  • (Optional) Run PoseRBPF node with RGB Auto-encoder weights instead:
./scripts/run_ros_demo_rgb_multiple.sh
  • Run RVIZ in the PoseRBPF directory:
rosrun rviz rviz -d ./ros/tracking.rviz
  • Once you see *** PoseRBPF Ready ... in the PoseRBPF terminal, run rosbag in another terminal, then you should be able to see the tracking demo:
rosbag play ./ros_data/demo_multiple.bag

Note that PoseRBPF takes certain time to initialize each object before tracking. You can pause the ROS bag by pressing space for initialization, and then press space again to resume tracking.

Testing on the YCB Video Dataset

  • Download checkpoints from the google drive folder (ycb_rgbd_full.tar.gz or ycb_rgb_full.tar.gz) and unzip to the checkpoint directory.
  • Download all the data in the YCB Video Dataset so the ../YCB_Video_Dataset/data folder contains all the sequences.
  • Run RGB-D tracking (use 002_master_chef_can as an example here):
sh scripts/test_ycb_rgbd/val_ycb_002_rgbd.sh 0 1
  • Run RGB tracking (use 002_master_chef_can as an example here):
sh scripts/test_ycb_rgb/val_ycb_002_rgb.sh 0 1

Testing on the T-LESS Dataset

  • Download checkpoints from the google drive folder (tless_rgbd_full.tar.gz or tless_rgb_full.tar.gz) and unzip to the checkpoint directory.
  • Download all the data in the T-LESS Dataset so the ../TLess/ folder contains all the sequences.
  • Download all the models for T-LESS objects from the google drive folder.
  • Then you should have files organized like:
├── ...
├── PoseRBPF
|   |── cad_models
|   |   |── ycb_models
|   |   |── tless_models
|   |   └── ...
|   |── checkpoints
|   |   |── tless_ckpts_roi_rgbd
|   |   |── tless_codebooks_roi_rgbd
|   |   |── tless_configs_roi_rgbd
|   |   └── ... 
|   |── detections
|   |   |── posecnn_detections
|   |   |── tless_retina_detections 
|   |── config                      # configuration files for training and DPF
|   |── networks                    # auto-encoder networks
|   |── pose_rbpf                   # particle filters
|   └── ...
|── YCB_Video_Dataset               # to store ycb data
|   |── cameras  
|   |── data 
|   |── image_sets 
|   |── keyframes 
|   |── poses               
|   └── ...   
|── TLess               # to store tless data
|   |── t-less_v2 
|── tless_ckpts_roi_rgbd
|   |   |── test_primesense
|   |   └── ... 
|   └── ...        
└── ...
  • Run RGB-D tracking (use obj_01 as an example here):
sh scripts/test_tless_rgbd/val_tless_01_rgbd.sh 0 1
  • Run RGB tracking (use obj_01 as an example here):
sh scripts/test_tless_rgb/val_tless_01_rgb.sh 0 1

Testing on the DexYCB Dataset

  • Download checkpoints from the google drive folder (ycb_rgbd_full.tar.gz or ycb_rgb_full.tar.gz) and unzip to the checkpoint directory.

  • 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
  • Install PyTorch PoseCNN layers according to the instructions here.

  • Run RGB-D tracking:

    ./scripts/test_dex_rgbd/dex_ycb_test_rgbd_s0.sh $GPU_ID
    
  • Run RGB tracking:

    ./scripts/test_dex_rgb/dex_ycb_test_rgb_s0.sh $GPU_ID
    

Training

  • Download microsoft coco dataset 2017 val images from here for data augmentation.
  • Store the folder val2017 in ../coco/
  • Run training example for 002_master_chef_can in the YCB objects. The training should be able to run on one single NVIDIA TITAN Xp GPU:
sh scripts/train_ycb_rgbd/train_script_ycb_002.sh

Acknowledgements

We have referred to part of the RoI align code from maskrcnn-benchmark.

License

PoseRBPF is licensed under the NVIDIA Source Code License - Non-commercial.

Comments
  • YCB-render Error with

    YCB-render Error with "Segmentation fault" due to "eglQueryDevicesEXT"

    Error

    I have successfully build ycb_render locally. When running python ycb_renderer.py or ./build/query_devices or ./build/test_device, it bumps up with Segmentation fault (core dumped). After debugging, I found the problem to be exactly the function eglQueryDevicesEXT which raises the error.

    BTW, I printed out the result of egl_error which is equal to EGL_SUCCESS and seems not the problem. I also tried to print the result of gladLoadGL(eglGetProcAddress), but the result is false, so it might have something to do with gpu stuff, I guess?

    System

    • Ubuntu 16.04
    • NVCC 10.0
    • pytorch 1.4.0 + cudatoolkit 100
    • python 3.8
    opened by greatwallet 4
  • Error: Compile YCB_renderer: pybind11 folder does not contain a CMakeLists.txt file.

    Error: Compile YCB_renderer: pybind11 folder does not contain a CMakeLists.txt file.

    Thanks for sharing the code. I tried to compile the YCB_renderer, while error occurs when I was trying to run the following command:

    python setup.py develop
    

    The error information are as follows:

    running develop
    running egg_info
    writing CppYCBRenderer.egg-info/PKG-INFO
    writing dependency_links to CppYCBRenderer.egg-info/dependency_links.txt
    writing top-level names to CppYCBRenderer.egg-info/top_level.txt
    reading manifest file 'CppYCBRenderer.egg-info/SOURCES.txt'
    writing manifest file 'CppYCBRenderer.egg-info/SOURCES.txt'
    running build_ext
    CMake Error at CMakeLists.txt:9 (add_subdirectory):
      The source directory
    
        /home/linfang/Documents/Code/PoseRBPF-master/ycb_render/pybind11
    
      does not contain a CMakeLists.txt file.
    
    -- Configuring incomplete, errors occurred!
    See also "/home/linfang/Documents/Code/PoseRBPF-master/ycb_render/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeOutput.log".
    See also "/home/linfang/Documents/Code/PoseRBPF-master/ycb_render/build/temp.linux-x86_64-3.6/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "setup.py", line 76, in <module>
        zip_safe=False,
      File "/home/linfang/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "/home/linfang/anaconda3/envs/pose_rbpf_env/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/linfang/anaconda3/envs/pose_rbpf_env/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/home/linfang/anaconda3/envs/pose_rbpf_env/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/linfang/.local/lib/python3.6/site-packages/setuptools/command/develop.py", line 38, in run
        self.install_for_development()
      File "/home/linfang/.local/lib/python3.6/site-packages/setuptools/command/develop.py", line 140, in install_for_development
        self.run_command('build_ext')
      File "/home/linfang/anaconda3/envs/pose_rbpf_env/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/linfang/anaconda3/envs/pose_rbpf_env/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "setup.py", line 33, in run
        self.build_extension(ext)
      File "setup.py", line 62, in build_extension
        cmake_args, cwd=self.build_temp, env=env)
      File "/home/linfang/anaconda3/envs/pose_rbpf_env/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '/home/linfang/Documents/Code/PoseRBPF-master/ycb_render', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/linfang/Documents/Code/PoseRBPF-master/ycb_render', '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/home/linfang/Documents/Code/PoseRBPF-master/ycb_render/build', '-DPYTHON_EXECUTABLE=/home/linfang/anaconda3/envs/pose_rbpf_env/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
    

    By the way, pybind11 folder is empty. Did I missed any necessary operation before running this command? Thanks in advance!

    opened by Lynne-Zheng-Linfang 2
  • "Sophus" library build guide should be mentioned in "Readme"

    A lot of *.cu files includes "sophus" library, like utils/sdf_layer/sdf_matching_loss_kernel.cu , which I don't think is quite a common library.

    I think maybe you should add some info on how to build sophus in README (some referece or links at least).

    Take ubuntu 16.04 as an example, building sophus takes quite more effort than newer OSes, since one of the dependent lib Eigen in ubuntu 16.04 is in version 3.2 by apt-get install libeigen3-dev, and does not support up-to-dated Ceres-Solver and sophus.

    My solution:

    1. build eigen 3.3.8 (up-to-dated) in "http://eigen.tuxfamily.org/index.php?title=Main_Page" (instead of sudo apt-get install libeigen3-dev) and make sure it's in /usr/local/include
    2. build ceres-solver 2.0.0 from "https://ceres-solver.googlesource.com/ceres-solver" and make sure it's in /usr/local/include
    3. build Sophus from "https://github.com/strasdat/Sophus" and make sure it's in /usr/local/include
    4. change directory to PoseRBPF and build everything.

    Reference:

    • Installation on ceres-solver, including download links of release in "http://ceres-solver.org/installation.html"
    • Some guides on sophus installation in "https://blog.csdn.net/weixin_44684139/article/details/104803225"

    2020.11.20

    opened by greatwallet 1
  • Hardware Setup?

    Hardware Setup?

    I worked through the installation steps provided and was able to successfully build everything, but when I attempted to run the demo script, it froze the computer and forced it to reboot. Is there any special hardware configuration required? I was trying to run it on a Quadro RTX 8000, so I didn't think hardware specs would be an issue.

    opened by NoahS-Magna 0
  • Compile the utility functions FAILED

    Compile the utility functions FAILED

    I followed the installation, then when I run sh build.sh, it has many errors and dependency errors:

    1:

    /usr/local/cuda/include/crt/common_functions.h:74:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
     #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
    

    I don't know why it tries to find my locate cuda instead of the virtual environment cuda. I tried many solutions, but it didn't work. Can you help me?

    2: Many other dependency error, like :
    fatal error: sophus/se3.hpp can not found.
    fatal error: fmt/core.h: No such file or directory
    and so on. Can you please put the dependencies in the installation?

    Thanks a lot.

    opened by caicaixia 0
  • How is the obj.pth file(load sdf file) generated for the tless dataset model

    How is the obj.pth file(load sdf file) generated for the tless dataset model

    Thanks to the great work of the author, I have a few questions:

    How is the obj.pth file generated for the tless dataset model

    I hope you can get some answers. Thank you

    opened by tonglily 0
  • questions regarding testing on YCB Video Dataset

    questions regarding testing on YCB Video Dataset

    Here are no ADD(-s) results after running the RGB(-D) tracking scripts on YCB-V dataset. I cannot find any Python files which can output the final ADD(-s) metric and cannot get the same results of YCB-V as in paper.

    opened by Liesy 0
  • Is PoseRBPF compatible with cuda arch 8.6 (RTX 3080)?

    Is PoseRBPF compatible with cuda arch 8.6 (RTX 3080)?

    Compile Error.
    """ Traceback: ... File ".../pose_rbpf_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1027, in _get_cuda_arch_flags ValueError: Unknown CUDA arch (8.6) or GPU not supported

    """ Awaiting for help

    opened by YufengJin 1
  • Would the ycb render work in an Nvidia docker?

    Would the ycb render work in an Nvidia docker?

    Hi, I am trying to compile and run the ycb render in an Nvidia docker. However, build/query_devices and build/test_device cannot find the right OpenGL. Selection_182

    opened by DecaYale 0
  • The error when i run this project in ROS demo!

    The error when i run this project in ROS demo!

    I can run this demo in python3 ,but when i reinstall the env by running conda env create -f pose_rbpf_env_py2.yml and recmake this project ,i run ./scripts/run_demo.sh again , the error occured

    Traceback (most recent call last): File "test_prbpf_rgbd.py", line 123, in <module> pose_rbpf.run_dataset(dataset_test, args.n_seq, only_track_kf=False, kf_skip=1, demo=args.demo) File "/home/hp1/catkin_ws/src/PoseRBPF/pose_rbpf/pose_rbpf.py", line 1410, in run_dataset self.process_poserbpf(images[0], intrinsics, depth=depth_data) File "/home/hp1/catkin_ws/src/PoseRBPF/pose_rbpf/pose_rbpf.py", line 983, in process_poserbpf self.rbpf.weights = np.nan_to_num(self.rbpf.weights, nan=1e-6, posinf=1.0, neginf=1e-6) TypeError: nan_to_num() got an unexpected keyword argument 'nan'

    when i try to run './scripts/run_ros_demo_posecnn.sh'

    Traceback (most recent call last): File "./ros/start_posecnn_ros.py", line 502, in <module> network = networks.__dict__[args.network_name](dataset.num_classes, cfg.TRAIN.NUM_UNITS, network_data).cuda(device=cfg.device) KeyError: 'posecnn'

    where place should i put PoseCNN weights ? maybe i just put it in the wrong place,i don't know

    can you help me ? thank you very much

    opened by makangzhe 2
Owner
NVIDIA Research Projects
NVIDIA Research Projects
particle tracking model, works with the ROMS output file(qck.nc, his.nc)

particle-tracking-model-for-ROMS particle tracking model, works with the ROMS output file(qck.nc, his.nc) description this is a 2-dimensional particle

xusheng 1 Jan 11, 2022
SE3 Pose Interp - Interpolate camera pose or trajectory in SE3, pose interpolation, trajectory interpolation

SE3 Pose Interpolation Pose estimated from SLAM system are always discrete, and

Ran Cheng 4 Dec 15, 2022
A simple implementation of Kalman filter in single object tracking

kalman-filter-in-single-object-tracking A simple implementation of Kalman filter in single object tracking https://www.bilibili.com/video/BV1Qf4y1J7D4

null 130 Dec 26, 2022
Python package for multiple object tracking research with focus on laboratory animals tracking.

motutils is a Python package for multiple object tracking research with focus on laboratory animals tracking. Features loads: MOTChallenge CSV, sleap

Matěj Šmíd 2 Sep 5, 2022
Symmetry and Uncertainty-Aware Object SLAM for 6DoF Object Pose Estimation

SUO-SLAM This repository hosts the code for our CVPR 2022 paper "Symmetry and Uncertainty-Aware Object SLAM for 6DoF Object Pose Estimation". ArXiv li

Robot Perception & Navigation Group (RPNG) 97 Jan 3, 2023
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022
Object Detection and Multi-Object Tracking

Object Detection and Multi-Object Tracking

Bobby Chen 1.6k Jan 4, 2023
TSDF++: A Multi-Object Formulation for Dynamic Object Tracking and Reconstruction

TSDF++: A Multi-Object Formulation for Dynamic Object Tracking and Reconstruction TSDF++ is a novel multi-object TSDF formulation that can encode mult

ETHZ ASL 130 Dec 29, 2022
Object tracking and object detection is applied to track golf puts in real time and display stats/games.

Putting_Game Object tracking and object detection is applied to track golf puts in real time and display stats/games. Works best with the Perfect Prac

Max 1 Dec 29, 2021
Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony Optimization Algorithm,Immune Algorithm, Artificial Fish Swarm Algorithm, Differential Evolution and TSP(Traveling salesman)

scikit-opt Swarm Intelligence in Python (Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony Algorithm, Immune Algorithm,A

郭飞 3.7k Jan 3, 2023
A research toolkit for particle swarm optimization in Python

PySwarms is an extensible research toolkit for particle swarm optimization (PSO) in Python. It is intended for swarm intelligence researchers, practit

Lj Miranda 1k Dec 30, 2022
Implemented fully documented Particle Swarm Optimization algorithm (basic model with few advanced features) using Python programming language

Implemented fully documented Particle Swarm Optimization (PSO) algorithm in Python which includes a basic model along with few advanced features such as updating inertia weight, cognitive, social learning coefficients and maximum velocity of the particle.

null 9 Nov 29, 2022
Official implementation of particle-based models (GNS and DPI-Net) on the Physion dataset.

Physion: Evaluating Physical Prediction from Vision in Humans and Machines [paper] Daniel M. Bear, Elias Wang, Damian Mrowca, Felix J. Binder, Hsiao-Y

Hsiao-Yu Fish Tung 18 Dec 19, 2022
Racing line optimization algorithm in python that uses Particle Swarm Optimization.

Racing Line Optimization with PSO This repository contains a racing line optimization algorithm in python that uses Particle Swarm Optimization. Requi

Parsa Dahesh 6 Dec 14, 2022
Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab

PySDM PySDM is a package for simulating the dynamics of population of particles. It is intended to serve as a building block for simulation systems mo

Atmospheric Cloud Simulation Group @ Jagiellonian University 32 Oct 18, 2022
Simple Pose: Rethinking and Improving a Bottom-up Approach for Multi-Person Pose Estimation

SimplePose Code and pre-trained models for our paper, “Simple Pose: Rethinking and Improving a Bottom-up Approach for Multi-Person Pose Estimation”, a

Jia Li 256 Dec 24, 2022
《Unsupervised 3D Human Pose Representation with Viewpoint and Pose Disentanglement》(ECCV 2020) GitHub: [fig9]

Unsupervised 3D Human Pose Representation [Paper] The implementation of our paper Unsupervised 3D Human Pose Representation with Viewpoint and Pose Di

null 42 Nov 24, 2022
Repository for the paper "PoseAug: A Differentiable Pose Augmentation Framework for 3D Human Pose Estimation", CVPR 2021.

PoseAug: A Differentiable Pose Augmentation Framework for 3D Human Pose Estimation Code repository for the paper: PoseAug: A Differentiable Pose Augme

Pyjcsx 328 Dec 17, 2022