update readme
Browse files
readme.md
CHANGED
@@ -6,10 +6,14 @@ The original paper's project page: [_DreamFusion: Text-to-3D using 2D Diffusion_
|
|
6 |
|
7 |
Examples generated from text prompts only:
|
8 |
|
|
|
|
|
9 |
### [Gallery](assets/gallery.md) | [Update Logs](assets/update_logs.md)
|
10 |
|
|
|
11 |
# Important Notice
|
12 |
-
This project is a **work-in-progress**, and contains lots of differences from the paper. Also, many features are still not
|
|
|
13 |
|
14 |
## Notable differences from the paper
|
15 |
* Since the Imagen model is not publicly available, we use [Stable Diffusion](https://github.com/CompVis/stable-diffusion) to replace it (implementation from [diffusers](https://github.com/huggingface/diffusers)). Different from Imagen, Stable-Diffusion is a latent diffusion model, which diffuses in a latent space instead of the original image space. Therefore, we need the loss to propagate back from the VAE's encoder part too, which introduces extra time cost in training. Currently, 15000 training steps take about 5 hours to train on a V100.
|
@@ -18,9 +22,8 @@ This project is a **work-in-progress**, and contains lots of differences from th
|
|
18 |
|
19 |
|
20 |
## TODOs
|
21 |
-
* The
|
22 |
-
*
|
23 |
-
|
24 |
|
25 |
# Install
|
26 |
|
@@ -29,7 +32,7 @@ git clone https://github.com/ashawkey/stable-dreamfusion.git
|
|
29 |
cd stable-dreamfusion
|
30 |
```
|
31 |
|
32 |
-
**Important**: To download the Stable Diffusion model checkpoint, you should create a file under this directory
|
33 |
|
34 |
### Install with pip
|
35 |
```bash
|
@@ -53,7 +56,7 @@ We also provide the `setup.py` to build each extension:
|
|
53 |
bash scripts/install_ext.sh
|
54 |
|
55 |
# if you want to install manually, here is an example:
|
56 |
-
pip install ./raymarching # install to python path (you still need the raymarching/ folder, since this only
|
57 |
```
|
58 |
|
59 |
### Tested environments
|
@@ -81,6 +84,23 @@ python main_nerf.py --text "a hamburger" --workspace trial_clip -O --guidance cl
|
|
81 |
python main_nerf.py --text "a hamburger" --workspace trial_clip -O --test --gui --guidance clip
|
82 |
```
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
# Acknowledgement
|
85 |
|
86 |
* The amazing original work: [_DreamFusion: Text-to-3D using 2D Diffusion_](https://dreamfusion3d.github.io/).
|
|
|
6 |
|
7 |
Examples generated from text prompts only:
|
8 |
|
9 |
+
Exported meshes viewed with MeshLab:
|
10 |
+
|
11 |
### [Gallery](assets/gallery.md) | [Update Logs](assets/update_logs.md)
|
12 |
|
13 |
+
|
14 |
# Important Notice
|
15 |
+
This project is a **work-in-progress**, and contains lots of differences from the paper. Also, many features are still not implemented now. The current generation quality cannot match the results from the original paper, and still fail badly for many prompts.
|
16 |
+
|
17 |
|
18 |
## Notable differences from the paper
|
19 |
* Since the Imagen model is not publicly available, we use [Stable Diffusion](https://github.com/CompVis/stable-diffusion) to replace it (implementation from [diffusers](https://github.com/huggingface/diffusers)). Different from Imagen, Stable-Diffusion is a latent diffusion model, which diffuses in a latent space instead of the original image space. Therefore, we need the loss to propagate back from the VAE's encoder part too, which introduces extra time cost in training. Currently, 15000 training steps take about 5 hours to train on a V100.
|
|
|
22 |
|
23 |
|
24 |
## TODOs
|
25 |
+
* The normal evaluation & shading part.
|
26 |
+
* Improve the surface quality.
|
|
|
27 |
|
28 |
# Install
|
29 |
|
|
|
32 |
cd stable-dreamfusion
|
33 |
```
|
34 |
|
35 |
+
**Important**: To download the Stable Diffusion model checkpoint, you should create a file called `TOKEN` under this directory (i.e., `stable-dreamfusion/TOKEN`) and copy your hugging face [access token](https://huggingface.co/docs/hub/security-tokens) into it.
|
36 |
|
37 |
### Install with pip
|
38 |
```bash
|
|
|
56 |
bash scripts/install_ext.sh
|
57 |
|
58 |
# if you want to install manually, here is an example:
|
59 |
+
pip install ./raymarching # install to python path (you still need the raymarching/ folder, since this only installs the built extension.)
|
60 |
```
|
61 |
|
62 |
### Tested environments
|
|
|
84 |
python main_nerf.py --text "a hamburger" --workspace trial_clip -O --test --gui --guidance clip
|
85 |
```
|
86 |
|
87 |
+
# Code organization
|
88 |
+
|
89 |
+
* The key SDS loss is located at `./nerf/sd.py > StableDiffusion > train_step`:
|
90 |
+
```python
|
91 |
+
# 1. we need to interpolate the NeRF rendering to 512x512, to feed it to SD's VAE.
|
92 |
+
pred_rgb_512 = F.interpolate(pred_rgb, (512, 512), mode='bilinear', align_corners=False)
|
93 |
+
# 2. image (512x512) --- VAE --> latents (64x64), this is SD's difference from Imagen.
|
94 |
+
latents = self.encode_imgs(pred_rgb_512)
|
95 |
+
... # timestep sampling, noise adding and UNet noise predicting
|
96 |
+
# 3. the SDS loss, since UNet part is ignored and cannot simply audodiff, we manually set the grad for latents.
|
97 |
+
w = (1 - self.scheduler.alphas_cumprod[t]).to(self.device)
|
98 |
+
grad = w * (noise_pred - noise)
|
99 |
+
latents.backward(gradient=grad, retain_graph=True)
|
100 |
+
```
|
101 |
+
* Other regularizations are in `./nerf/utils.py > Trainer > train_step`.
|
102 |
+
* NeRF Rendering core function: `./nerf/renderer.py > NeRFRenderer > run_cuda`.
|
103 |
+
|
104 |
# Acknowledgement
|
105 |
|
106 |
* The amazing original work: [_DreamFusion: Text-to-3D using 2D Diffusion_](https://dreamfusion3d.github.io/).
|