IT3D: Improved Text-to-3D Generation with Explicit View Synthesis (AAAI 2024).
Yiwen Chen, Chi Zhang, Xiaofeng Yang, Zhongang Cai, Gang Yu, Lei Yang, Guosheng Lin
Arxiv
Recent strides in Text-to-3D techniques have been propelled by distilling knowledge from powerful large text-to-image diffusion models (LDMs). Nonetheless, existing Text-to-3D approaches often grapple with challenges such as over-saturation, inadequate detailing, and unrealistic outputs. This study presents a novel strategy that leverages explicitly synthesized multi-view images to address these issues. Our approach involves the utilization of image-to-image pipelines, empowered by LDMs, to generate posed high-quality images based on the renderings of coarse 3D models. Although the generated images mostly alleviate the aforementioned issues, challenges such as view inconsistency and significant content variance persist due to the inherent generative nature of large diffusion models, posing extensive difficulties in leveraging these images effectively. To overcome this hurdle, we advocate integrating a discriminator alongside a novel Diffusion-GAN dual training strategy to guide the training of 3D models. For the incorporated discriminator, the synthesized multi-view images are considered real data, while the renderings of the optimized 3D models function as fake data. We conduct a comprehensive set of experiments that demonstrate the effectiveness of our method over baseline approaches.
git clone https://github.com/buaacyw/IT3D-text-to-3D.git
cd IT3D-text-to-3D
conda create -n it3d python==3.8
conda activate it3d
pip install -r requirements.txt
pip install ./raymarching
pip install ./shencoder
pip install ./freqencoder
pip install ./gridencoder
You need to register a wandb account if you don't have one.
wandb login
For image-to-image pipeline, We have implemented Stadiffusion Image2Image and ControlNetv1.1.
In our experiment, Controlnet always provides better results. If you want to use Controlnet as image-to-image pipeline, you need to download models from here following instructions from ControlNetv1.1.
For example, if you want to use Controlnet conditioned on softedge, you need to download control_v11p_sd15_softedge.yaml
and control_v11p_sd15_softedge.pth
and put them in the folder ctn_models
.
Additionally, You need to download Stable Diffusion 1.5 model v1-5-pruned.ckpt
and put it in the folder ctn_models
.
All our demos (coarse models and fine models) are trained in 512 resolution. In 512 resolution, it takes around 30G for training a coarse model (vanilla Stable Dreamfusion) and 35G for refining it with IT3D. You may lower the memory consumption by:
--h
and --w
. While this will significantly reduce memory usage, it will also lead to a substantial decrease in performance. It takes about 10G for IT3D in 64 resolution.--nerf l1
. Our default setting is --nerf l2
.--max_steps
. Our default setting is --max_steps 384
--ctn_sample_batch_size
.--text
and --seed
. Sadly, training a coarse model free from the Janus problem often requires multiple attempts.--latent_iter_ratio 0.1
.--g_loss_weight
. You need to lower --g_loss_weight
when the generated dataset is too various. You may enlarge --g_loss_weight
for high quality dataset.--g_loss_decay_begin_step
and --g_loss_decay_step
. In our default setting, we tune the GAN for 7500 steps and then discard it.We release our coarse model checkpoints.
Unzip into folder ckpts
. All these checkpoints are trained in our default coarse model setting.
On our A6000, it takes 6 minutes to generate a dataset of 640 images using SD-I2I, and 25 minutes using Controlnet, respectively.
## Refine a coarse NeRF
# --no_cam_D: camera free discriminator, camera pose won't be input to discriminator
# --g_loss_decay_begin_step: when to decay the weight of discrimination loss
# --real_save_path: path to generated dataset
# Jasmine
python main.py -O --text "a bunch of white jasmine" --workspace jas_ctn --ckpt ckpts/jas_df_ep0200.pth --no_cam_D --gan --ctn --g_loss_decay_begin_step 25000 --real_save_path generated_dataset/jas_ctn
# Use stable diffusion img2img pipeline instead of Controlnet
python main.py -O --text "a bunch of white jasmine" --workspace jas_sd --ckpt ckpts/jas_df_ep0200.pth --no_cam_D --gan --g_loss_decay_begin_step 25000 --real_save_path generated_dataset/jas_sd
# Iron Man
python main.py -O --text "a 3D model of an iron man, highly detailed, full body" --workspace iron_ctn --ckpt ckpts/iron_man_df_ep0400.pth --no_cam_D --gan --ctn --g_loss_decay_begin_step 45000 --real_save_path generated_dataset/iron_ctn
# Darth Vader
python main.py -O --text "Full-body 3D model of Darth Vader, highly detailed" --workspace darth_ctn --ckpt ckpts/darth_df_ep0200.pth --no_cam_D --gan --ctn --g_loss_decay_begin_step 25000 --real_save_path generated_dataset/darth_ctn
# Hulk
python main.py -O --text "3D model of hulk, highly detailed" --workspace hulk_ctn --ckpt ckpts/hulk_df_ep0200.pth --no_cam_D --gan --ctn --g_loss_decay_begin_step 25000 --real_save_path generated_dataset/hulk_ctn
# Ablation Experiment in Paper
# Note: our default setting is sds loss + decayed gan loss. gan loss weight will be decayed to zero after 7500 steps (depending on g_loss_decay_begin_step)
# only l2 loss
python main.py -O --text "3D model of hulk, highly detailed" --workspace hulk_ctn_l2 --ckpt ckpts/hulk_df_ep0200.pth --no_cam_D --gan --ctn --l2_weight 100.0 --l2_decay_begin_step 25000 --l2_decay_step 2500 --l2_weight_end 0.0 --sds_weight_end 0.0 --g_loss_decay_begin_step 0 --real_save_path generated_dataset/hulk_ctn
# l2 loss + sds loss
python main.py -O --text "3D model of hulk, highly detailed" --workspace hulk_ctn_l2_sds --ckpt ckpts/hulk_df_ep0200.pth --no_cam_D --gan --ctn --l2_weight 100.0 --l2_decay_begin_step 25000 --l2_decay_step 2500 --l2_weight_end 0.0 --g_loss_decay_begin_step 0 --real_save_path generated_dataset/hulk_ctn
# only GAN
python main.py -O --text "3D model of hulk, highly detailed" --workspace hulk_ctn_only_gan --ckpt ckpts/hulk_df_ep0200.pth --no_cam_D --gan --ctn --sds_weight_end 0.0 --real_save_path generated_dataset/hulk_ctn
# Edit to red Hulk, change --text
python main.py -O --text "a red hulk, red skin, highly detailed" --workspace hulk_red_ctn --ckpt ckpts/hulk_df_ep0200.pth --no_cam_D --gan --ctn --g_loss_decay_begin_step 25000 --real_save_path generated_dataset/hulk_ctn
## Generate Dataset and DMTET Mesh
# generate dataset
python main.py -O --text "a bunch of blue rose, highly detailed" --workspace rose_blue_ctn --ckpt ckpts/rose_df_ep0200.pth --gan --ctn --no_cam_D --iters 0 --real_save_path generated_dataset/rose_blue_ctn
# DMTET Mesh
python main.py -O --text "a bunch of blue rose, highly detailed" --workspace rose_blue_ctn_dm --gan --ctn --no_cam_D --g_loss_decay_begin_step 5000 --g_loss_decay_step 5000 --init_with ckpts/rose_df_ep0200.pth --dmtet --init_color --real_save_path generated_dataset/rose_blue_ctn
## Train your own coarse NeRF
python main.py -O --text "a bunch of white jasmine" --workspace jas
# Refine it
python main.py -O --text "a bunch of white jasmine" --workspace jas_ctn --ckpt jas/checkpoints/df_ep0200.pth --no_cam_D --gan --ctn --g_loss_decay_begin_step 25000 --real_save_path generated_dataset/jas_ctn
Possible hyperparameters you need to change:
Our code is based on these wonderful repos:
Stable-Dreamfusion
@misc{stable-dreamfusion,
Author = {Jiaxiang Tang},
Year = {2022},
Note = {https://github.com/ashawkey/stable-dreamfusion},
Title = {Stable-dreamfusion: Text-to-3D with Stable-diffusion}
}
EG3D
@inproceedings{Chan2022,
author = {Eric R. Chan and Connor Z. Lin and Matthew A. Chan and Koki Nagano and Boxiao Pan and Shalini De Mello and Orazio Gallo and Leonidas Guibas and Jonathan Tremblay and Sameh Khamis and Tero Karras and Gordon Wetzstein},
title = {Efficient Geometry-aware {3D} Generative Adversarial Networks},
booktitle = {CVPR},
year = {2022}
}
Controlnet
@misc{zhang2023adding,
title={Adding Conditional Control to Text-to-Image Diffusion Models},
author={Lvmin Zhang and Maneesh Agrawala},
year={2023},
eprint={2302.05543},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
If you find this work useful, a citation will be appreciated via:
@misc{chen2023it3d,
title={IT3D: Improved Text-to-3D Generation with Explicit View Synthesis},
author={Yiwen Chen and Chi Zhang and Xiaofeng Yang and Zhongang Cai and Gang Yu and Lei Yang and Guosheng Lin},
year={2023},
eprint={2308.11473},
archivePrefix={arXiv},
primaryClass={cs.CV}
}