NIRVANALAN commited on
Commit
a038b23
1 Parent(s): 11e6f7b

update readme

Browse files
Files changed (1) hide show
  1. README.md +9 -389
README.md CHANGED
@@ -1,389 +1,9 @@
1
- <div align="center">
2
-
3
- <h1>
4
- LN3Diff: Scalable Latent Neural Fields Diffusion for Speedy 3D Generation (ECCV 2024)
5
- </h1>
6
-
7
- <div>
8
- <a href='https://github.com/NIRVANALAN' target='_blank'>Yushi Lan</a><sup>1</sup>&emsp;
9
- <a href='https://hongfz16.github.io' target='_blank'>Fangzhou Hong</a><sup>1</sup>&emsp;
10
- <a href='https://williamyang1991.github.io/' target='_blank'>Shuai Yang</a><sup>2</sup>&emsp;
11
- <a href='https://shangchenzhou.com/' target='_blank'>Shangchen Zhou</a><sup>1</sup>&emsp;
12
- <a href='https://sg.linkedin.com/in/xuyi-meng-673779208' target='_blank'>Xuyi Meng</a><sup>1</sup>&emsp;
13
- <br>
14
- <a href='https://daibo.info/' target='_blank'>Bo Dai</a>
15
- <sup>3</sup>
16
- <a href='https://xingangpan.github.io/' target='_blank'>Xingang Pan</a>
17
- <sup>1</sup>
18
- <a href='https://www.mmlab-ntu.com/person/ccloy/' target='_blank'>Chen Change Loy</a>
19
- <sup>1</sup> &emsp;
20
- </div>
21
- <div>
22
- S-Lab, Nanyang Technological University<sup>1</sup>;
23
- <!-- &emsp; -->
24
- <br>
25
- Wangxuan Institute of Computer Technology, Peking University<sup>2</sup>;
26
- <br>
27
- <!-- &emsp; -->
28
- Shanghai Artificial Intelligence Laboratory <sup>3</sup>
29
- <!-- <br>
30
- <sup>*</sup>corresponding author -->
31
- </div>
32
-
33
- <div>
34
- <!-- <a target="_blank" href="https://colab.research.google.com/github/nirvanalan/E3DGE/blob/main/notebook/CVPR23_E3DGE_Demo.ipynb">
35
- <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
36
- </a> -->
37
- <a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FNIRVANALAN%2FLN3Diff&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>
38
- </div>
39
- <br>
40
- <!-- <h4> -->
41
- <strong>
42
- LN3Diff (Latent Neural Fields 3D Diffusion) is a generic, feedforward 3D LDM framework that creates high-quality 3D object mesh from text within SECONDS.
43
- </strong>
44
- <!-- </h4> -->
45
-
46
- <!-- <table>
47
- <tr></tr>
48
- <tr>
49
- <td>
50
- <img src="assets/t23d/standing-hund.gif">
51
- </td>
52
- <td>
53
- <img src="assets/t23d/ufo.gif">
54
- </td>
55
- <td>
56
- <img src="assets/t23d/mast.gif">
57
- </td>
58
- <td>
59
- <img src="assets/t23d/cannon.gif">
60
- </td>
61
- <td>
62
- <img src="assets/t23d/blue-plastic-chair.gif">
63
- </td>
64
- </tr>
65
-
66
-
67
-
68
- <tr>
69
- <td align='center' width='20%'>A standing hund.</td>
70
- <td align='center' width='20%'>An UFO space aircraft.</td>
71
- <td align='center' width='20%'>A sailboat with mast.</td>
72
- <td align='center' width='20%'>An 18th century cannon.</td>
73
- <td align='center' width='20%'>A blue plastic chair.</td>
74
- </tr>
75
- <tr></tr>
76
- </table> -->
77
-
78
- <table>
79
- <tr></tr>
80
- <tr>
81
- <td>
82
- <img src="assets/t23d/dit-l2/the-eiffel-tower.gif">
83
- </td>
84
- <td>
85
- <img src="assets/t23d/dit-l2/stone-waterfall-with-wooden-shed.gif">
86
- </td>
87
- <td>
88
- <img src="assets/t23d/dit-l2/a-plate-of-sushi.gif">
89
- </td>
90
- <td>
91
- <img src="assets/t23d/dit-l2/wooden-chest-with-golden-trim.gif">
92
- </td>
93
- <td>
94
- <img src="assets/t23d/dit-l2/a-blue-plastic-chair.gif">
95
- </td>
96
- </tr>
97
-
98
-
99
- <tr>
100
- <td align='center' width='20%'>The eiffel tower.</td>
101
- <td align='center' width='20%'>A stone waterfall with wooden shed.</td>
102
- <td align='center' width='20%'>A plate of sushi</td>
103
- <td align='center' width='20%'>A wooden chest with golden trim</td>
104
- <td align='center' width='20%'>A blue plastic chair.</td>
105
- </tr>
106
- <tr></tr>
107
- </table>
108
-
109
- <!-- <br> -->
110
-
111
- For more visual results, go checkout our <a href="https://nirvanalan.github.io/projects/ln3diff/" target="_blank">project page</a> :page_with_curl:
112
-
113
- <strike>
114
- Codes coming soon :facepunch:
115
- </strike>
116
-
117
- This repository contains the official implementation of LN3Diff:
118
- Scalable Latent Neural Fields Diffusion for Speedy 3D Generation
119
-
120
- </div>
121
-
122
- ---
123
-
124
- <h4 align="center">
125
- <a href="https://nirvanalan.github.io/projects/ln3diff/" target='_blank'>[Project Page]</a>
126
-
127
- <a href="https://arxiv.org/pdf/2403.12019.pdf" target='_blank'>[arXiv]</a>
128
- </h4>
129
-
130
-
131
- ## :mega: Updates
132
-
133
- [08/2024] We have released the new 3D VAE trained on G-Objaverse full sets, and the corresponding DiT-based T23D and I23D model, trained with flow-matching. Please check the samples below.
134
-
135
- [06/2024] LN3Diff got accepted to ECCV 2024 :partying_face:!
136
-
137
- [04/2024] Inference and training codes on Objaverse, ShapeNet and FFHQ are released, including pre-trained model and training dataset.
138
-
139
- [03/2024] Initial code release.
140
-
141
-
142
- ## :dromedary_camel: TODO
143
-
144
- - [ ] Add Gradio demo.
145
- - [x] Release the new I23D flow-matching-based DiT model trained with 180K G-Objaverse instances (Aug 2024).
146
- - [x] Release the new T23D DDPM-based DiT model trained with 180K G-Objaverse instances (Aug 2024).
147
- - [x] Release the new 3D VAE trained with 180K G-Objaverse instances (July 2024).
148
- - [x] Release DiT-based, flow-matching based 3D generation framework (July 2024).
149
- - [ ] Polish the dataset preparation and training doc.
150
- - [ ] add metrics evaluation scripts and samples.
151
- - [ ] Lint the code.
152
- - [x] Release the inference and training code (Apr 2024).
153
- - [x] Release the pre-trained checkpoints of ShapeNet and FFHQ (Apr 2024).
154
- - [x] Release the pre-trained checkpoints of T23D Objaverse model trained with 30K+ instances dataset (Apr 2024).
155
- - [x] Release the stage-1 VAE of Objaverse trained with 80K+ instances dataset (Apr 2024).
156
-
157
-
158
-
159
- ## :handshake: Citation
160
- If you find our work useful for your research, please consider citing the paper:
161
- ```
162
- @inproceedings{lan2024ln3diff,
163
- title={LN3Diff: Scalable Latent Neural Fields Diffusion for Speedy 3D Generation},
164
- author={Yushi Lan and Fangzhou Hong and Shuai Yang and Shangchen Zhou and Xuyi Meng and Bo Dai and Xingang Pan and Chen Change Loy},
165
- year={2024},
166
- booktitle={ECCV},
167
- }
168
- ```
169
-
170
- ## :desktop_computer: Requirements
171
-
172
- NVIDIA GPUs are required for this project.
173
- We conduct all the training on NVIDIA V100-32GiB (ShapeNet, FFHQ) and NVIDIA A100-80GiB (G-Objaverse).
174
- We have test the inference codes on NVIDIA V100.
175
- We recommend using anaconda to manage the python environments.
176
-
177
- The environment can be created via ```conda env create -f environment_ln3diff.yml```, and activated via ```conda activate ln3diff```.
178
- If you want to reuse your own PyTorch environment, install the following packages in your environment:
179
-
180
- ```
181
- pip install -r requirements.txt
182
- ```
183
-
184
- ## :running_woman: Inference
185
-
186
- ### Download Models
187
-
188
- The pretrained stage-1 VAE and stage-2 LDM can be downloaded via [OneDrive](https://entuedu-my.sharepoint.com/:u:/g/personal/yushi001_e_ntu_edu_sg/EdOR7CbhyndFryaDnlexFqwBIr9XzFgdKXoLOOIagt7Ggw?e=ZzULnq).
189
-
190
- Put the downloaded checkpoints under ```checkpoints``` folder for inference. The checkpoints directory layout should be
191
-
192
- checkpoints
193
- ├── objaverse
194
- │ ├── model_rec1890000.pt # DiT/L-based 3D VAE
195
- │ └── objaverse-dit
196
- │ └── t23d/model_joint_denoise_rec_model3820000.pt #
197
- │ └── i23d/model_joint_denoise_rec_model2990000.pt #
198
- ├── shapenet
199
- │ └── car
200
- │ └── model_joint_denoise_rec_model1580000.pt
201
- │ └── chair
202
- │ └── model_joint_denoise_rec_model2030000.pt
203
- │ └── plane
204
- │ └── model_joint_denoise_rec_model770000.pt
205
- ├── ffhq
206
- │ └── objaverse-vae/model_joint_denoise_rec_model1580000.pt
207
- └── ...
208
-
209
-
210
-
211
- ### Inference Commands
212
-
213
- <strong>Note that to extract the mesh, 24GiB VRAM is required.</strong>
214
-
215
- ## (New) Inference: (Single) Image-to-3D
216
-
217
- We train a single-image-conditioned DiT-L/2 on the extracted VAE latents using [flow-matching](https://github.com/willisma/SiT]) framework, for more controllable 3D generation. To inference the results, please run
218
-
219
- ```bash
220
- bash shell_scripts/final_release/inference/sample_obajverse_i23d_dit.sh
221
- ```
222
-
223
- Which reconstructs the 3D assets given input images from ```assets/i23d_examples/for_demo_inference```. The input images are borrowed from [InstantMesh](https://github.com/TencentARC/InstantMesh). The model outputs are shown below (input in the next row.):
224
-
225
- <table>
226
- <tr></tr>
227
- <tr>
228
- <td>
229
- <img src="assets/i23d/single-img-cond/genshin-house.gif">
230
- </td>
231
- <td>
232
- <img src="assets/i23d/single-img-cond/chest.gif">
233
- </td>
234
- <td>
235
- <img src="assets/i23d/single-img-cond/flower.gif">
236
- </td>
237
- <td>
238
- <img src="assets/i23d/single-img-cond/robot.gif">
239
- </td>
240
- <td>
241
- <img src="assets/i23d/single-img-cond/birthday-cake.gif">
242
- </td>
243
- <!-- <td>
244
- <img src="assets/i23d/single-img-cond/birthday-cake.gif">
245
- </td> -->
246
- </tr>
247
-
248
- To run 3D reconstruction with your own data, just change the ```$eval_path``` in the above bash file. E.g., change it to ```eval_path=./assets/i23d_examples/instant_mesh_samples``` will do 3D reconstruction on more real images from InstantMesh.
249
- Also, tuning the cfg through ```$unconditional_guidance_scale``` will balance the generation fidelity and diversity.
250
-
251
-
252
- <tr>
253
- <td align='center' width='20%'>
254
- <img src="assets/i23d_examples/for_demo_inference/genshin_building-input.png">
255
- </td>
256
- <td align='center' width='20%'>
257
- <img src="assets/i23d_examples/for_demo_inference/teasure_chest-input.png">
258
- </td>
259
- <td align='center' width='20%'>
260
- <img src="assets/i23d_examples/instant_mesh_samples/plant-input.png">
261
- </td>
262
- <td align='center' width='20%'>
263
- <img src="assets/i23d_examples/instant_mesh_samples/robot-input.png">
264
- </td>
265
- <td align='center' width='20%'>
266
- <img src="assets/i23d_examples/instant_mesh_samples/cake-input.png">
267
- </td>
268
- <!-- <td align='center' width='20%'>
269
- <img src="assets/i23d_examples/for_demo_inference/sword-input.png">
270
- </td> -->
271
- </tr>
272
- <tr></tr>
273
- </table>
274
-
275
- We have uploaded the inference results on some common I23D images (from InstantMesh) to [onedrive](https://entuedu-my.sharepoint.com/:u:/g/personal/yushi001_e_ntu_edu_sg/EeMmXvoJ0khNjzWLgMBEgMMB_xb9r9ciRkDgjnQCDJqLSg?e=rk9iGs), including the condition images, rendered images/videos and the corresponding extracted textured mesh (with 4 different seeds, and cfg=5.0). Feel free to use them for comparison in your own method.
276
-
277
- ## Inference: Text-to-3D
278
-
279
- We train text-conditioned 3D latent diffusion model on top of the stage-1 extracted latents.
280
- For the following bash inference file, to extract textured mesh from the generated tri-plane, set ```--save_img True```. To change the text prompt, set the ```prompt``` variable. For unconditional sampling, set the cfg guidance ```unconditional_guidance_scale=0```. Feel free to tune the cfg guidance scale to trade off diversity and fidelity.
281
-
282
- Note that the diffusion sampling batch size is set to ```4```, which costs around 16GiB VRAM. The mesh extraction of a single instance costs 24GiB VRAM.
283
-
284
- ### text-to-3D on Objaverse
285
-
286
- ```bash
287
- bash shell_scripts/final_release/inference/sample_obajverse_t23d_dit.sh
288
- ```
289
- which shall reproduce the results shown in the Fig.5 in our paper, using the same text prompts. The results may slightly differ due to random seed used, but the quality are the same. Some output samples are shown in the top figure.
290
-
291
-
292
- Note that the text prompts are directly hard-coded in the ```scripts/vit_triplane_diffusion_sample_objaverse.py```.
293
-
294
- ### text-to-3D on ShapeNet
295
-
296
- For text-to-3D on ShapeNet, run one of the following commands (which conducts T23D on car, chair and plane.)
297
- ```bash
298
- bash shell_scripts/final_release/inference/sample_shapenet_car_t23d.sh
299
- ```
300
-
301
- ```bash
302
- bash shell_scripts/final_release/inference/sample_shapenet_chair_t23d.sh
303
- ```
304
-
305
- ```bash
306
- bash shell_scripts/final_release/inference/sample_shapenet_plane_t23d.sh
307
- ```
308
-
309
- The output samples for FID, COV/MMD calculation are uploaded [here](https://entuedu-my.sharepoint.com/:f:/g/personal/yushi001_e_ntu_edu_sg/Euc7VaM3SH9EmaJuwC0dG9cBWgyLQY6gsiogGMO4NB-ebA?e=fGh2Rv), which shall reproduce the quantitative results in Tab. 1 in the paper.
310
-
311
-
312
- ### text-to-3D on FFHQ
313
- For text-to-3D on FFHQ, run
314
-
315
- ```bash
316
- bash shell_scripts/final_release/inference/sample_ffhq_t23d.sh
317
- ```
318
-
319
- #### Stage-1 VAE 3D reconstruction
320
-
321
- For (Objaverse) stage-1 VAE 3D reconstruction and extract VAE latents for diffusion learning, please run
322
-
323
- ```bash
324
- bash shell_scripts/final_release/inference/sample_obajverse.sh
325
- ```
326
-
327
- which shall give the following result:
328
-
329
- ![Alt Text](assets/stage1_vae_reconstruction/reconstruction_result/stage1-vae-reconstruction.gif)
330
-
331
- The marching-cube extracted mesh can be visualized with Blender/MeshLab:
332
-
333
- <img title="a title" alt="Mesh Visualization" src="./assets/stage1_vae_reconstruction/reconstruction_result/mesh-visualization.png">
334
-
335
- The above VAE input and reconstruction outputs can be found in the [assets/stage1_vae_reconstruction](./assets/stage1_vae_reconstruction) folder.
336
-
337
- **!! We upload the pre-extracted vae latents [here](https://entuedu-my.sharepoint.com/:u:/g/personal/yushi001_e_ntu_edu_sg/Ef_7iMZRQT5Bl5YI0hHabQ0B_Y8INDDuaq78gOJaQSPiqg?e=Ef3rXK), which contains the correponding VAE latents (with shape 32x32x12) of 176K G-buffer Objaverse objects. Feel free to use them in your own task.**
338
-
339
- For more G-buffer Objaverse examples, download the [demo data](https://entuedu-my.sharepoint.com/:f:/g/personal/yushi001_e_ntu_edu_sg/EoyzVJbMyBhLoKFJbbsq6bYBi1paLwQxIDjTkO1KjI4b1g?e=sJc3rQ).
340
-
341
-
342
-
343
-
344
- ## :running_woman: Training
345
-
346
-
347
- ### For training stage-1 VAE
348
-
349
- For Objaverse, we use the rendering provided by [G-buffer Objaverse](https://aigc3d.github.io/gobjaverse/).
350
- We process the data into multi-view chunks for faster loading, and the pre-processed data (176K instances) can be downloaded [here](https://entuedu-my.sharepoint.com/:f:/g/personal/yushi001_e_ntu_edu_sg/EtOUTVZNtGxCg3aJnCDkqZcBmH_-OxCGLQBDwqq9ny5Ing?e=BUHiZi). Noted that you need 450 GiB storage to download the dataset.
351
-
352
- <!-- A demo subset for stage-1 VAE reconstruction can be downloaded from [here](https://entuedu-my.sharepoint.com/:u:/g/personal/yushi001_e_ntu_edu_sg/Eb6LX2x-EgJLpiHbhRxsN9ABnEaSyjG-tsVBcUr_dQ5dnQ?e=JXWQo1). Note that for Objaverse training, we pre-process the raw data into [wds-dataset](https://github.com/webdataset/webdataset) shards for fast and flexible loading. The sample shard data can be found in [here](https://entuedu-my.sharepoint.com/:f:/g/personal/yushi001_e_ntu_edu_sg/ErtZQgnEH5ZItDqdUaiVbJgBe4nhZveJemQRqDW6Xwp7Zg?e=Zqt6Ss). -->
353
-
354
- For ShapeNet, we render our own data with foreground mask for training, which can be downloaded from [here](https://entuedu-my.sharepoint.com/:f:/g/personal/yushi001_e_ntu_edu_sg/EijBXIC_bUNOo0L3wnJKRqoBCqVnhhT_BReYRc1tc_0lrA?e=VQwWOZ). For training, we convert the raw data to LMDB for faster data loading. The pre-processed LMDB file can be downloaded from [here](https://entuedu-my.sharepoint.com/:f:/g/personal/yushi001_e_ntu_edu_sg/Ev7L8Als8K9JtLtj1G23Cc0BTNDbhCQPadxNLLVS7mV2FQ?e=C5woyE).
355
-
356
-
357
- For FFHQ, we use the pre-processed dataset from [EG3D](https://github.com/NVlabs/eg3d) and compress it into LMDB, which can also be found in the onedrive link above.
358
-
359
- ### For training stage-2 LDM
360
-
361
- #### Pre-extracted latents
362
-
363
- We have uploaded the pre-extracted vae latents [here](https://entuedu-my.sharepoint.com/:u:/g/personal/yushi001_e_ntu_edu_sg/Ef_7iMZRQT5Bl5YI0hHabQ0B_Y8INDDuaq78gOJaQSPiqg?e=Ef3rXK), which contains the correponding VAE latents (with shape 32x32x3x4) of 176K G-buffer Objaverse objects. Feel free to use them in the LDM training.
364
-
365
- #### text-to-3D
366
- The Cap3D captions can be downloaded from [here](https://entuedu-my.sharepoint.com/:u:/g/personal/yushi001_e_ntu_edu_sg/EdzVtlT_eUpItE73osqE1UEBSNmC2wfQ0YimmMcLcRhpqw?e=wMHtvx).
367
- Please put under ```'./datasets/text_captions_cap3d.json'```
368
-
369
- #### image-to-3D
370
- We directly use G-Objaverse rendering images for training, and you may need to download their data for this experiments.
371
-
372
-
373
- ### Training Commands
374
-
375
- Coming soon.
376
-
377
- ## More discussions of the proposed method
378
- Compared to existing 3D generation framework such as SDS-based ([DreamFusion](https://dreamfusion3d.github.io/)), mulit-view generation-based ([MVDream](https://arxiv.org/abs/2308.16512), [Zero123++](https://github.com/SUDO-AI-3D/zero123plus), [Instant3D](https://instant-3d.github.io/)) and feedforward 3D reconstruction-based ([LRM](https://yiconghong.me/LRM/), [InstantMesh](https://github.com/TencentARC/InstantMesh), [LGM](https://github.com/3DTopia/LGM)), LN3Diff is an origin 3D Diffusion framework.
379
- Like 2D/Video AIGC pipeline, LN3Diff first trains a 3D-VAE and then conduct LDM training (text/image conditioned) on the learned latent space. Some related methods from the industry ([Shape-E](https://github.com/openai/shap-e), [CLAY](https://github.com/CLAY-3D/OpenCLAY), [Meta 3D Gen](https://arxiv.org/abs/2303.05371)) also follow the same paradigm.
380
- Though currently the performance of the origin 3D LDM's works are overall inferior to reconstruction-based methods, we believe the proposed method has much potential and scales better with more data and compute resources, and may yield better 3D editing performance due to its compatability with diffusion model.
381
-
382
- ## :newspaper_roll: License
383
-
384
- Distributed under the NTU S-Lab License. See `LICENSE` for more information.
385
-
386
-
387
- ## Contact
388
-
389
- If you have any question, please feel free to contact us via `lanyushi15@gmail.com` or Github issues.
 
1
+ title: LN3Diff-I23D
2
+ emoji: 🌖
3
+ colorFrom: green
4
+ colorTo: green
5
+ sdk: gradio
6
+ sdk_version: 4.25.0
7
+ app_file: app.py
8
+ pinned: false
9
+ license: mit