TripoSR
TripoSR 是 Tripo AI 和 Stability AI 推出的前馈式图像转 3D 模型。它一次前向就把一张物体图片转成三平面 NeRF(triplane NeRF),并把物体作为带顶点颜色的三角网格返回。LibreYOLO 通过 LibreGen 工厂用纯 PyTorch 运行它。
- 任务
- 3d generation
- 安装
pip install "libreyolo[gen]"- 支持层级
- 兄弟层级,自 v1.8.0 起。一个独立的产品面,有自己的工厂和契约。
- 许可
- 代码采用 MIT and Apache-2.0,权重采用 MIT。商用
安装
TripoSR 使用 LibreGen extra,它会带上用于 marching cubes 的 scikit-image。
pip install "libreyolo[gen]"预测
权重在首次使用时从 LibreYOLO/LibreTripoSR 下载,没有任何内容需要申请访问,也不需要登录。
from libreyolo import LibreGen, SAMPLE_IMAGE model = LibreGen("triposr") # 权重在首次使用时下载result = model(SAMPLE_IMAGE) result.save("object.obj") # 顶点颜色写成 `v x y z r g b`m = result.meshesprint(m.vertices[0].shape, m.faces[0].shape) # (V, 3), (F, 3)# 把物体以 .obj 保存到 runs/generate/predict 下libreyolo generate source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/guggenheim-bilbao.jpg model=triposrfrom libreyolo import LibreGen, SAMPLE_IMAGE model = LibreGen("triposr")result = model(SAMPLE_IMAGE, resolution=384) # 更精细的 marching cubes 网格result = model(SAMPLE_IMAGE, threshold=25.0) # 表面处的密度一个 DINO ViT-B/16 对 512 px 的输入编码,一个 transformer 一次前向从中解码出三平面 NeRF,网格就是 NeRF 密度的 marching cubes 等值面。这里没有采样,所以 seed 像每个 LibreGen 家族一样可以传入,但不会改变任何东西。它在 GPU 上大约需要一秒,在英伟达 GPU、Apple Silicon 和 CPU 上用 fp32 运行。
输入源可以是 predict 接受的任何东西:路径、URL、PIL 图像、NumPy 数组、文件夹或列表。真正带透明通道的图像会直接作为抠图使用;其他图像会先用 LibreYOLO 移植的 BiRefNet 移除背景。
result.meshes 为每个物体存放一个网格:vertices (V, 3),z 轴朝上,位于 [-0.5, 0.5]^3 内;faces (F, 3);以及 extras["vertex_colors"] (V, 3),RGB 值在 [0, 1] 内。输入视角沿 -x 方向看,所以物体的正面朝向 +x。save() 写出带顶点颜色的 .obj。
设置
| 设置 | 默认值 | 含义 |
|---|---|---|
resolution | 256 | marching cubes 网格分辨率,从 32 到 1024。 |
threshold | 25.0 | 表面处的密度。 |
margin | 1/0.85 | 裁剪边长与物体尺寸之比(上游的前景比例 0.85)。 |
marching cubes 通过 scikit-image 运行,而不是上游的 torchmcubes:等值面相同,只是三角化方式不同。
变体
一个检查点(checkpoint),4.2 亿参数,约 1.7 GB,BiRefNet 另需 0.4 GB。
导出
| 任务 | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | Axelera | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3D generation | 3D 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 组织里的每个检查点都附有许可,同一家族内也不一定相同。该仓库是权威来源;以下摘要说明本页上次验证时适用的情况。
这里只说明涉及的许可证,不构成法律意见。如果答案对商用很重要,请自行阅读许可证并咨询法律顾问。
- 原始工作
- TripoSR, Tripo AI and Stability AI
- 上游许可
- MIT
- LibreYOLO 代码
- MIT
- 权重
- 采用 MIT 许可,重新发布在 huggingface.co/LibreYOLO
- 解读
- MIT is a permissive license, so the code and weights can be used in commercial and closed-source products; the only obligation is to keep the copyright and license notice with copies. LibreYOLO's adapter is MIT; the triplane, NeRF and mesh-extraction code it adapts from TripoSR keeps MIT, and the transformer and DINO ViT encoder follow HuggingFace diffusers and transformers code under Apache-2.0, with their notices in libreyolo/models/gen/triposr/NOTICE. LibreYOLO avoids upstream's torchmcubes (MPL-2.0) by running marching cubes through scikit-image (BSD-3-Clause). The stabilityai/TripoSR weights (MIT) are redistributed unchanged as LibreYOLO/LibreTripoSR; Background removal runs on LibreYOLO's BiRefNet port with the ZhengPeng7/BiRefNet weights (MIT), from LibreYOLO/LibreTRELLISl. Both are pinned and not gated.
TripoSR 出自 Tripo AI 和 Stability AI。代码(VAST-AI-Research/TripoSR)和 stabilityai/TripoSR 权重采用 MIT 许可,所以保留版权声明即可商用。LibreYOLO 把这些权重原样再分发为 LibreYOLO/LibreTripoSR。它用 scikit-image(BSD-3-Clause)替代了上游的 torchmcubes(MPL-2.0);BiRefNet 背景移除权重采用 MIT 许可。
引用
@article{TripoSR2024,
title={TripoSR: Fast 3D Object Reconstruction from a Single Image},
author={Tochilkin, Dmitry and Pankratz, David and Liu, Zexiang and Huang, Zixuan and and Letts, Adam and Li, Yangguang and Liang, Ding and Laforte, Christian and Jampani, Varun and Cao, Yan-Pei},
journal={arXiv preprint arXiv:2403.02151},
year={2024}
}复制自作者在 github.com/VAST-AI-Research/TripoSR#citation 上提供的引用块。