GithubHelp home page GithubHelp logo

kaju-bubanja / posecnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuxng/posecnn

19.0 5.0 5.0 7.69 MB

A Convolutional Neural Network for 6D Object Pose Estimation in Cluttered Scenes

Home Page: https://rse-lab.cs.washington.edu/projects/posecnn/

License: MIT License

MATLAB 0.08% Shell 4.72% Makefile 0.01% Python 39.86% C++ 45.80% CMake 1.12% C 0.06% GLSL 0.43% Cuda 7.94%

posecnn's Introduction

PoseCNN: A Convolutional Neural Network for 6D Object Pose Estimation in Cluttered Scenes

Created by Yu Xiang at RSE-Lab at University of Washington and NVIDIA Research.

Introduction

We introduce PoseCNN, a new Convolutional Neural Network for 6D object pose estimation. PoseCNN estimates the 3D translation of an object by localizing its center in the image and predicting its distance from the camera. The 3D rotation of the object is estimated by regressing to a quaternion representation. arXiv, Project

PoseCNN

License

PoseCNN is released under the MIT License (refer to the LICENSE file for details).

Citation

If you find PoseCNN useful in your research, please consider citing:

@inproceedings{xiang2018posecnn,
    Author = {Xiang, Yu and Schmidt, Tanner and Narayanan, Venkatraman and Fox, Dieter},
    Title = {PoseCNN: A Convolutional Neural Network for 6D Object Pose Estimation in Cluttered Scenes},
    Journal   = {Robotics: Science and Systems (RSS)},
    Year = {2018}
}

