threestudio:基于 Diffusion 的 3D 生成方法框架

Paper: Liu Y T, Guo Y C, Voleti V, et al. threestudio: a modular framework for diffusion-guided 3D generation[J].
Introduction:
Code: https://github.com/threestudio-project/threestudio

一. threestudio 简介

threestudio 是一个用于生成三维模型 (3D content generation) 的框架,支持文本提示、单一图像或少量图像等多种模态,核心就是将二维中的 text-to-image 模型提升到三维。threestudio 集成了多种前沿技术,包括 ProlificDreamer、DreamFusion、Magic3D、SJC、Latent-NeRF、Fantasia3D、TextMesh、Zero-1-to-3、Magic123、HiFA、InstructNeRF2NeRF、Control4D,用于生成和编辑高质量的 3D 内容。

threestudio-3dgs 是基于 threestudio 的一个扩展,用于 3D GS 的生成式任务,并且支持与其他扩展如 MVDream 和 Zero-123 集成,以增强三维模型的生成能力。

二. threestudio 复现

  • 平台:AutoDL
  • 显卡:RTX 4090 24G
  • 镜像:PyTorch 2.0.0、Python 3.8(ubuntu20.04)、Cuda 11.8
  • 源码:https://github.com/threestudio-project/threestudio
  1. 克隆仓库后安装虚拟环境:threestudio 使用的是 virtualenv 而非 conda,因此需要先安装 virtualenv:pip install virtualenv。然后创建虚拟环境并激活:. venv/bin/activate,虚拟环境 venv 位于 threestudio 文件夹下;
    在这里插入图片描述

  2. 按照 README 安装 torch2.0.0+cu118、ninja 和相关依赖后,就可以使用 DreamFusion 创建 pancake bunny 模型:
    在这里插入图片描述

  3. 导出 mesh 的过程中,疑似缺少 EGL/egl.h 头文件:
    在这里插入图片描述
    在命令行中增加参数 system.exporter.context_type=cuda 即可 1python launch.py --config outputs/dreamfusion-sd/a_zoomed_out_DSLR_photo_of_a_baby_bunny_sitting_on_top_of_a_stack_of_pancakes@20240523-190945/configs/parsed.yaml --export --gpu 0 resume=outputs/dreamfusion-sd/a_zoomed_out_DSLR_photo_of_a_baby_bunny_sitting_on_top_of_a_stack_of_pancakes@20240523-190945/ckpts/last.ckpt system.export er_type=mesh-exporter system.exporter.context_type=cuda
    在这里插入图片描述

DreamFusion 创建的 pancake bunny 模型如下:

threestudio-DreamFusion生成结果

三. threestudio-3dgs 复现

  • 平台:AutoDL
  • 显卡:RTX 4090 24G
  • 镜像:PyTorch 2.0.0、Python 3.8(ubuntu20.04)、Cuda 11.8
  • 源码:https://github.com/DSaurus/threestudio-3dgs
  1. 复现 threestudio-3dgs 需要先安装 threestudio 环境,然后按照 README 进入 custom 文件夹,克隆 threestudio-3dgs 仓库并安装子模块即可。此外,还需要安装一些额外的包:pip install mediapipe plyfile pymeshlab
  2. 使用 GS 创建一个汉堡模型,然后可以导出 mesh:python launch.py --config outputs/gs-sds-generation/a_delicious_hamburger@20240523-204741/configs/parsed.yaml --export --gpu 0 system.prompt_processor.prompt="a delicious hamburger" resume=outputs/gs-sds-generation/a_delicious_hamburger@20240523-204741/ckpts/last.ckpt。导出过程中遇到 xFormers 与 PyTorch、CUDA 版本不匹配的问题,需要进行更新:pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu118
    在这里插入图片描述
    然后又遇到找不到 gaussian_3d_coeff 模块的问题:
    在这里插入图片描述
    这里不能简单地在 gaussian_io.py 中添加 from .gaussian_base import gaussian_3d_coeff,因为 gaussian_base.py 中有 from .gaussian_io import GaussianIO,这样会出现 循环导入
    在这里插入图片描述
    因此需要将 gaussian_base.py 中的 gaussian_3d_coeff 函数放入 gaussian_io.py2,然后就能够成功导出 mesh:
    在这里插入图片描述

3D GS 创建的汉堡模型如下:

threestudio-3dgs生成结果

四. 常见操作

1. 取消 save_code 功能

threestudio/utils/callbacks.pyCodeSnapshotCallbacksave_code_snapshot() 函数注释掉即可。


  1. fatal error: EGL/egl.h: No such file or directory 36 | #include <EGL/egl.h> WSL2 #151 ↩︎

  2. NameError: name ‘gaussian_3d_coeff’ is not defined #21 ↩︎

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值