thuzhaowang commited on
Commit
600036d
1 Parent(s): 34205ea

Upload 7 files

Browse files

upload checkpoints

Files changed (7) hide show
  1. README.md +98 -3
  2. basket.pt +3 -0
  3. chair.pt +3 -0
  4. dandelion.pt +3 -0
  5. flower.pt +3 -0
  6. table.pt +3 -0
  7. vase.pt +3 -0
README.md CHANGED
@@ -1,3 +1,98 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ # DI-PCG: Diffusion-based Efficient Inverse Procedural Content Generation for High-quality 3D Asset Creation
4
+
5
+ <a href="https://thuzhaowang.github.io/projects/DI-PCG"><img src="https://img.shields.io/static/v1?label=Project%20Page&message=Github&color=blue&logo=github-pages"></a>&ensp;<a href=""><img src="https://img.shields.io/badge/ArXiv-2404.07191-brightgreen"></a>&ensp;<a href="https://huggingface.co/TencentARC/DI-PCG"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Model_Card-Huggingface-orange"></a>&ensp;<a href="https://huggingface.co/spaces/TencentARC/DI-PCG"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Gradio%20Demo-Huggingface-orange"></a><br>
6
+
7
+ **[Wang Zhao<sup>1</sup>](https://thuzhaowang.github.io), [Yan-Pei Cao<sup>2</sup>](https://yanpei.me/), [Jiale Xu<sup>1</sup>](https://bluestyle97.github.io/), [Yuejiang Dong<sup>1,3</sup>](https://scholar.google.com.hk/citations?user=0i7bPj8AAAAJ&hl=zh-CN), [Ying Shan<sup>1</sup>](https://scholar.google.com/citations?user=4oXBp9UAAAAJ&hl=en)**
8
+
9
+ <sup>1</sup>ARC Lab, Tencent PCG &ensp;&ensp;<sup>2</sup>VAST &ensp;&ensp;<sup>3</sup>Tsinghua University
10
+
11
+
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ ## 🚩 Overview
18
+ This repository contains code release for our technical report "DI-PCG: Diffusion-based Efficient Inverse Procedural Content Generation for High-quality 3D Asset Creation".
19
+
20
+ <p align="center">
21
+ <img src="misc/teaser.png" >
22
+ </p>
23
+
24
+
25
+ ## ⚙️ Installation
26
+ First clone this repository with [Infinigen](https://github.com/princeton-vl/infinigen) as the submodule:
27
+ ```
28
+ git clone -r https://github.com/TencentARC/DI-PCG.git
29
+ cd DI-PCG
30
+ git submodule update --init --recursive
31
+ ```
32
+ We recommend using anaconda to install the dependencies:
33
+ ```
34
+ conda create -n di-pcg python=3.10.14
35
+ conda activate di-pcg
36
+ conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=11.8 -c pytorch -c nvidia
37
+ pip install -r requirements.txt
38
+ ```
39
+
40
+ ## 🚀 Usage
41
+ For a quick start, try the huggingface gradio demo [here](https://huggingface.co/spaces/TencentARC/DI-PCG).
42
+
43
+ ### Download models
44
+ We provide the pretrained diffusion models for chair, vase, table, basket, flower and dandelion. You can download them from [model card]() and put them in `./pretrained_models/`.
45
+
46
+ Alternatively, the inference script will automatically download the pretrained models for you.
47
+
48
+ ### Local gradio demo
49
+ To run the gradio demo locally, run:
50
+ ```
51
+ python app.py
52
+ ```
53
+
54
+ ### Inference
55
+ To run the inference demo, simply use:
56
+ ```
57
+ python ./scripts/sample_diffusion.py --config ./configs/demo/chair_demo.yaml
58
+ ```
59
+ This script processes all the chair images in the `./examples/chair` folder and saves the generated 3D models and their rendered images in `./logs`.
60
+
61
+ To generate other categories, use the corresponding YAML config file such as `vase_demo.yaml`. Currently we supprt `chair`, `table`, `vase`, `basket`, `flower` and `dandelion` generators developped by [Infinigen](https://github.com/princeton-vl/infinigen).
62
+ ```
63
+ python ./scripts/sample_diffusion.py --config ./configs/demo/vase_demo.yaml
64
+ ```
65
+
66
+ ### Training
67
+ We train a diffusion model for each procedural generator. The training data is generated by randomly sampling the PCG and render multi-view images. To prepare the training data, run:
68
+ ```
69
+ python ./scripts/prepare_data.py --generator ChairFactory --save_root /path/to/save/training/data
70
+ ```
71
+ Replace `ChairFactory` with other category options as detailed in the `./scripts/prepare_data.py` file. This script also conducts offline augmentation and saves the extracted DINOv2 features for each image, which may consume a lot of disk storage. You can adjust the number of the generated data and the render configurations accordingly.
72
+
73
+ After generating the training data, start the training by:
74
+ ```
75
+ python ./scripts/train_diffusion.py --config ./configs/train/chair_train.yaml
76
+ ```
77
+
78
+ ### Use your own PCG
79
+ DI-PCG is general for any procedural generator. To train a diffusion model for your PCG, you need to implement the `get_params_dict`, `update_params`, `spawn_assets`, `finalize_assets` functions and place your PCG in `./core/assets/`. Also change the `num_params` in your training YAML config file.
80
+
81
+ If you have any question, feel free to open an issue or contact us.
82
+
83
+ ## :books: Citation
84
+
85
+ If you find our work useful for your research or applications, please cite using this BibTeX:
86
+
87
+ ```BibTeX
88
+ @article{zhao2024dipcg,
89
+ title={DI-PCG: Diffusion-based Efficient Inverse Procedural Content Generation for High-quality 3D Asset Creation},
90
+ author={Zhao, Wang and Cao, Yanpei and Xu, Jiale and Dong, Yuejiang and Shan, Ying},
91
+ journal={arXiv preprint },
92
+ year={2024}
93
+ }
94
+ ```
95
+
96
+ ## 🤗 Acknowledgements
97
+
98
+ DI-PCG is built on top of some awesome open-source projects: [Infinigen](https://github.com/princeton-vl/infinigen), [Fast-DiT](https://github.com/chuanyangjin/fast-DiT). We sincerely thank them all.
basket.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6b583ff2eac05c38a879182fd50b08cdcf40cf60f2e16f4f967f76550c49900
3
+ size 122190864
chair.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb0459af69b78ec7262510a204eb80e848e06ba259e0669548f059c43c101c8e
3
+ size 122243152
dandelion.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f9f7050580c8265671afef0ede6c14fbc514abf7f9566c4047f9ba6bb2d4785
3
+ size 122192464
flower.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f7d27d0844ea52f668ea86fd2bd958764a51b934383bcdc85bcae19eed556d6
3
+ size 122183248
table.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:938c9e1f2643584fe61d42aca77c86d10e95ee09d2f54ed798c2920349ce528e
3
+ size 122198608
vase.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02ef09f8c3113ea0371e47d5ea87c5c66442aeb2208447e70a567bc93b2510cc
3
+ size 122187856