GithubHelp home page GithubHelp logo

megayeye / clean-pvnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zju3dv/clean-pvnet

0.0 1.0 0.0 2.03 MB

Code for "PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation" CVPR 2019 oral

License: Other

Python 84.54% C++ 2.46% Cuda 6.91% C 5.74% GLSL 0.35%

clean-pvnet's Introduction

PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation

introduction

PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation
Sida Peng, Yuan Liu, Qixing Huang, Xiaowei Zhou, Hujun Bao
CVPR 2019 oral
Project Page

Any questions or discussions are welcomed!

Introduction

Thanks Haotong Lin for providing the clean version of PVNet and reproducing the results.

The structure of this project is described in project_structure.md.

Installation

  1. Set up the python environment:
    conda create -n pvnet python=3.7
    conda activate pvnet
    
    # install torch 1.1 built from cuda 9.0
    pip install torch==1.1.0 -f https://download.pytorch.org/whl/cu90/stable
    
    pip install Cython==0.28.2
    sudo apt-get install libglfw3-dev libglfw3
    pip install -r requirements.txt
    
  2. Compile cuda extensions under lib/csrc:
    ROOT=/path/to/clean-pvnet
    cd $ROOT/lib/csrc
    export CUDA_HOME="/usr/local/cuda-9.0"
    cd dcn_v2
    python setup.py build_ext --inplace
    cd ../ransac_voting
    python setup.py build_ext --inplace
    cd ../nn
    python setup.py build_ext --inplace
    cd ../fps
    python setup.py
    
  3. Set up datasets:
    ROOT=/path/to/clean-pvnet
    cd $ROOT/data
    ln -s /path/to/linemod linemod
    ln -s /path/to/linemod_orig linemod_orig
    ln -s /path/to/occlusion_linemod occlusion_linemod
    
    # the following is used for tless
    ln -s /path/to/tless tless
    ln -s /path/to/cache cache
    ln -s /path/to/SUN2012pascalformat sun
    

Download datasets which are formatted for this project:

  1. linemod
  2. linemod_orig: The dataset includes the depth for each image.
  3. occlusion linemod
  4. truncation linemod: Check TRUNCATION_LINEMOD.md for the information about the Truncation LINEMOD dataset.
  5. Tless: cat tlessa* | tar xvf - -C ..
  6. Tless cache data: It is used for training and testing on Tless.
  7. SUN2012pascalformat

Testing

Testing on Linemod

We provide the pretrained models of objects on Linemod, which can be found at here.

Take the testing on cat as an example.

  1. Prepare the data related to cat:
    python run.py --type linemod cls_type cat
    
  2. Download the pretrained model of cat and put it to $ROOT/data/model/pvnet/cat/199.pth.
  3. Test:
python run.py --type evaluate --cfg_file configs/linemod.yaml model cat
python run.py --type evaluate --cfg_file configs/linemod.yaml test.dataset LinemodOccTest model cat
  1. Test with icp:
python run.py --type evaluate --cfg_file configs/linemod.yaml model cat test.icp True
python run.py --type evaluate --cfg_file configs/linemod.yaml test.dataset LinemodOccTest model cat test.icp True

Testing on Tless

We provide the pretrained models of objects on Tless, which can be found at here.

  1. Download the pretrained models and put them to $ROOT/data/model/pvnet/.
  2. Test:
    python run.py --type evaluate --cfg_file configs/tless/tless_01.yaml
    

Visualization

Take the cat as an example.

  1. Prepare the data related to cat:
    python run.py --type linemod cls_type cat
    
  2. Download the pretrained model of cat and put it to $ROOT/data/model/pvnet/cat/199.pth.
  3. Visualize:
python run.py --type visualize --cfg_file configs/linemod.yaml model cat

If setup correctly, the output will look like

cat

Training

Training on Linemod

  1. Prepare the data related to cat:
    python run.py --type linemod cls_type cat
    
  2. Train:
    python train_net.py --cfg_file configs/linemod.yaml model mycat cls_type cat
    

The training parameters can be found in project_structure.md.

Training on Tless

Train:

python train_net.py --cfg_file configs/tless/tless_01.yaml

Tensorboard

tensorboard --logdir data/record/pvnet

If setup correctly, the output will look like

tensorboard

Training on the custom object

  1. Create a dataset using https://github.com/F2Wang/ObjectDatasetTools
  2. Organize the dataset as the following structure:
    ├── /path/to/dataset
    │   ├── model.ply
    │   ├── camera.txt
    │   ├── rgb/
    │   │   ├── 0.jpg
    │   │   ├── ...
    │   │   ├── 1234.jpg
    │   │   ├── ...
    │   ├── mask/
    │   │   ├── 0.png
    │   │   ├── ...
    │   │   ├── 1234.png
    │   │   ├── ...
    │   ├── pose/
    │   │   ├── 0.npy
    │   │   ├── ...
    │   │   ├── 1234.npy
    │   │   ├── ...
    │   │   └──
    
  3. Create a soft link pointing to the dataset:
    ln -s /path/to/custom_dataset data/custom
    
  4. Process the dataset:
    python run.py --type custom
    
  5. Train:
    python train_net.py --cfg_file configs/linemod.yaml train.dataset CustomTrain test.dataset CustomTrain model mycat train.batch_size 4
    
  6. Watch the training curve:
    tensorboard --logdir data/record/pvnet
    
  7. Visualize:
    python run.py --type visualize --cfg_file configs/linemod.yaml train.dataset CustomTrain test.dataset CustomTrain model mycat
    
  8. Test:
    python run.py --type evaluate --cfg_file configs/linemod.yaml train.dataset CustomTrain test.dataset CustomTrain model mycat
    

An example dataset can be downloaded at here.

Citation

If you find this code useful for your research, please use the following BibTeX entry.

@inproceedings{peng2019pvnet,
  title={PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation},
  author={Peng, Sida and Liu, Yuan and Huang, Qixing and Zhou, Xiaowei and Bao, Hujun},
  booktitle={CVPR},
  year={2019}
}

clean-pvnet's People

Contributors

pengsida avatar

Watchers

James Cloos 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.