目录
  1. 环境搭建
  2. 准备数据集

PVNet尚未跑通,暂时放弃。

标题:PVNet: Pixel-Wise Voting Network for 6DoF Pose Estimation 作者团队:浙江大学 期刊会议:CVPR 时间:2018 代码https://zju3dv.github.io/pvnet/

环境搭建

(1)创建虚拟环境

创建conda环境

conda create -n pvnet python=3.7
conda activate pvnet

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge

pip install Cython==0.28.2
sudo apt-get install libglfw3-dev libglfw3

注释掉requirement.txtnumpyipdb的版本限制,然后

pip install -r requirements.txt

(2)编译扩展程序

创建环境变量

export CUDA_HOME="/usr/local/cuda-11.6"
cd lib/cscr

编译ransac_voting

cd ransac_voting
python setup.py build_ext --inplace

编译nn

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

编译fps

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

准备数据集

使用Objectdatasettools创建数据集,并按照下面的格式整理:

整理好后的文件参考:此文件

├── /path/to/dataset
│   ├── model.ply
│   ├── camera.txt
│   ├── diameter.txt  // the object diameter, whose unit is meter
│   ├── rgb/
│   │   ├── 0.jpg
│   │   ├── ...
│   │   ├── 1234.jpg
│   │   ├── ...
│   ├── mask/
│   │   ├── 0.png
│   │   ├── ...
│   │   ├── 1234.png
│   │   ├── ...
│   ├── pose/
│   │   ├── pose0.npy
│   │   ├── ...
│   │   ├── pose1234.npy
│   │   ├── ...
│   │   └──

创建软连接

ln -s /path/to/custom_dataset data/custom

处理数据集

python run.py --type custom

如果出现ValueError: shapes (8,4) and (3,3) not aligned: 4 (dim 1) != 3 (dim 0)的问题 修改lib/utils/base_utils第23行如下 xyz = np.dot(xyz, RT[:3, :3].T) + RT[:3, 3:].T