Installation

  1. Install TensorFlow version r1.8 from source, binaries won't work because of ABI incompatibilities.

    1. You need exactly r1.8, gcc 4.8.(tested with 4.8.5, 6.3. will not work) and bazel 0.10.0 even though bazel 0.9.0 is recommended here, see following issue. Bazel 0.17.0 also does not work and probably other Bazel versions don't work either so really use 0.10.0
    2. Make a virtualenv with and add these packages, otherwise tf can not be build by source: pip install mock keras Cython easydict transforms3d(the last two are needed for later to actually run the demo)
  2. Download the VGG16 weights from here (528M). Put the weight file vgg16.npy to $ROOT/data/imagenet_models.

  3. Get dependencies: sudo apt-get install libsuitesparse-dev openexr libopenexr-dev metis libmetis-dev

  4. Compile lib/kinect_fusion to be able to compile lib/synthesize.

    1. Add nanoflann to the include dirs in cmake and sohpus to the include and link dirs
    2. Comment /usr/local/cuda/include/crt/common_functions.h line 64: see this issue
    3. If Pangolin is already installed, reinstall Pangolin, since it will be pointing at the old eigen which has the cuda bug mentioned here: https://devtalk.nvidia.com/default/topic/1026622/cuda-programming-and-performance/nvcc-can-t-compile-code-that-uses-eigen/
  5. Compile lib/synthesize with cmake. This package contains a few useful tools such as generating synthetic images for training and ICP.

    Install dependencies with exactly these commits. I tried other commits and they all broke/did not build:

    • Python version 2.7, 3.X won't work
    • Pangolin commit 1ec721d59ff6b799b9c24b8817f3b7ad2c929b83 worked for me, original author used c2a6ef524401945b493f14f8b5b8aa76cc7d71a9
    • Eigen 3. * . * (tested with 3.3.0 and 3.2.92)
    • boost 1.67.0
    • Sophus commit ceb6380a1584b300e687feeeea8799353d48859f
    • nanoflann commit ad7547f4e6beb1cdb3e360912fd2e352ef959465
    • nlopt Important install from this github repo, not using the instructions here commit 74e647b667f7c4500cdb4f37653e59c29deb9ee2

    We use Boost.Python library to link tensorflow with the c++ code. Make sure you have it in your Boost. The tested Boost version is 1.66.0.

    1. Change hard coded pathes in lib/synthesize/CMakeLists.txt of boost and add sophus paths manually or via find_script. Uncomment line #add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) to fix potential compatibility issues with tf.
    2. Uncomment ${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc from include dirs because of this issue: stevenlovegrove/Pangolin#268
    3. Surpress these warnings so you see errors better.
       add_definitions(-Wno-unused-result)
       add_definitions(-Wno-unused-but-set-variable)
       add_definitions(-Wno-unused-variable)
       add_definitions(-Wno-reorder)
       add_definitions(-Wno-deprecated-declarations)
    
    1. Make GlBuffer(const GlBuffer&) {} public in file /usr/local/include/pangolin/gl/gl.h by commenting line 209. Same goes for line 116
    2. Adapt boost_python and boost_numpy in Cmake line 98/99 to your library name when using boost and python 3.5 it is boost_python27 and boost_numpy27 or symlink these to boots_python and boost_numpy.
    3. Create folder data and models under data/LOV and add or symlink the data and models into there
  6. Uncomment line 64 in /usr/local/cuda/include/crt/common_functions.h

  7. Download the sun2012 dataset. Unzip the contents of it into the folder PoseCNN/data/Sun2012/data.

  8. Download ObjectNet3D from ftp://cs.stanford.edu/cs/cvgl/ObjectNet3D/ObjectNet3D_images.zip. Unzip the contents of it into the folder PoseCNN/data/ObjectNet3D/data. For why the link is written out see here and bug github about that bug ;)

Notes on ABI Compatibility

Either all packages used need to be built with gcc 4.8.5 or if some use gcc 5 or above all above packages need following line added to the compilation: -D_GLIBCXX_USE_CXX11_ABI=0
ABI Compatibility issues will manifest themselves through the message "some_lib.so": undefined symbol: "some obfuscated coed snippet". The easiest to get this whole project to compile is to compile every package with the same gcc version. But take care, because per default opencv will be compiled with gcc 5.4 and will get included in various binaries. Check and make sure you link against your custom built binaries using ldd your_binary.so. To give you the above error already at compile time instead of runtime add following to the compile command: -Wl,-z,defs.

Building

Warning nothing can be built in parallel, don't do make -jX just use make

  1. Build kinect_fusion
```Shell
cd $ROOT/lib/kinect_fusion
mkdir build
cd build
cmake ..
make
```
  1. Build synthesize
```Shell
cd $ROOT/lib/synthesize
mkdir build
cd build
cmake ..
make
```
  1. Compile the new layers under $ROOT/lib we introduce in PoseCNN. Shell cd $ROOT/lib sh make.sh

  2. run python setup python setup.py build_ext --inplace

  3. Add pythonpaths

Add the path of the built libary libsynthesizer.so to python path
```Shell
export PYTHONPATH=$PYTHONPATH:$ROOT/lib:$ROOT/lib/synthesize/build
```

Required environment

  • Ubuntu 16.04
  • Tensorflow >= 1.2.0
  • CUDA >= 8.0

Running the demo

  1. Download our trained model on the YCB-Video dataset from here, and save it to $ROOT/data/demo_models.

  2. run the following script

    ./experiments/scripts/demo.sh $GPU_ID

Running on the YCB-Video dataset

  1. Download the YCB-Video dataset from here.

  2. Create a symlink for the YCB-Video dataset (the name LOV is due to legacy, Learning Objects from Videos)

    cd $ROOT/data/LOV
    ln -s $ycb_data data
    ln -s $ycb_models models
  3. Training and testing on the YCB-Video dataset

    cd $ROOT
    
    # training
    ./experiments/scripts/lov_color_2d_train.sh $GPU_ID
    
    # testing
    ./experiments/scripts/lov_color_2d_test.sh $GPU_ID
    

posecnn's People

Contributors

cvpr20213dvr avatar kaju-bubanja avatar yuxng avatar

Stargazers

 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

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.