【代码复现】Any6D: Model-free 6D Pose Estimation of Novel Objects
安装Any6D环境
创建环境:
1
conda create -n any6d python=3.9
激活环境
1
conda activate any6d
安装cuda12.1:
1
conda install cuda -c nvidia/label/cuda-12.1.0
安装Eigen3 3.4.0并添加环境变量:
1
2conda install conda-forge::eigen=3.4.0
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:/eigen/path/under/conda"注意,这里的
/eigen/path/under/conda应该在类似于/home/tanmx/miniconda3/envs/any6d/include/eigen3的路径下,且:1
2$ ls /home/tanmx/miniconda3/envs/any6d/include/eigen3
Eigen signature_of_eigen3_matrix_library unsupported修改
requirements.txt文件:- 第86行:
huggingface-hub==0.24.0->huggingface-hub; - 第91行:
accelerate->accelerate==0.31.0。
- 第86行:
安装依赖:
1
python -m pip install -r requirements.txt
安装
NVDiffRast:1
python -m pip install --no-cache-dir git+https://github.com/NVlabs/nvdiffrast.git
安装
Kaolin:1
python -m pip install --no-cache-dir kaolin==0.16.0 -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.4.0_cu121.html
安装
PyTorch3D:1
pip install --extra-index-url https://miropsota.github.io/torch_packages_builder pytorch3d==0.7.8+pt2.4.1cu121
安装
Boost:1
sudo apt install build-essential libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev
修改
foundationpose/bundlesdf/mycuda/setup.py:第35行的
include_dirs变量,由:1
2
3
4include_dirs=[
"/usr/local/include/eigen3",
"/usr/include/eigen3",
],修改为:
1
2
3
4
5include_dirs=[
# "/usr/local/include/eigen3",
# "/usr/include/eigen3",
'/home/tanmx/miniconda3/envs/any6d/include/eigen3',
],
编译扩展:
1
CMAKE_PREFIX_PATH=$CONDA_PREFIX/lib/python3.9/site-packages/pybind11/share/cmake/pybind11 bash foundationpose/build_all_conda.sh
编译
SAM2:1
2cd sam2
pip install -e .编译
bop_toolkit:1
2cd bop_toolkit
python setup.py install
下载数据集
YCBV物体模型:
- https://drive.google.com/file/d/1gmcDD-5bkJfcMKLZb3zGgH_HUFbulQWu/view
HO3D评估文件:
- https://drive.google.com/drive/folders/1Wk-HZDvUExyUrRn7us4WWEbHnnFHgOAX
Any6D Anchor Results:
- https://huggingface.co/datasets/taeyeop/Any6D/resolve/main/dexycb_reference_view_ours.zip
将上述文件分别组织如下:
1 | ho3d/ |
下载预训练模型
foundationpose预训练模型:
- https://drive.google.com/drive/folders/1DFezOAD0oD1BblsXVxqDsl8fj0qzB82i
sam2预训练模型:
- https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt
instantmesh预训练模型:
- https://huggingface.co/TencentARC/InstantMesh/resolve/main/diffusion_pytorch_model.bin
- https://huggingface.co/TencentARC/InstantMesh/resolve/main/instant_mesh_base.ckpt
- https://huggingface.co/TencentARC/InstantMesh/resolve/main/instant_mesh_large.ckpt
- https://huggingface.co/TencentARC/InstantMesh/resolve/main/instant_nerf_base.ckpt
- https://huggingface.co/TencentARC/InstantMesh/resolve/main/instant_nerf_large.ckpt
将上述文件分别组织如下:
1 | foundationpose/ |
运行代码
Demo
不使用instantmesh + sam2
1
python run_demo.py --ycb_model_path ./ho3d/YCB_Video_Models/
使用instantmesh + sam2
1
python run_demo.py --ycb_model_path ./ho3d/YCB_Video_Models/ --img_to_3d
在HO3D上运行
见GitHub仓库。