CRM
CRM(Convolutional Reconstruction Model)是清华大学的图像转 3D 模型。两个多视图扩散模型生成物体的六个视图及其坐标图,一个卷积 UNet 把它们转成三平面(triplane),再由 FlexiCubes 提取带颜色的网格。LibreYOLO 通过 LibreGen 工厂用纯 PyTorch 运行它。
- 任务
- 3d generation
- 安装
pip install "libreyolo[gen]"- 支持层级
- 兄弟层级,自 v1.8.0 起。一个独立的产品面,有自己的工厂和契约。
- 许可
- 代码采用 MIT and Apache-2.0,权重采用 CreativeML OpenRAIL++-M。商用
安装
pip install "libreyolo[gen]"texture=True 还需要采用 MIT 许可的 xatlas 包(pip install xatlas)来做 UV 展开。
预测
没有任何内容需要申请访问,也不需要登录。权重在首次使用时从 LibreYOLO/LibreCRM 的固定版本下载。
from libreyolo import LibreGen, SAMPLE_IMAGE model = LibreGen("crm") # 权重在首次使用时下载result = model(SAMPLE_IMAGE, seed=0) result.save("object.obj") # 顶点颜色写成 `v x y z r g b`m = result.meshesprint(m.vertices[0].shape, m.extras["vertex_colors"][0].shape)# 把物体以 .obj 保存到 runs/generate/predict 下libreyolo generate source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/guggenheim-bilbao.jpg model=crm seed=0libreyolo generate source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/guggenheim-bilbao.jpg model=crm texture=true# pip install xatlas (MIT 许可,用于 UV 展开)from libreyolo import LibreGen, SAMPLE_IMAGE model = LibreGen("crm")model(SAMPLE_IMAGE, texture=True).save("object.obj")# 写出 object.obj、object.mtl 和 object_texture.png两个多视图扩散模型先生成物体的六个正交视图,再生成它们的规范坐标图;一个卷积 UNet 把它们转成三平面(triplane),FlexiCubes 再提取一个按三平面上色的网格。上游需要 xformers、nvdiffrast(英伟达,非商用)和一个 GPL 网格库;LibreYOLO 用纯 PyTorch 运行同样的权重,支持英伟达 GPU、Apple Silicon 和 CPU,并像上游一样在 GPU 上使用 fp16。
输入图像会在灰色背景上补成正方形,不做裁剪,所以照片里物体占满画面时效果最好。同一个种子在每种设备上给出相同的初始噪声;在 CUDA 上重复调用会得到相同的视图和三角形,顶点可能有约 1e-7 的偏移。库在 RTX 3090 上测得每个物体约 12 秒、12 GB。
result.meshes 包含 vertices (V, 3),z 轴朝上,范围 [-0.5, 0.5]^3;faces (F, 3);以及 extras["vertex_colors"] (V, 3),RGB 值在 [0, 1] 内。texture=True 会像上游一样烘焙一张 1024 x 1024 的 UV 纹理。
设置
| 设置 | 默认值 | 含义 |
|---|---|---|
steps | 50 | 两个扩散阶段的采样步数,1 到 499。 |
guidance | 5.0 | 两个阶段的无分类器引导(classifier-free guidance)。 |
texture | False | 烘焙 UV 纹理(在 .obj 旁边写出 .mtl 和 .png)。 |
变体
一个检查点(checkpoint),41 亿参数:两个 20 亿参数的多视图扩散模型(各含 UNet、OpenCLIP ViT-H/14 和 SD VAE),以及一个 1.2 亿参数的重建 UNet。约 12.8 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 组织里的每个检查点都附有许可,同一家族内也不一定相同。该仓库是权威来源;以下摘要说明本页上次验证时适用的情况。
这里只说明涉及的许可证,不构成法律意见。如果答案对商用很重要,请自行阅读许可证并咨询法律顾问。
- 原始工作
- CRM, Tsinghua University (TSAIL)
- 上游许可
- CreativeML OpenRAIL++-M
- LibreYOLO 代码
- MIT
- 权重
- 采用 CreativeML OpenRAIL++-M 许可,重新发布在 huggingface.co/LibreYOLO
- 解读
- The CRM code is MIT and its model card declares MIT for the weights, but CRM's two diffusion models are fine-tuned from ImageDream and MVDream, themselves from Stable Diffusion 2.1, so LibreYOLO treats the weights as under the CreativeML OpenRAIL++-M License of that lineage. OpenRAIL++-M allows commercial use, 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 CRM is MIT, the FlexiCubes meshing comes from NVIDIA's Apache-2.0 release, and ImageDream parts are Apache-2.0, noted in libreyolo/models/gen/crm/NOTICE. CRM's own FlexiCubes copies with NVIDIA's all-rights-reserved header, nvdiffrast (non-commercial) and the GPL-3.0 mesh tools upstream calls are not used. The Zhengyi/CRM weights are redistributed unchanged as LibreYOLO/LibreCRM, whose card carries the OpenRAIL++-M terms; Background removal runs on LibreYOLO's BiRefNet port with the ZhengPeng7/BiRefNet weights (MIT), from LibreYOLO/LibreTRELLISl. Both are pinned and not gated.
CRM 出自清华大学(TSAIL)(thu-ml/CRM)。代码采用 MIT 许可,模型卡也声明权重采用 MIT 许可。
这些权重带有使用限制。 CRM 的两个扩散模型源自 ImageDream、MVDream 和 Stable Diffusion 2.1,所以 LibreYOLO 把它们视为适用这一谱系的 CreativeML OpenRAIL++-M License。允许商用,但其基于用途的限制(不得用于非法、有害、歧视性或欺骗性用途等)对你有约束力,而且你把模型或衍生作品分享给任何人时都必须把这些限制传递下去。
Zhengyi/CRM 权重以 LibreYOLO/LibreCRM 原样再分发,其模型卡带有 OpenRAIL++-M 条款。FlexiCubes 来自英伟达采用 Apache-2.0 许可的发布;上游调用的 nvdiffrast 和 GPL-3.0 网格工具都没有使用。
引用
@article{wang2024crm,
title={CRM: Single Image to 3D Textured Mesh with Convolutional Reconstruction Model},
author={Zhengyi Wang and Yikai Wang and Yifei Chen and Chendong Xiang and Shuo Chen and Dajiang Yu and Chongxuan Li and Hang Su and Jun Zhu},
journal={arXiv preprint arXiv:2403.05034},
year={2024}
}复制自作者在 github.com/thu-ml/CRM#citation 上提供的引用块。