Wuvin commited on
Commit
5a3e910
1 Parent(s): 37aeb5b

rename files

Browse files
.ipynb_checkpoints/README-checkpoint.md DELETED
@@ -1,68 +0,0 @@
1
- **中文版本 [中文](README_zh.md)**
2
-
3
- # Unique3D
4
- High-Quality and Efficient 3D Mesh Generation from a Single Image
5
-
6
- ## [Paper]() | [Project page](https://wukailu.github.io/Unique3D/) | [Huggingface Demo]() | [Online Demo](https://www.aiuni.ai/)
7
-
8
- ![](assets/fig_teaser.png)
9
-
10
- High-fidelity and diverse textured meshes generated by Unique3D from single-view wild images in 30 seconds.
11
-
12
- ## More features
13
-
14
- The repo is still being under construction, thanks for your patience.
15
- - [x] Local gradio demo.
16
- - [ ] Detailed tutorial.
17
- - [ ] Huggingface demo.
18
- - [ ] Detailed local demo.
19
- - [ ] Comfyui support.
20
- - [ ] Windows support.
21
- - [ ] Docker support.
22
- - [ ] More stable reconstruction with normal.
23
- - [ ] Training code release.
24
-
25
- ## Preparation for inference
26
-
27
- ### Linux System Setup.
28
- ```angular2html
29
- conda create -n unique3d
30
- conda activate unique3d
31
- pip install -r requirements.txt
32
- ```
33
-
34
- ### Interactive inference: run your local gradio demo.
35
-
36
- 1. Download the [ckpt.zip](), and extract it to `ckpt/*`.
37
- ```
38
- Unique3D
39
- ├──ckpt
40
- ├── controlnet-tile/
41
- ├── image2normal/
42
- ├── img2mvimg/
43
- ├── realesrgan-x4.onnx
44
- └── v1-inference.yaml
45
- ```
46
-
47
- 2. Run the interactive inference locally.
48
- ```bash
49
- python app/gradio_local.py --port 7860
50
- ```
51
-
52
- ## Tips to get better results
53
-
54
- 1. Unique3D is sensitive to the facing direction of input images. Due to the distribution of the training data, orthographic front-facing images with a rest pose always lead to good reconstructions.
55
- 2. Images with occlusions will cause worse reconstructions, since four views cannot cover the complete object. Images with fewer occlusions lead to better results.
56
- 3. Pass an image with as high a resolution as possible to the input when resolution is a factor.
57
-
58
- ## Acknowledgement
59
-
60
- We have intensively borrowed code from the following repositories. Many thanks to the authors for sharing their code.
61
- - [Stable Diffusion](https://github.com/CompVis/stable-diffusion)
62
- - [Wonder3d](https://github.com/xxlong0/Wonder3D)
63
- - [Zero123Plus](https://github.com/SUDO-AI-3D/zero123plus)
64
- - [Continues Remeshing](https://github.com/Profactor/continuous-remeshing)
65
- - [Depth from Normals](https://github.com/YertleTurtleGit/depth-from-normals)
66
-
67
- ## Collaborations
68
- Our mission is to create a 4D generative model with 3D concepts. This is just our first step, and the road ahead is still long, but we are confident. We warmly invite you to join the discussion and explore potential collaborations in any capacity. <span style="color:red">**If you're interested in connecting or partnering with us, please don't hesitate to reach out via email (wkl22@mails.tsinghua.edu.cn)**</span>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md DELETED
@@ -1,13 +0,0 @@
1
- ---
2
- title: Unique3D
3
- emoji: 🐨
4
- colorFrom: pink
5
- colorTo: gray
6
- sdk: gradio
7
- sdk_version: 4.32.1
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README_zh.md DELETED
@@ -1,56 +0,0 @@
1
- **其他语言版本 [English](README.md)**
2
-
3
- # Unique3D
4
- High-Quality and Efficient 3D Mesh Generation from a Single Image
5
-
6
- ## [论文]() | [项目页面](https://wukailu.github.io/Unique3D/) | [Huggingface Demo]() | [在线演示](https://www.aiuni.ai/)
7
-
8
- ![](assets/fig_teaser.png)
9
-
10
- Unique3D从单视图图像生成高保真度和多样化纹理的网格,在4090上大约需要30秒。
11
-
12
- ### 推理准备
13
-
14
- #### Linux系统设置
15
- ```angular2html
16
- conda create -n unique3d
17
- conda activate unique3d
18
- pip install -r requirements.txt
19
- ```
20
-
21
- #### 交互式推理:运行您的本地gradio演示
22
-
23
- 1. 下载[ckpt.zip](),并将其解压到`ckpt/*`。
24
- ```
25
- Unique3D
26
- ├──ckpt
27
- ├── controlnet-tile/
28
- ├── image2normal/
29
- ├── img2mvimg/
30
- ├── realesrgan-x4.onnx
31
- └── v1-inference.yaml
32
- ```
33
-
34
- 2. 在本地运行交互式推理。
35
- ```bash
36
- python app/gradio_local.py --port 7860
37
- ```
38
-
39
- ## 获取更好结果的提示
40
-
41
- 1. Unique3D对输入图像的朝向非常敏感。由于训练数据的分布,**正交正视图像**通常总是能带来良好的重建。对于人物而言,最好是 A-pose 或者 T-pose,因为目前训练数据很少含有其他类型姿态。
42
- 2. 有遮挡的图像会导致更差的重建,因为4个视图无法覆盖完整的对象。遮挡较少的图像会带来更好的结果。
43
- 3. 尽可能将高分辨率的图像用作输入。
44
-
45
- ## 致谢
46
-
47
- 我们借用了以下代码库的代码。非常感谢作者们分享他们的代码。
48
- - [Stable Diffusion](https://github.com/CompVis/stable-diffusion)
49
- - [Wonder3d](https://github.com/xxlong0/Wonder3D)
50
- - [Zero123Plus](https://github.com/SUDO-AI-3D/zero123plus)
51
- - [Continues Remeshing](https://github.com/Profactor/continuous-remeshing)
52
- - [Depth from Normals](https://github.com/YertleTurtleGit/depth-from-normals)
53
-
54
- ## 合作
55
-
56
- 我们使命是创建一个具有3D概念的4D生成模型。这只是我们的第一步,前方的道路仍然很长,但我们有信心。我们热情邀请您加入讨论,并探索任何形式的潜在合作。<span style="color:red">**如果您有兴趣联系或与我们合作,欢迎通过电子邮件(wkl22@mails.tsinghua.edu.cn)与我们联系**</span>。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gradio_app.py → app.py RENAMED
@@ -9,8 +9,8 @@ if __name__ == "__main__":
9
 
10
  import fire
11
  import gradio as gr
12
- from app.gradio_3dgen import create_ui as create_3d_ui
13
- from app.all_models import model_zoo
14
 
15
 
16
  _TITLE = '''Unique3D: High-Quality and Efficient 3D Mesh Generation from a Single Image'''
 
9
 
10
  import fire
11
  import gradio as gr
12
+ from gradio_app.gradio_3dgen import create_ui as create_3d_ui
13
+ from gradio_app.all_models import model_zoo
14
 
15
 
16
  _TITLE = '''Unique3D: High-Quality and Efficient 3D Mesh Generation from a Single Image'''
{app → gradio_app}/__init__.py RENAMED
File without changes
{app → gradio_app}/all_models.py RENAMED
File without changes
{app → gradio_app}/custom_models/image2image-objaverseF-rgb2normal.yaml RENAMED
File without changes
{app → gradio_app}/custom_models/image2mvimage-objaverseFrot-wonder3d.yaml RENAMED
File without changes
{app → gradio_app}/custom_models/mvimg_prediction.py RENAMED
@@ -4,8 +4,8 @@ import gradio as gr
4
  from PIL import Image
5
  import numpy as np
6
  from rembg import remove
7
- from app.utils import change_rgba_bg, rgba_to_rgb
8
- from app.custom_models.utils import load_pipeline
9
  from scripts.all_typing import *
10
  from scripts.utils import session, simple_preprocess
11
 
 
4
  from PIL import Image
5
  import numpy as np
6
  from rembg import remove
7
+ from gradio_app.utils import change_rgba_bg, rgba_to_rgb
8
+ from gradio_app.custom_models.utils import load_pipeline
9
  from scripts.all_typing import *
10
  from scripts.utils import session, simple_preprocess
11
 
{app → gradio_app}/custom_models/normal_prediction.py RENAMED
@@ -1,7 +1,7 @@
1
  import sys
2
  from PIL import Image
3
- from app.utils import rgba_to_rgb, simple_remove
4
- from app.custom_models.utils import load_pipeline
5
  from scripts.utils import rotate_normals_torch
6
  from scripts.all_typing import *
7
 
 
1
  import sys
2
  from PIL import Image
3
+ from gradio_app.utils import rgba_to_rgb, simple_remove
4
+ from gradio_app.custom_models.utils import load_pipeline
5
  from scripts.utils import rotate_normals_torch
6
  from scripts.all_typing import *
7
 
{app → gradio_app}/custom_models/utils.py RENAMED
@@ -1,7 +1,7 @@
1
  import torch
2
  from typing import List
3
  from dataclasses import dataclass
4
- from app.utils import rgba_to_rgb
5
  from custum_3d_diffusion.trainings.config_classes import ExprimentConfig, TrainerSubConfig
6
  from custum_3d_diffusion import modules
7
  from custum_3d_diffusion.custum_modules.unifield_processor import AttnConfig, ConfigurableUNet2DConditionModel
@@ -24,7 +24,7 @@ def init_trainers(cfg_path: str, weight_dtype: torch.dtype, extras: dict):
24
  trainers: List[BasicTrainer] = [modules.find(trainer.trainer_type)(accelerator, None, configurable_unet, trainer.trainer, weight_dtype, i) for i, trainer in enumerate(trainer_cfgs)]
25
  return trainers, configurable_unet
26
 
27
- from app.utils import make_image_grid, split_image
28
  def process_image(function, img, guidance_scale=2., merged_image=False, remove_bg=True):
29
  from rembg import remove
30
  if remove_bg:
 
1
  import torch
2
  from typing import List
3
  from dataclasses import dataclass
4
+ from gradio_app.utils import rgba_to_rgb
5
  from custum_3d_diffusion.trainings.config_classes import ExprimentConfig, TrainerSubConfig
6
  from custum_3d_diffusion import modules
7
  from custum_3d_diffusion.custum_modules.unifield_processor import AttnConfig, ConfigurableUNet2DConditionModel
 
24
  trainers: List[BasicTrainer] = [modules.find(trainer.trainer_type)(accelerator, None, configurable_unet, trainer.trainer, weight_dtype, i) for i, trainer in enumerate(trainer_cfgs)]
25
  return trainers, configurable_unet
26
 
27
+ from gradio_app.utils import make_image_grid, split_image
28
  def process_image(function, img, guidance_scale=2., merged_image=False, remove_bg=True):
29
  from rembg import remove
30
  if remove_bg:
{app → gradio_app}/examples/Groot.png RENAMED
File without changes
{app → gradio_app}/examples/aaa.png RENAMED
File without changes
{app → gradio_app}/examples/abma.png RENAMED
File without changes
{app → gradio_app}/examples/akun.png RENAMED
File without changes
{app → gradio_app}/examples/anya.png RENAMED
File without changes
{app → gradio_app}/examples/bag.png RENAMED
File without changes
{app → gradio_app}/examples/generated_1715761545_frame0.png RENAMED
File without changes
{app → gradio_app}/examples/generated_1715762357_frame0.png RENAMED
File without changes
{app → gradio_app}/examples/generated_1715763329_frame0.png RENAMED
File without changes
{app → gradio_app}/examples/hatsune_miku.png RENAMED
File without changes
{app → gradio_app}/examples/princess-large.png RENAMED
File without changes
{app → gradio_app}/examples/shoe.png RENAMED
File without changes
{app → gradio_app}/gradio_3dgen.py RENAMED
@@ -2,9 +2,9 @@ import os
2
  import gradio as gr
3
  from PIL import Image
4
  from pytorch3d.structures import Meshes
5
- from app.utils import clean_up
6
- from app.custom_models.mvimg_prediction import run_mvprediction
7
- from app.custom_models.normal_prediction import predict_normals
8
  from scripts.refine_lr_to_sr import run_sr_fast
9
  from scripts.utils import save_glb_and_video
10
  from scripts.multiview_inference import geo_reconstruct
 
2
  import gradio as gr
3
  from PIL import Image
4
  from pytorch3d.structures import Meshes
5
+ from gradio_app.utils import clean_up
6
+ from gradio_app.custom_models.mvimg_prediction import run_mvprediction
7
+ from gradio_app.custom_models.normal_prediction import predict_normals
8
  from scripts.refine_lr_to_sr import run_sr_fast
9
  from scripts.utils import save_glb_and_video
10
  from scripts.multiview_inference import geo_reconstruct
{app → gradio_app}/gradio_3dgen_steps.py RENAMED
@@ -1,8 +1,8 @@
1
  import gradio as gr
2
  from PIL import Image
3
 
4
- from app.custom_models.mvimg_prediction import run_mvprediction
5
- from app.utils import make_image_grid, split_image
6
  from scripts.utils import save_glb_and_video
7
 
8
  def concept_to_multiview(preview_img, input_processing, seed, guidance=1.):
@@ -40,7 +40,7 @@ def concept_to_multiview_ui(concurrency_id="wkl"):
40
  )
41
  return output_rgb, output_front
42
 
43
- from app.custom_models.normal_prediction import predict_normals
44
  from scripts.multiview_inference import geo_reconstruct
45
  def multiview_to_mesh_v2(rgb_pil, normal_pil, front_pil, do_refine=False, expansion_weight=0.1, init_type="std"):
46
  rgb_pils = split_image(rgb_pil, rows=2)
 
1
  import gradio as gr
2
  from PIL import Image
3
 
4
+ from gradio_app.custom_models.mvimg_prediction import run_mvprediction
5
+ from gradio_app.utils import make_image_grid, split_image
6
  from scripts.utils import save_glb_and_video
7
 
8
  def concept_to_multiview(preview_img, input_processing, seed, guidance=1.):
 
40
  )
41
  return output_rgb, output_front
42
 
43
+ from gradio_app.custom_models.normal_prediction import predict_normals
44
  from scripts.multiview_inference import geo_reconstruct
45
  def multiview_to_mesh_v2(rgb_pil, normal_pil, front_pil, do_refine=False, expansion_weight=0.1, init_type="std"):
46
  rgb_pils = split_image(rgb_pil, rows=2)
{app → gradio_app}/gradio_local.py RENAMED
@@ -17,9 +17,9 @@ if __name__ == "__main__":
17
  import gradio as gr
18
  import argparse
19
 
20
- from app.gradio_3dgen import create_ui as create_3d_ui
21
  # from app.gradio_3dgen_steps import create_step_ui
22
- from app.all_models import model_zoo
23
 
24
 
25
  _TITLE = '''Unique3D: High-Quality and Efficient 3D Mesh Generation from a Single Image'''
 
17
  import gradio as gr
18
  import argparse
19
 
20
+ from gradio_app.gradio_3dgen import create_ui as create_3d_ui
21
  # from app.gradio_3dgen_steps import create_step_ui
22
+ from gradio_app.all_models import model_zoo
23
 
24
 
25
  _TITLE = '''Unique3D: High-Quality and Efficient 3D Mesh Generation from a Single Image'''
{app → gradio_app}/utils.py RENAMED
File without changes
scripts/multiview_inference.py CHANGED
@@ -4,8 +4,8 @@ from scripts.mesh_init import build_mesh, calc_w_over_h, fix_border_with_pymeshl
4
  from scripts.project_mesh import multiview_color_projection
5
  from scripts.refine_lr_to_sr import run_sr_fast
6
  from scripts.utils import simple_clean_mesh
7
- from app.utils import simple_remove, split_image
8
- from app.custom_models.normal_prediction import predict_normals
9
  from mesh_reconstruction.recon import reconstruct_stage1
10
  from mesh_reconstruction.refine import run_mesh_refine
11
  from scripts.project_mesh import get_cameras_list
@@ -36,9 +36,9 @@ def fast_geo(front_normal: Image.Image, back_normal: Image.Image, side_normal: I
36
  def refine_rgb(rgb_pils, front_pil):
37
  from scripts.refine_lr_to_sr import refine_lr_with_sd
38
  from scripts.utils import NEG_PROMPT
39
- from app.utils import make_image_grid
40
- from app.all_models import model_zoo
41
- from app.utils import rgba_to_rgb
42
  rgb_pil = make_image_grid(rgb_pils, rows=2)
43
  prompt = "4views, multiview"
44
  neg_prompt = NEG_PROMPT
 
4
  from scripts.project_mesh import multiview_color_projection
5
  from scripts.refine_lr_to_sr import run_sr_fast
6
  from scripts.utils import simple_clean_mesh
7
+ from gradio_app.utils import simple_remove, split_image
8
+ from gradio_app.custom_models.normal_prediction import predict_normals
9
  from mesh_reconstruction.recon import reconstruct_stage1
10
  from mesh_reconstruction.refine import run_mesh_refine
11
  from scripts.project_mesh import get_cameras_list
 
36
  def refine_rgb(rgb_pils, front_pil):
37
  from scripts.refine_lr_to_sr import refine_lr_with_sd
38
  from scripts.utils import NEG_PROMPT
39
+ from gradio_app.utils import make_image_grid
40
+ from gradio_app.all_models import model_zoo
41
+ from gradio_app.utils import rgba_to_rgb
42
  rgb_pil = make_image_grid(rgb_pils, rows=2)
43
  prompt = "4views, multiview"
44
  neg_prompt = NEG_PROMPT