Ubuntu20.04中复现FoundationPose
文章目录
- Ubuntu20.04中复现FoundationPose
- 1.安装cuda和cudnn
- 2.下载相关资源
- 3.环境配置
- 4.运行model-based demo
- 5.运行ycbv demo
- Reference
🚀 非常重要的环境配置 🚀
- ubuntu 20.04
- cuda 11.8.0
- cudnn v8.9.7
- python 3.9.19
- torch 2.0.0
- 显卡RTX 4060 ti
详细信息如下所示:
1.安装cuda和cudnn
具体可以参考这篇:ubuntu配置多版本cuda+cudnn环境,及版本切换方法
2.下载相关资源
- 下载仓库
git clone https://github.com/NVlabs/FoundationPose.git
- 下载网络权重,并解压到
weights/
目录中 - 下载demo数据,并解压到
demo_data/
目录中 - 【可选】下载大规模的数据集:FoundationPose Dataset
- 【可选】在此处下载我们预处理的参考视图,以便运行
model-free
的小样本版本。
3.环境配置
首先安装anaconda
或者miniconda
,具体可以参考这篇:【Linux】Ubuntu20.04版本配置pytorch环境2023.09.05【教程】
- 手动安装
eigen3
到系统
cd $HOME && wget -q https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz && \
tar -xzf eigen-3.4.0.tar.gz && \
cd eigen-3.4.0 && mkdir build && cd build
cmake .. -Wno-dev -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-std=c++14 ..
sudo make install
cd $HOME && rm -rf eigen-3.4.0 eigen-3.4.0.tar.gz
- 创建
conda
环境并安装依赖
# create conda environment
conda create -n foundationpose python=3.9
# activate conda environment
conda activate foundationpose
# Install Eigen3 3.4.0 under conda environment
conda install conda-forge::eigen=3.4.0
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:/eigen/path/under/conda"
# install dependencies
python -m pip install -r requirements.txt
# Install NVDiffRast
python -m pip install --quiet --no-cache-dir git+https://github.com/NVlabs/nvdiffrast.git
# Kaolin (Optional, needed if running model-free setup)
python -m pip install --quiet --no-cache-dir kaolin==0.15.0 -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.0.0_cu118.html
# PyTorch3D
python -m pip install --quiet --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu118_pyt200/download.html
# Build extensions
CMAKE_PREFIX_PATH=$CONDA_PREFIX/lib/python3.9/site-packages/pybind11/share/cmake/pybind11 bash build_all_conda.sh
4.运行model-based demo
如果配置过程中都没有问题,那么可以直接运行demo
python rum_demo.py
效果如下所示:
5.运行ycbv demo
首先下载ycbv
数据集,链接如下:https://huggingface.co/datasets/bop-benchmark/datasets/tree/main/ycbv,数据集的大小是100GB左右
…待补充…
Reference
[1]FoundationPose: Unified 6D Pose Estimation and Tracking of Novel Objects
[2]FoundationPose复现及Realsense应用
[3]【6D位姿估计】数据集汇总 BOP