openai开源 shap-e 根据文本或图像生成 3D 模型,支持导入blender

介绍

github仓库地址:https://github.com/openai/shap-e

技术原理论文:https://arxiv.org/abs/2305.02463

官方生成效果示例:

2024-06-23T14:22:23.png

部署安装

打开colab:https://colab.research.google.com/

新建一个笔记,然后点击右上角的ram图标,再点击更改运行时类型

2024-06-23T14:25:42.png

改为使用t4 gpu

2024-06-23T14:27:06.png

输入pip install git+https://github.com/openai/shap-e

2024-06-23T14:50:02.png

然后运行这个测试

sample_text_to_3d.ipynb - 根据文本提示对 3D 模型进行采样。

依次复制粘贴代码运行

这里我将batch_size改为1,size改为256

2024-06-23T15:06:21.png

最后这段代码是输出可编辑的模型文件

# Example of saving the latents as meshes.
from shap_e.util.notebooks import decode_latent_mesh

for i, latent in enumerate(latents):
    t = decode_latent_mesh(xm, latent).tri_mesh()
    with open(f'example_mesh_{i}.ply', 'wb') as f:
        t.write_ply(f)
    with open(f'example_mesh_{i}.obj', 'w') as f:
        t.write_obj(f)

生成文件的位置

2024-06-23T15:08:15.png

接下里我重新修改了提示词,为1 girl

2024-06-23T15:11:48.png

把模型文件下载下来,导入到blender看看

2024-06-23T15:13:29.png

效果,emm...

2024-06-23T15:16:06.png

敬请关注,每日分享AI工具和相关知识

破晓一代技术公众号

posted @ 2024-06-24 08:24  破晓一代  阅读(18)  评论(0编辑  收藏  举报