Skip to content

Commit dd72e42

Browse files
committed
add gradio
1 parent 7574967 commit dd72e42

19 files changed

+1377
-99
lines changed

README.md

+58-45
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,6 @@ GaussianAnything: Interactive Point Cloud Latent Diffusion for 3D Generation
3939
GaussianAnything generates <i>high-quality</i> and <i>editable</i> surfel Gaussians through a cascaded native 3D diffusion pipeline, given single-view images or texts as the conditions.
4040
</strong>
4141

42-
<!-- <table>
43-
<tr></tr>
44-
<tr>
45-
<td>
46-
<img src="assets/t23d/dit-l2/the-eiffel-tower.gif">
47-
</td>
48-
<td>
49-
<img src="assets/t23d/dit-l2/stone-waterfall-with-wooden-shed.gif">
50-
</td>
51-
<td>
52-
<img src="assets/t23d/dit-l2/a-plate-of-sushi.gif">
53-
</td>
54-
<td>
55-
<img src="assets/t23d/dit-l2/wooden-chest-with-golden-trim.gif">
56-
</td>
57-
<td>
58-
<img src="assets/t23d/dit-l2/a-blue-plastic-chair.gif">
59-
</td>
60-
</tr>
61-
62-
63-
<tr>
64-
<td align='center' width='20%'>The eiffel tower.</td>
65-
<td align='center' width='20%'>A stone waterfall with wooden shed.</td>
66-
<td align='center' width='20%'>A plate of sushi</td>
67-
<td align='center' width='20%'>A wooden chest with golden trim</td>
68-
<td align='center' width='20%'>A blue plastic chair.</td>
69-
</tr>
70-
<tr></tr>
71-
</table> -->
72-
7342

7443
https://github.com/user-attachments/assets/988ea293-b3ed-41d4-87e9-a20c89bfef98
7544

@@ -118,6 +87,10 @@ This repository contains the official implementation of GaussianAnything: Intera
11887

11988
## :mega: Updates
12089

90+
[27/Nov/2024] Release gradio demo (local version), which supports image-to-3D generation. Simply call ```python scripts/gradio_app_cascaded.py```.
91+
92+
[27/Nov/2024] Support colored point cloud (2D Gaussians centers) and TSDF mesh export. Enabled by default```--export_mesh True```.
93+
12194
[24/Nov/2024] Inference code and checkpoint release.
12295

12396
[13/Nov/2024] Initial release.
@@ -137,7 +110,8 @@ bash shell_scripts/final_release/inference/gradio_sample_obajverse_i23d_dit.sh
137110
- [x] Release inference code and checkpoints.
138111
- [x] Release Training code.
139112
- [x] Release pre-extracted latent codes for 3D diffusion training.
140-
- [ ] Release Gradio Demo.
113+
- [x] Release Gradio Demo (locally).
114+
- [ ] Release Gradio Demo (Huggingface ZeroGPU).
141115
- [ ] Release the evaluation code.
142116
- [ ] Lint the code.
143117

