LGM

LGM(Large Multi-View Gaussian Model)分两个阶段把一张物体图片转成 3D 高斯泼溅(Gaussian Splatting)用的 3D 高斯:ImageDream 先采样物体周围的四个视图,LGM 再读取这些视图并返回高斯。LibreYOLO 通过 LibreGen 工厂用纯 PyTorch 运行这两个阶段。

任务
3d generation
安装
pip install "libreyolo[gen]"
支持层级
兄弟层级,自 v1.8.0 起。一个独立的产品面,有自己的工厂和契约。
上游
LGM,由 3D Topia 发布,采用 MIT and CreativeML OpenRAIL++-M 许可。论文、源码
许可
代码采用 MIT and Apache-2.0,权重采用 MIT and CreativeML OpenRAIL++-M。商用

安装

bash
pip install "libreyolo[gen]"

这个 extra 会带上 diffusers 和 transformers,用来加载 ImageDream 的 VAE、调度器和 CLIP 编码器。

预测

没有任何内容需要申请访问,也不需要登录。权重在首次使用时按固定版本下载。

Python
from libreyolo import LibreGen, SAMPLE_IMAGE model = LibreGen("lgm")             # 权重在首次使用时下载result = model(SAMPLE_IMAGE, seed=0) result.save("object.ply")           # 标准 3DGS 布局print(len(result.gaussians))        # 不透明度高于 0.005 的那些
CLI
# 把物体以 .ply 保存到 runs/generate/predict 下libreyolo generate source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/guggenheim-bilbao.jpg model=lgm seed=0
设置
from libreyolo import LibreGen, SAMPLE_IMAGE model = LibreGen("lgm")result = model(SAMPLE_IMAGE, elevation=-10)     # 从上方拍摄的图片result = model(SAMPLE_IMAGE, steps=20, guidance=1.0)   # 不用引导

ImageDream 是一个从 Stable Diffusion 2.1 微调而来的多视图扩散模型,它从 256 px 的输入采样出物体周围的四个视图。LGM 是一个带跨视图注意力的非对称 UNet,它读取这四个视图及其相机射线,为每个视图的每个输出像素返回一个高斯:4 x 128 x 128 = 65,536 个高斯,其中不透明度高于 0.005 的会被保留,与上游保存的方式一致。

上游在 CUDA 上需要 xformers,并用一个非商用的光栅化器渲染。LibreYOLO 通过 PyTorch 的 SDPA 运行注意力,并且不做渲染,所以模型可以在英伟达 GPU、Apple Silicon 和 CPU 上运行,GPU 上用 fp16,CPU 上用 fp32。在 CUDA 上,一个种子能复现上游的物体;其他设备在同一个种子下会抽到不同的噪声。

输出是 result.gaussians,与 Speridlabs Idol 的载荷相同,可保存为 .ply 或 .splat。

设置

设置默认值含义
steps30ImageDream 的 DDIM 采样步数。
guidance5.0无分类器引导(classifier-free guidance);设为 1 即关闭。
elevation0拍摄图片时的相机高度,单位为度;负值表示在物体上方。

变体

一个尺寸,0.4b:4.2 亿参数的 LGM 网络(约 0.8 GB),加上 13 亿参数的 ImageDream 多视图阶段及其两个 CLIP 编码器(约 4.0 GB)。

导出

任务ONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNAxelerancnnTFLiteCoreMLCore AI
3D generation3D generation to ONNX:不支持3D generation to TorchScript:不支持3D generation to ExecuTorch:不支持3D generation to TensorRT:不支持3D generation to OpenVINO:不支持3D generation to Paddle:不支持3D generation to MNN:不支持3D generation to RKNN:不支持3D generation to Axelera:不支持3D generation to ncnn:不支持3D generation to TFLite:不支持3D generation to CoreML:不支持3D generation to Core AI:不支持

LibreGen 的 3D 家族没有实现导出。export()、train() 和 val() 会抛出 NotImplementedError(见库里的 ADR 0031)。

许可证

请检查你所下载的具体权重在 Hugging Face 仓库中的许可。LibreYOLO 组织里的每个检查点都附有许可,同一家族内也不一定相同。该仓库是权威来源;以下摘要说明本页上次验证时适用的情况。

这里只说明涉及的许可证,不构成法律意见。如果答案对商用很重要,请自行阅读许可证并咨询法律顾问。

原始工作
LGM, 3D Topia
上游许可
MIT and CreativeML OpenRAIL++-M
LibreYOLO 代码
MIT
权重
采用 MIT and CreativeML OpenRAIL++-M 许可,重新发布在 huggingface.co/LibreYOLO
解读
LGM runs in two stages with different licenses. The LGM Gaussian model and its code are MIT, a permissive license that allows commercial and closed-source use with the copyright notice kept. The first stage, the ImageDream multi-view diffusion model (fine-tuned from MVDream and Stable Diffusion 2.1), is declared openrail upstream and LibreYOLO carries the CreativeML OpenRAIL++-M License of its Stable Diffusion 2.1 lineage: commercial use is allowed, but its use-based restrictions (no illegal, harmful, discriminatory or deceptive uses, among others) bind you and must be passed on to anyone you share the model or derivatives with. LibreYOLO's adapter is MIT; the code it adapts from LGM is MIT, with parts following ImageDream, the DINOv2 attention module and kiuikit under Apache-2.0, noted in libreyolo/models/gen/lgm/NOTICE. LibreYOLO leaves out upstream's renderer, which needs Inria's non-commercial Gaussian Splatting rasterizer. Weights are redistributed unchanged at pinned revisions: ashawkey/LGM with the BiRefNet weights (MIT) as LibreYOLO/LibreLGM0.4b, and ashawkey/imagedream-ipmv-diffusers as LibreYOLO/LibreImageDream; neither is gated.

LGM 出自 3D Topia 的 Jiaxiang Tang 等人(3DTopia/LGM)。两个阶段的许可证不同:

  • LGM 高斯模型及其代码采用 MIT 许可。
  • ImageDream 带有使用限制。 上游声明它采用 OpenRAIL 许可,LibreYOLO 按其 Stable Diffusion 2.1 谱系适用 CreativeML OpenRAIL++-M License:允许商用,但其基于用途的限制(不得用于非法、有害、歧视性或欺骗性用途等)对你有约束力,并且必须随模型或衍生作品一起传递下去。

权重按固定版本原样再分发:ashawkey/LGM 与 BiRefNet(MIT)一起作为 LibreYOLO/LibreLGM0.4b,ashawkey/imagedream-ipmv-diffusers 作为 LibreYOLO/LibreImageDream。两者都不需要申请访问。上游的渲染器需要 Inria 的非商用光栅化器,因此没有包含在内。

引用

@article{tang2024lgm,
  title={LGM: Large Multi-View Gaussian Model for High-Resolution 3D Content Creation},
  author={Tang, Jiaxiang and Chen, Zhaoxi and Chen, Xiaokang and Wang, Tengfei and Zeng, Gang and Liu, Ziwei},
  journal={arXiv preprint arXiv:2402.05054},
  year={2024}
}

复制自作者在 github.com/3DTopia/LGM#citation 上提供的引用块。

已针对 LibreYOLO v1.8.0 验证。本页的支持表、检查点和基准测试数据由已发布的库和权重生成,并非手工编写。