跑通POSECNN 代码

跑通POSECNN 代码

Introduction

PoseCNN通过在图像中定位物体的中心并预测其与摄像机的距离来估计物体的三维平移。通过回归到四元数表示来估计物体的三维旋转。

git clone https://github.com/yuxng/PoseCNN.git

首先先将posecnn下载下来

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. I usually compile the source code of tensorflow locally.

安装tensorflow就一句话

 pip3 install tensorflow-gpu

网上有很多详述,在这里不赘述

2.Compile the new layers under $ROOT/lib we introduce in PoseCNN.

 cd $ROOT/lib
 sh make.sh

在这里,直接运行会提示找不到make.sh,所以要把make.sh放到对应的路径下面才可以

3.下载VGG16的权重

Download the VGG16 weights from here (528M). Put the weight file vgg16.npy to $ROOT/data/imagenet_models.
这个直接下载就可以,点github上的那个here

4.安装依赖

Compile lib/synthesize with cmake (optional). This package contains a few useful tools such as generating synthetic images for training and ICP.
接下来就是麻烦的安装依赖的过程

(1)安装Pangolin

Pangolin是一个用于OpenGL显示/交互以及视频输入的一个轻量级、快速开发库,下面是Pangolin的Github网址:https://github.com/stevenlovegrove/Pangolin

ORB_SLAM2中需要有Pangolin的支持。

首先下载安装包:

 git clone https://github.com/stevenlovegrove/Pangolin.git

之后安装相关依赖(在这里多说一句,做学习,图像之类的依赖其实并不多,你会发现这些依赖在之前搭环境的时候其实都装过)。

1.安装依赖Glew:

sudo apt-get install libglew-dev

2.安装Cmake:

sudo apt-get install cmake (一般这个都会有)

3.安装Python2/Python3(for drop-down interactive console):

sudo apt-get install libpython2.7-dev

再之后,编译

cd Pangolin
mkdir build
cd build
cmake ..
make  -j12(这里用不用j12无所谓,包不算大,编译很快的)
sudo make install (.h默认安装到了/usr/local/include)

至此,pangolin安装完毕

(2)安装Eigen

Eigen是一个高层次的C ++库,有效支持线性代数,矩阵和矢量运算,数值分析及其相关的算法。

sudo apt-get install libeigen3-dev    (.h默认安装到了/usr/local/include)

可以执行复制命令,将Eigen文件夹及其内容放在/usr/include,不过这一步我没有做:

sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include 

至此,Eigen安装完毕
顺便将另外一种安装方法记在这里,以备后面查阅

git clone https://github.com/eigenteam/eigen-git-mirror
cd eigen-git-mirror
mkdir build
cd build
cmake ..
sudo make install
//#安装后,头文件安装在/usr/local/include/eigen3/

(3)安装boost

The tested Boost version is 1.66.0.(暂不清楚换版本影响大不大)
Boost是为C++语言标准库提供扩展的一些C++程序库的总称。Boost库是一个可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一,是为C++语言标准库提供扩展的一些C++程序库的总称。

到boost官网安装一个boost库的压缩包,下载1.66.0版本,解压 (github上给出了链接)
tar -xzvf boost_1_66_0.tar.gz 
解压出来以后,进入解压出来的文件夹
sudo ./bootstrap.sh   (头文件就被默认安装在/usr/local/include头文件下,库文件就被默认安在/usr/local/lib下)
sudo ./b2 install

(4)安装Sophus

Eigen库提供了几何模块,但是没有提供李代数的支持。一个较好的李代数库是由Strasdat维护的Sophus库。

git clone http://github.com/strasdat/Sophus.git
git checkout a621ff
mkdir build
cd build
cmake ..
make
sudo make install

(5)安装nanoflann

题目起名为安装xxx其实在这里不太合适。。。
nanoflann是一个c++11标准库,用于构建具有不同拓扑(R2,R3(点云),SO(2)和SO(3)(2D和3D旋转组))的KD树。nanoflann不需要编译或安装。你只需要#include <nanoflann.hpp>在你的代码中。
如何使用库 最简单的方法:将其include/nanoflann.hpp用于需要的地方。(Easiest way: clone this GIT repository and take the include/nanoflann.hpp file for use where you need it.)

  git clone https://github.com/jlblancoc/nanoflann.git

(6)安装libsuitesparse-dev

apt-cache search suitesparse # 找一下apt源有没有
sudo apt-get install libsuitesparse-dev
sudo apt-get install libboost-all-dev

下面这一段暂时还没有想明白要怎么搞:

Change hard coded pathes in CMakeLists.txt.
The Pangolin branch I use: c2a6ef524401945b493f14f8b5b8aa76cc7d71a9
cd $ROOT/lib/synthesize
mkdir build
cd build
cmake ..
make
Add the path of the built libary libsynthesizer.so to python path
export PYTHONPATH=$PYTHONPATH:$ROOT/lib/synthesize/build

5.Required environment

Ubuntu 16.04
Tensorflow >= 1.2.0
CUDA >= 8.0

cuda的安装就不在这里详述了

6.Running the demo

(这一步其实还没做,因为下载要翻墙,虽然墙翻过去了,但是我总是下载一半就提示下载失败,知乎上有大神提供了百度云https://zhuanlan.zhihu.com/p/89951893,但是里面有个别文件提示网络错误无法下载,网络肯定是没有问题的,这个问题暂时没有办法解决,毕竟家里设备有限,估计后面要等到疫情结束后再搞了)
YCB-Video dataset下载官网:
Download our trained model on theYCB-Video dataset from here, and save it to $ROOT/data/demo_models.
(https://rse-lab.cs.washington.edu/projects/posecnn/)
run the following script

./experiments/scripts/demo.sh $GPU_ID

7. Running on the YCB-Video dataset

上一步都没搞成,这一步肯定就更没有搞了,等后面搞成了会回来完善这篇博客的,到时候前面的步骤也会有一些调整
Download the YCB-Video dataset from here.
https://rse-lab.cs.washington.edu/projects/posecnn/

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

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
  • 2
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值