PoseCNN-PyTorch: A PyTorch Implementation of the PoseCNN Framework for 6D Object Pose Estimation

代码github:https://github.com/NVlabs/PoseCNN-PyTorch

目录

PoseCNN-PyTorch: A PyTorch Implementation of the PoseCNN Framework for 6D Object Pose Estimation

1、下载代码

2、安装pytorch、Eigen、Sophus

3、pip install

4、Initialize the submodules

5、Compile the new layers under $ROOT/lib/layers introduced in PoseCNN

6、Compile cython components

7、Compile the ycb_render

8、下载数据集和预训练权重

9、运行demo

10、用YCB对象的合成数据训练自己的模型

11、Training and testing on the YCB-Video dataset

12、Training and testing on the DexYCB dataset

13、Running with ROS on a Realsense Camera for real-world pose estimation


环境:ubuntu 20.04 + cuda-10.2 + python3.6.7

1、下载代码

git clone https://github.com/NVlabs/PoseCNN-PyTorch.git

2、安装pytorch、Eigen、Sophus

(1)pytorch:Start Locally | PyTorch

(2)EIgen 3:

作者给的eigen库链接,安装后查看版本是3.3.90:GitHub - eigenteam/eigen-git-mirror: THIS MIRROR IS DEPRECATED -- New url: https://gitlab.com/libeigen/eigen

(3)Sophus:

作者给的sophus库链接:https://github.com/yuxng/Sophus

3、pip install

cd PoseCNN-PyTorch
pip install -r requirement.txt

4、Initialize the submodules

cd ycb_rendergit submodule update --init --recursive

过程:这一步需要下载pybind11,但它的git仓库下载很慢,所以我先下载了pybind11,再执行,如下所示

~/3dTracking/PoseCNN-PyTorch/ycb_render$ git clone https://github.com/pybind/pybind11.git
Cloning into 'pybind11'...
remote: Enumerating objects: 24975, done.
remote: Counting objects: 100% (183/183), done.
remote: Compressing objects: 100% (116/116), done.
remote: Total 24975 (delta 91), reused 109 (delta 52), pack-reused 24792
Receiving objects: 100% (24975/24975), 9.48 MiB | 440.00 KiB/s, done.
Resolving deltas: 100% (17492/17492), done.
~/3dTracking/PoseCNN-PyTorch/ycb_render$ git submodule update --init --recursive
Submodule path 'pybind11': checked out '028812ae7eee307dca5f8f69d467af7b92cc41c8'

5、Compile the new layers under $ROOT/lib/layers introduced in PoseCNN

cd ../lib/layers
sudo /home/r*/anaconda3/envs/posecnn/bin/python setup.py install

报错1:

hough_voting_kernel.cu:14:10: fatal error: Eigen/Geometry: No such file or directory14 | #include <Eigen/Geometry>|          ^~~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/local/cuda-11.2/bin/nvcc' failed with exit code 1

说是找不到Eigen/Geometry,查看Eigen/Geometry文件在/usr/include/eigen3/Eigen文件夹内

/usr/include/eigen3/Eigen$ ls
Cholesky        IterativeLinearSolvers  QtAlignedMalloc  StdDeque
CholmodSupport  Jacobi                  Sparse           StdList
Core            LU                      SparseCholesky   StdVector
Dense           MetisSupport            SparseCore       SuperLUSupport
Eigen           OrderingMethods         SparseLU         SVD
Eigenvalues     PardisoSupport          SparseQR         UmfPackSupport
Geometry        PaStiXSupport           SPQRSupport
Householder     QR                      src

于是参考https://www.cnblogs.com/long5683/p/13406666.html

建立软连接:

sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

报错2:fatal error: math_functions.hpp: No such file or directory

参考PoseCNN代码复现CMake编译找不到math_functions.hpp_不完美的上帝的博客-CSDN博客_posecnn 复现

报错3:could not find ninja

sudo apt install ninja-build

重新编译,详细日志如下:

(posecnn) r****@r****-MS-7D42:~/3dTracking/PoseCNN-PyTorch/lib/layers$ sudo /home/r****/anaconda3/envs/posecnn/bin/python setup.py install
[sudo] password for r****:
running install
running bdist_egg
running egg_info
writing posecnn.egg-info/PKG-INFO
writing dependency_links to posecnn.egg-info/dependency_links.txt
writing top-level names to posecnn.egg-info/top_level.txt
/home/r****/anaconda3/envs/posecnn/lib/python3.6/site-packages/torch/utils/cpp_extension.py:381: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'posecnn.egg-info/SOURCES.txt'
writing manifest file 'posecnn.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-3.6/posecnn_cuda.cpython-36m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg
creating stub loader for posecnn_cuda.cpython-36m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/posecnn_cuda.py to posecnn_cuda.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying posecnn.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying posecnn.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying posecnn.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying posecnn.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
__pycache__.posecnn_cuda.cpython-36: module references __file__
creating 'dist/posecnn-0.0.0-py3.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing posecnn-0.0.0-py3.6-linux-x86_64.egg
removing '/home/r****/anaconda3/envs/posecnn/lib/python3.6/site-packages/posecnn-0.0.0-py3.6-linux-x86_64.egg' (and everything under it)
creating /home/r****/anaconda3/envs/posecnn/lib/python3.6/site-packages/posecnn-0.0.0-py3.6-linux-x86_64.egg
Extracting posecnn-0.0.0-py3.6-linux-x86_64.egg to /home/r****/anaconda3/envs/posecnn/lib/python3.6/site-packages
posecnn 0.0.0 is already the active version in easy-install.pthInstalled /home/r****/anaconda3/envs/posecnn/lib/python3.6/site-packages/posecnn-0.0.0-py3.6-linux-x86_64.egg
Processing dependencies for posecnn==0.0.0
Finished processing dependencies for posecnn==0.0.0

6、Compile cython components

cd ../utils
python setup.py build_ext --inplace

日志:

(posecnn) r***@r***-MS-7D42:~/3dTracking/PoseCNN-PyTorch/lib/utils$ python setup.py build_ext --inplace
running build_ext
cythoning bbox.pyx to bbox.c
/home/r***/anaconda3/envs/posecnn/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/r***/3dTracking/PoseCNN-PyTorch/lib/utils/bbox.pyxtree = Parsing.p_module(s, pxd, full_module_name)
building 'cython_bbox' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/r***/anaconda3/envs/posecnn/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/r***/anaconda3/envs/posecnn/lib/python3.6/site-packages/numpy/core/include -I/home/r***/anaconda3/envs/posecnn/include/python3.6m -c bbox.c -o build/temp.linux-x86_64-3.6/bbox.o -Wno-cpp -Wno-unused-function
gcc -pthread -shared -B /home/r***/anaconda3/envs/posecnn/compiler_compat -L/home/r***/anaconda3/envs/posecnn/lib -Wl,-rpath=/home/r***/anaconda3/envs/posecnn/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/bbox.o -o /home/r***/3dTracking/PoseCNN-PyTorch/lib/utils/cython_bbox.cpython-36m-x86_64-linux-gnu.so
/home/r***/anaconda3/envs/posecnn/compiler_compat/ld: warning: /home/r***/anaconda3/envs/posecnn/lib/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/r***/anaconda3/envs/posecnn/compiler_compat/ld: warning: /home/r***/anaconda3/envs/posecnn/lib/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/home/r***/anaconda3/envs/posecnn/compiler_compat/ld: warning: /home/r***/anaconda3/envs/posecnn/lib/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/r***/anaconda3/envs/posecnn/compiler_compat/ld: warning: /home/r***/anaconda3/envs/posecnn/lib/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002

第二次运行时日志是这样的

~/3dTracking/PoseCNN-PyTorch/lib/utils$ python setup.py build_ext --inplace
running build_ext
skipping 'bbox.c' Cython extension (up-to-date)

7、Compile the ycb_render

cd ../../ycb_render
python setup.py develop

报错1:fatal error: X11/Xlib.h: No such file or directory