@@ -157,48 +131,87 @@ bash shell_scripts/final_release/inference/gradio_sample_obajverse_i23d_dit.sh
157131
- [Citation](#bibtex)
158132
- [Contact](#contact) -->
159133

134+
135+
160136
# Inference
161137

162-
* All diffusion checkpoints will be automatically loaded from huggingface.
138+
## setup the environment (the same env as [LN3Diff, ECCV 2024](https://github.com/NIRVANALAN/LN3Diff?tab=readme-ov-file))
139+
140+
```bash
141+
conda create -n ga python=3.10
142+
conda activate ga
143+
pip intall -r requrements.txt # will install the surfel Gaussians environments and pytorch3d automatically.
144+
```
145+
146+
## Gradio demo (Image-to-3D)
147+
148+
For image-to-3D generation with GaussianAnything, we have provided a gradio interface. After setting up the environment, please run ```python scripts/gradio_app_cascaded.py``` to launch the gradio locally. The code has been tested on V100 32GiB GPU.
149+
150+
<img title="a title" alt="Gaussians XYZ Visualization" src="./assets/i23d-output/gradio-ga.png">
151+
152+
<!-- Then, install pytorch3d with
153+
```bash
154+
pip install git+https://github.com/facebookresearch/pytorch3d.git@stable
155+
``` -->
156+
157+
## Checkpoints
158+
159+
* All diffusion checkpoints will be automatically loaded from [huggingface.co/yslan/GaussianAnything](https://huggingface.co/yslan/GaussianAnything/tree/main).
163160
* The results will be directly dumped to ```./logs```, and can be modified by changing ```$logdir``` in the bash file accordingly.
164161

165162
<!-- To load the checkpoint automatically: please replace ```/mnt/sfs-common/yslan/open-source``` with ```yslan/GaussianAnything/ckpts/checkpoints```. -->
166163

164+
To set the CFG score and random seed, please update ```$unconditional_guidance_scale$``` and ```$seed$``` in the bash file.
165+
167166

167+
## I23D (requires two stage generation):
168168

169-
## Text-2-3D:
169+
set the ```$data_dir``` accordingly. For some demo image, please download from [huggingfac.co/yslan/GaussianAnything/demo-img](https://huggingface.co/yslan/GaussianAnything/tree/main/demo-img). We have also included the demo images shown in the paper in ```./assets/demo-image-for-i23d/instantmesh``` and ```./assets/demo-image-for-i23d/gso```.
170170

171-
Please update the caption for 3D generation in ```datasets/caption-forpaper.txt```. T o change the number of samples to be generated, please change ```$num_samples``` in the bash file.
171+
In the bash file, we set ```data_dir="./assets/demo-image-for-i23d/instantmesh"``` by default.
172172

173173
**stage-1** (point cloud generation):
174174
```
175-
bash shell_scripts/release/inference/t23d/stage1-t23d.sh
175+
bash shell_scripts/release/inference/i23d/i23d-stage1.sh
176176
```
177-
then, set the ```$stage_1_output_dir``` to the ```$logdir``` of the above stage.
177+
178+
The sparse point cloud wll be saved to, e.g., ```logs/i23d/stage-1/dino_img/house2-input/sample-0-0.ply```. Note that ```$num_samples$``` samples will be saved, which is set in the bash file.
179+
180+
Then, set the ```$stage_1_output_dir``` to the ```$logdir``` of the above stage.
178181

179182
**stage-2** (2D Gaussians generation):
180183
```
181-
bash shell_scripts/release/inference/t23d/stage2-t23d.sh
184+
bash shell_scripts/release/inference/i23d/i23d-stage2.sh
182185
```
183186

184-
The results will be dumped to ```./logs/t23d/stage-2```
187+
In the output dir of each instance, e.g., ```./logs/i23d/stage-2/dino_img/house2-input```, the code dumped the colored point cloud extracted from the surfel Gaussians center (xyz+RGB) ```sample-0-0-gaussian-pcd.ply```:
185188

186-
## I23D (requires two stage generation):
189+
<img title="a title" alt="Gaussians XYZ Visualization" src="./assets/i23d-output/house-xyz.png">
187190

188-
set the $data_dir accordingly. For some demo image, please download from [huggingfac.co/yslan/GaussianAnything/demo-img](https://huggingface.co/yslan/GaussianAnything/tree/main/demo-img).
191+
The TSDF mesh ```stage1ID_0-stage2ID-0-mesh.obj```:
192+
193+
<img title="a title" alt="Surfel Gaussians TSDF" src="./assets/i23d-output/house-tsdf.png">
194+
195+
Both can be visualized by meshlab.
196+
197+
198+
## Text-2-3D (requires two stage generation):
199+
200+
Please update the caption for 3D generation in ```datasets/caption-forpaper.txt```. T o change the number of samples to be generated, please change ```$num_samples``` in the bash file.
189201

190202
**stage-1** (point cloud generation):
191203
```
192-
bash shell_scripts/release/inference/i23d/i23d-stage1.sh
204+
bash shell_scripts/release/inference/t23d/stage1-t23d.sh
193205
```
194-
195-
then, set the $stage_1_output_dir to the $logdir of the above stage.
206+
then, set the ```$stage_1_output_dir``` to the ```$logdir``` of the above stage.
196207

197208
**stage-2** (2D Gaussians generation):
198209
```
199-
bash shell_scripts/release/inference/i23d/i23d-stage1.sh
210+
bash shell_scripts/release/inference/t23d/stage2-t23d.sh
200211
```
201212

213+
The results will be dumped to ```./logs/t23d/stage-2```
214+
202215
## 3D VAE Reconstruction:
203216

204217
To encode a 3D asset into the latent point cloud, please download the pre-trained VAE checkpoint from [huggingfac.co/yslan/gaussiananything/ckpts/vae/model_rec1965000.pt](https://huggingface.co/yslan/GaussianAnything/blob/main/ckpts/vae/model_rec1965000.pt) to ```./checkpoint/model_rec1965000.pt```.
202 KB
Loading
125 KB
Loading

assets/i23d-output/gradio-ga.png

325 KB
Loading

assets/i23d-output/house-tsdf.png

215 KB
Loading

assets/i23d-output/house-xyz.png

253 KB
Loading

0 commit comments

Comments
 (0)