1. 运行环境配置
conda create -n instant-ngp python=3.10
conda activate instant-ngp
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
2. COLMAP稀疏重建生成transform.json
colmap 环境配置参考文档;
终端定位在instant-ngp/data/duck,执行以下命令:
instant-ngp/data/duck$ python ../../scripts/colmap2nerf.py --colmap_matcher exhaustive --colmap_camera_model SIMPLE_PINHOLE --run_colmap --images images/ --aabb_scale 4
注:
遇到以下报错:
解决办法:colmap2nerf.py 的可执行命令中以下参数设置为false:
–SiftExtraction.estimate_affine_shape=false
–SiftExtraction.domain_size_pooling=false
3. Instant-ngp 训练
cd instant-ngp
./instant-ngp ./data/duck/
此可执行程序默认打开gui,若不启用,使用命令./instant-ngp ./data/duck/ --no-gui
python 脚本:
```bash
python ./scripts/run.py --mode nerf --scene ./data/duck/
此可执行程序默认不打开gui,若启用,使用命令python ./scripts/run.py --mode nerf --scene ./data/duck/ --gui --train
4. 导出模型文件(obj、ply)
脚本 scripts/run.py 中有一个 save_mesh 参数,它支持 OBJ 和 PLY 格式;
python ./scripts/run.py --mode nerf --scene ./data/duck/ --save_snapshot saved/duck.msgpack --save_mesh saved/duck.ply