sudo apt-get install libghc-x11-dev

报错2:fatal error: GL/gl.h: No such file or directory

sudo apt-get install libgl1-mesa-dev

成功运行的日志:

(posecnn) rakuli@rakuli-MS-7D42:~/3dTracking/PoseCNN-PyTorch/ycb_render$ sudo /home/rakuli/anaconda3/envs/posecnn/bin/python setup.py develop
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 Warning (dev) at CMakeLists.txt:2 (project):Policy CMP0048 is not set: project() command manages VERSION variables.Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The following variable(s) would be set to empty:CMAKE_PROJECT_VERSIONCMAKE_PROJECT_VERSION_MAJORCMAKE_PROJECT_VERSION_MINORCMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.-- pybind11 v2.6.2 dev1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rakuli/3dTracking/PoseCNN-PyTorch/ycb_render/build/temp.linux-x86_64-3.6
[ 33%] Built target query_devices
[ 66%] Built target test_device
[ 75%] Building CXX object CMakeFiles/CppYCBRenderer.dir/cpp/ycb_renderer.cpp.o
[ 83%] Linking CXX shared module ../../CppYCBRenderer.cpython-36m-x86_64-linux-gnu.so
[100%] Built target CppYCBRenderer
Creating /home/rakuli/anaconda3/envs/posecnn/lib/python3.6/site-packages/CppYCBRenderer.egg-link (link to .)
Adding CppYCBRenderer 0.0.1 to easy-install.pth fileInstalled /home/rakuli/3dTracking/PoseCNN-PyTorch/ycb_render
Processing dependencies for CppYCBRenderer==0.0.1
Finished processing dependencies for CppYCBRenderer==0.0.1

8、下载数据集和预训练权重

  • 3D models of YCB Objects下载并保存在PoseCNN-PyTorch/data 下:https://drive.google.com/file/d/1PTNmhd-eSq0fwSPv0nvQN8h_scR1v-UJ/view?usp=sharing

  • pre-trained checkpoints下载并保存在PoseCNN-PyTorch/data下:https://drive.google.com/file/d/1-ECAkkTRfa1jJ9YBTzf04wxCGw6-m5d4/view?usp=sharing

  • YCB-Video数据集:PoseCNN: A Convolutional Neural Network for 6D Object Pose Estimation in Cluttered Scenes – UW Robotics and State Estimation Lab

  • dexYCB:DexYCB: A Benchmark for Capturing Hand Grasping of Objects

  • real-world images with pose annotations for 20 YCB objects collected via robot interation:https://drive.google.com/file/d/1cQH_dnDzyrI0MWNx8st4lht_q0F6cUrE/view?usp=sharing

9、运行demo

从以下链接下载assimp库(不要用apt-get install!!):

https://github.com/assimp/assimp/tree/v4.1.0

下载3D models和checkpoints,再运行:

./experiments/scripts/demo.sh

成功运行

日志过长,故存放在以下链接:

https://blog.csdn.net/weixin_54470372/article/details/127775006?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22127775006%22%2C%22source%22%3A%22weixin_54470372%22%7D

