GithubHelp home page GithubHelp logo

nvlabs / poserbpf Goto Github PK

View Code? Open in Web Editor NEW
134.0 10.0 31.0 27.61 MB

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

License: Other

Shell 5.78% Python 42.78% C++ 3.03% Cuda 7.05% CMake 0.05% C 41.31%

poserbpf's Introduction

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.

poserbpf's People

Contributors

rowoflo avatar xinkeae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

poserbpf's Issues

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.

Error: no suitable constructor exists to convert from "float" to "Eigen::half"

Hi, I encounter some problem when I was trying to compile the utility functions with:

sh build.sh

It shows that:

fatal error: Eigen/Core: No such file or directory

As recommended online, I installed eigen3 and also added the following line into CMakelist.txt:

find_package(Eigen3 REQUIRED)

It still not working, so I also changed the header file from # include <Eigen/Core> to # include <eigen3/Eigen/Core>, but it still failed. The error message is as below:

/usr/local/cuda-10.1/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

Then I commented the above line in /usr/local/cuda-10.1/include/crt/common_functions.h:74:24: as recommended online, the error comes as:

/usr/include/eigen3/Eigen/src/Core/arch/CUDA/Half.h(596): error: no suitable constructor exists to convert from "float" to "Eigen::half"

Any idea for this error?
By the way, are there any pose estimation results (the estimated poses ) on T-LESS test dataset and YCB-Video test dataset available? I am trying to analyze the distribution of the estimated poses for different methods. Thanks a lot!

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

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.

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

Error: subprocess.CalledProcessError: Command '['build/query_devices']' died with <Signals.SIGSEGV: 11>.

Error

When running python ycb_renderer.py, the following error occurs. Though I can built CppYCBRenderer successfully, there seems to be some mistakes in it.

Traceback (most recent call last):
  File "ycb_renderer.py", line 702, in <module>
    renderer = YCBRenderer(w, h, render_marker=False)
  File "ycb_renderer.py", line 80, in __init__
    self.r = CppYCBRenderer.CppYCBRenderer(width, height, get_available_devices()[gpu_id])
  File "/data2/fbw/PoseRBPF/ycb_render/get_available_devices.py", line 7, in get_available_devices
    num_devices = int(subprocess.check_output(["{}/query_devices".format(executable_path)]))
  File "/home/fbw/anaconda3/envs/pose_rbpf_env/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/home/fbw/anaconda3/envs/pose_rbpf_env/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/data2/fbw/PoseRBPF/ycb_render/build/query_devices']' died with <Signals.SIGSEGV: 11>.

When running get_available_devices.py, a similar error occurs.

Traceback (most recent call last):
  File "get_available_devices.py", line 26, in <module>
    print(get_available_devices())
  File "get_available_devices.py", line 7, in get_available_devices
    num_devices = int(subprocess.check_output(["{}/query_devices".format(executable_path)]))
  File "/home/fbw/anaconda3/envs/pose_rbpf_env/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/home/fbw/anaconda3/envs/pose_rbpf_env/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['build/query_devices']' died with <Signals.SIGSEGV: 11>.

It seems that there is something wrong during cmake.

Environment

Ubuntu 16.04
cuda 10.0
python 3.6
(using pose_rbpf_env)
cmake 3.5.1
gcc 7.1.0

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.

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

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!

"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:

2020.11.20

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.