【复现笔记】PoseCNN-PyTorch相关推荐

  1. PyTorch学习笔记:PyTorch初体验

    PyTorch学习笔记:PyTorch初体验 一.在Anaconda里安装PyTorch 1.进入虚拟环境mlcc 2.安装PyTorch 二.在PyTorch创建张量 1.启动mlcc环境下的Spy ...

  2. Attentional Factorization Machine(AFM)复现笔记

    声明:本模型复现笔记记录自己学习过程,如果有错误请各位老师批评指正. 之前学习了很多关于特征交叉的模型比如Wide&Deep.Deep&Cross.DeepFM.NFM. 对于特征工程 ...

  3. WideDeep Model、Wide Model(LR)、Deep Model、DeepFm Model、NFM Model复现笔记

    声明:本模型复现笔记记录自己学习过程,如果有错误请各位老师批评指正. 本周复现了Wide&Deep Model.Wide Model.Deep Model.DeepFm Model.NFM M ...

  4. PaddleDetection复现笔记

    PaddleDetection复现笔记 (1) PP-Tracking_GUi step1:准备环境 step2:准备模型 step3:运行 (2) PP-Tracking step1:准备环境 st ...

  5. 从零开始的图像语义分割:FCN快速复现教程(Pytorch+CityScapes数据集)

    从零开始的图像语义分割:FCN复现教程(Pytorch+CityScapes数据集) 前言 一.图像分割开山之作FCN 二.代码及数据集获取 1.源项目代码 2.CityScapes数据集 三.代码复 ...

  6. 【学习笔记】Pytorch深度学习—Batch Normalization

    [学习笔记]Pytorch深度学习-Batch Normalization Batch Normalization概念 `Batch Normalization ` `Batch Normalizat ...

  7. 【Muduo复现笔记】 PingPong测试程序

    [Muduo复现笔记] PingPong测试程序 pingpong_server void onConnection(const TcpConnectionPtr& conn) 将新连接con ...

  8. 禅道linux一键安装漏洞,禅道全版本rce漏洞复现笔记

    禅道全版本rce漏洞复现笔记 漏洞说明 禅道项目管理软件是一款国产的,基于LGPL协议,开源免费的项目管理软件,它集产品管理.项目管理.测试管理于一体,同时还包含了事务管理.组织管理等诸多功能,是中小 ...

  9. Trackformer复现笔记

    Trackformer复现笔记 前言 因毕设需要进行一下记录 一.python版本 建议使用python 3.7.1,源代码是基于python 3.7进行编写 二.pip 1.lap依赖 这个依赖需要 ...

  10. 论文笔记及Pytorch复现:A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction

    论文地址 GitHub代码地址 论文题目为<基于双阶段注意力机制的循环神经网络>,文章本质上还是基于Seq2Seq的模型,结合了注意力机制实现的时间序列的预测方法,文章的一大亮点是:不仅在 ...

最新文章

  1. 浏览器 user-agent 字符串的故事
  2. mysql数据排序指令_MySQL 排序 | 菜鸟教程
  3. 论文浅尝 - AAAI2021 | 从历史中学习:利用时间感知拷贝生成网络建模时态知识图谱...
  4. 音乐美术计算机在中考,2022年音乐、美术进中考?教育部最新回应...
  5. 记一次ubuntu误操作导致无法用sudo
  6. Postgresql 客户端连接问题
  7. 未转变者3.16进不去服务器,未转变者3.16.0.1
  8. 《大数据之路-阿里巴巴大数据实践》第三章 数据同步
  9. 『HDU 5773』The All-purpose Zero
  10. winrar破解方法
  11. 传智播客软件测试学习视频汇总:
  12. Atmel Studio 6.0 重新安装
  13. 制作自己的ChatGPT
  14. 第二十二章 独自早餐(枯木雕之秘)
  15. Windows11输入法第一个候选词不显示。
  16. stm32f0 大小端_STM32F0系列Cortex-M0原理与实践
  17. html测试方案,网站测试方案.doc
  18. 北通手柄连接电脑没反应_北通无线手柄连接电脑没反应如何解决?
  19. 图文字浅谈--计算机网络常遇的面试问题(计网面经)
  20. 有钱任性把冰山搬回家,真有富豪计划这样干!

热门文章

  1. 新浪、腾讯股票价格相关接口
  2. 2021-11-13vjudge第四题D - a/b + c/d
  3. 阿里巴巴2020届秋招最后一班车 企业智能事业部 企业大脑技术部 2020届秋招 Java 开发工程师
  4. oracle if 使用函数,oracle函数NVL,NVL2和NULLIF之间的区别和使用
  5. 1.5V升3V一节锂电池提供5V300mA
  6. 交叉编译链下的Makefile(STM32F4xx)
  7. 输入法不能在浏览器上打字或失效的解决办法
  8. 惠头条自媒体怎么选择领域,惠头条如何爆文
  9. 游戏场景设计案例精选
  10. ABB机器人应用中常用的几种传感器