Drexubery commited on
Commit
58423c5
1 Parent(s): 29dd4d7
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. __pycache__/viewcrafter.cpython-39.pyc +0 -0
  2. app.py +85 -55
  3. app_old.py +122 -0
  4. configs/__pycache__/infer_config.cpython-39.pyc +0 -0
  5. configs/inference_pvd_1024_local.yaml +113 -0
  6. extern/dust3r/croco/models/__pycache__/blocks.cpython-39.pyc +0 -0
  7. extern/dust3r/croco/models/__pycache__/croco.cpython-39.pyc +0 -0
  8. extern/dust3r/croco/models/__pycache__/dpt_block.cpython-39.pyc +0 -0
  9. extern/dust3r/croco/models/__pycache__/masking.cpython-39.pyc +0 -0
  10. extern/dust3r/croco/models/__pycache__/pos_embed.cpython-39.pyc +0 -0
  11. extern/dust3r/croco/models/curope/__pycache__/__init__.cpython-39.pyc +0 -0
  12. extern/dust3r/croco/models/curope/__pycache__/curope2d.cpython-39.pyc +0 -0
  13. extern/dust3r/dust3r/__pycache__/__init__.cpython-39.pyc +0 -0
  14. extern/dust3r/dust3r/__pycache__/image_pairs.cpython-39.pyc +0 -0
  15. extern/dust3r/dust3r/__pycache__/inference.cpython-39.pyc +0 -0
  16. extern/dust3r/dust3r/__pycache__/model.cpython-39.pyc +0 -0
  17. extern/dust3r/dust3r/__pycache__/optim_factory.cpython-39.pyc +0 -0
  18. extern/dust3r/dust3r/__pycache__/patch_embed.cpython-39.pyc +0 -0
  19. extern/dust3r/dust3r/__pycache__/post_process.cpython-39.pyc +0 -0
  20. extern/dust3r/dust3r/__pycache__/viz.cpython-39.pyc +0 -0
  21. extern/dust3r/dust3r/cloud_opt/__pycache__/__init__.cpython-39.pyc +0 -0
  22. extern/dust3r/dust3r/cloud_opt/__pycache__/base_opt.cpython-39.pyc +0 -0
  23. extern/dust3r/dust3r/cloud_opt/__pycache__/commons.cpython-39.pyc +0 -0
  24. extern/dust3r/dust3r/cloud_opt/__pycache__/init_im_poses.cpython-39.pyc +0 -0
  25. extern/dust3r/dust3r/cloud_opt/__pycache__/optimizer.cpython-39.pyc +0 -0
  26. extern/dust3r/dust3r/cloud_opt/__pycache__/pair_viewer.cpython-39.pyc +0 -0
  27. extern/dust3r/dust3r/heads/__pycache__/__init__.cpython-39.pyc +0 -0
  28. extern/dust3r/dust3r/heads/__pycache__/dpt_head.cpython-39.pyc +0 -0
  29. extern/dust3r/dust3r/heads/__pycache__/linear_head.cpython-39.pyc +0 -0
  30. extern/dust3r/dust3r/heads/__pycache__/postprocess.cpython-39.pyc +0 -0
  31. extern/dust3r/dust3r/utils/__pycache__/__init__.cpython-39.pyc +0 -0
  32. extern/dust3r/dust3r/utils/__pycache__/device.cpython-39.pyc +0 -0
  33. extern/dust3r/dust3r/utils/__pycache__/geometry.cpython-39.pyc +0 -0
  34. extern/dust3r/dust3r/utils/__pycache__/image.cpython-39.pyc +0 -0
  35. extern/dust3r/dust3r/utils/__pycache__/misc.cpython-39.pyc +0 -0
  36. extern/dust3r/dust3r/utils/__pycache__/path_to_croco.cpython-39.pyc +0 -0
  37. lvdm/__pycache__/basics.cpython-39.pyc +0 -0
  38. lvdm/__pycache__/common.cpython-39.pyc +0 -0
  39. lvdm/__pycache__/distributions.cpython-39.pyc +0 -0
  40. lvdm/__pycache__/ema.cpython-39.pyc +0 -0
  41. lvdm/models/__pycache__/autoencoder.cpython-39.pyc +0 -0
  42. lvdm/models/__pycache__/ddpm3d.cpython-39.pyc +0 -0
  43. lvdm/models/__pycache__/utils_diffusion.cpython-39.pyc +0 -0
  44. lvdm/models/samplers/__pycache__/ddim.cpython-39.pyc +0 -0
  45. lvdm/models/samplers/__pycache__/ddim_multiplecond.cpython-39.pyc +0 -0
  46. lvdm/modules/__pycache__/attention.cpython-39.pyc +0 -0
  47. lvdm/modules/encoders/__pycache__/condition.cpython-39.pyc +0 -0
  48. lvdm/modules/encoders/__pycache__/resampler.cpython-39.pyc +0 -0
  49. lvdm/modules/networks/__pycache__/ae_modules.cpython-39.pyc +0 -0
  50. lvdm/modules/networks/__pycache__/openaimodel3d.cpython-39.pyc +0 -0
__pycache__/viewcrafter.cpython-39.pyc CHANGED
Binary files a/__pycache__/viewcrafter.cpython-39.pyc and b/__pycache__/viewcrafter.cpython-39.pyc differ
 
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import os
2
  import torch
3
  import sys
4
- import spaces
5
 
6
 
7
  import gradio as gr
@@ -9,12 +9,20 @@ import random
9
  from configs.infer_config import get_parser
10
  from huggingface_hub import hf_hub_download
11
 
12
- i2v_examples = [
13
- ['test/images/boy.png', 0, 1.0, '0 40', '0 0', '0 0', 50, 123],
14
- ['test/images/car.jpeg', 0, 1.0, '0 -35', '0 0', '0 -0.1', 50, 123],
15
- ['test/images/fruit.jpg', 0, 1.0, '0 -3 -15 -20 -17 -5 0', '0 -2 -5 -10 -8 -5 0 2 5 3 0', '0 0', 50, 123],
16
- ['test/images/room.png', 5, 1.0, '0 3 10 20 17 10 0', '0 -2 -8 -6 0 2 5 3 0', '0 -0.02 -0.09 -0.16 -0.09 0', 50, 123],
17
- ['test/images/castle.png', 0, 1.0, '0 30', '0 -1 -5 -4 0 1 5 4 0', '0 -0.2', 50, 123],
 
 
 
 
 
 
 
 
18
  ]
19
 
20
  max_seed = 2 ** 31
@@ -27,7 +35,7 @@ def download_model():
27
  if not os.path.exists(local_file):
28
  hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/', force_download=True)
29
 
30
- download_model()
31
  parser = get_parser() # infer_config.py
32
  opts = parser.parse_args() # default device: 'cuda:0'
33
  opts.save_dir = './'
@@ -35,7 +43,7 @@ os.makedirs(opts.save_dir,exist_ok=True)
35
  test_tensor = torch.Tensor([0]).cuda()
36
  opts.device = str(test_tensor.device)
37
 
38
- # install pytorch3d
39
  pyt_version_str=torch.__version__.split("+")[0].replace(".", "")
40
  version_str="".join([
41
  f"py3{sys.version_info.minor}_cu",
@@ -50,10 +58,12 @@ print(f'>>> System info: {version_str}')
50
 
51
  from viewcrafter import ViewCrafter
52
 
 
53
  def viewcrafter_demo(opts):
54
  css = """#input_img {max-width: 1024px !important} #output_vid {max-width: 1024px; max-height:576px} #random_button {max-width: 100px !important}"""
55
  image2video = ViewCrafter(opts, gradio = True)
56
- image2video.run_gradio = spaces.GPU(image2video.run_gradio, duration=300)
 
57
  with gr.Blocks(analytics_enabled=False, css=css) as viewcrafter_iface:
58
  gr.Markdown("<div align='center'> <h1> ViewCrafter: Taming Video Diffusion Models for High-fidelity Novel View Synthesis </span> </h1> \
59
  <h2 style='font-weight: 450; font-size: 1rem; margin: 0rem'>\
@@ -65,58 +75,78 @@ def viewcrafter_demo(opts):
65
  <a href='https://scholar.google.com/citations?hl=en&user=4oXBp9UAAAAJ&view_op=list_works&sortby=pubdate/'>Ying Shan</a>\
66
  <a href=''>Yonghong Tian</a>\
67
  </h2> \
68
- <a style='font-size:18px;color: #FF5DB0' href='https://github.com/Drexubery/ViewCrafter/blob/main/docs/render_help.md'> [Guideline] </a>\
69
  <a style='font-size:18px;color: #000000' href=''> [ArXiv] </a>\
70
  <a style='font-size:18px;color: #000000' href='https://drexubery.github.io/ViewCrafter/'> [Project Page] </a>\
71
- <a style='font-size:18px;color: #000000' href='https://github.com/Drexubery/ViewCrafter'> [Github] </a> </div>")
72
-
73
- #######image2video######
74
- with gr.Tab(label="ViewCrafter_25, 'single_view_txt' mode"):
75
- with gr.Column():
76
- with gr.Row():
77
- with gr.Column():
78
- with gr.Row():
79
- i2v_input_image = gr.Image(label="Input Image",elem_id="input_img")
80
- with gr.Row():
81
- i2v_elevation = gr.Slider(minimum=-45, maximum=45, step=1, elem_id="elevation", label="elevation", value=5)
82
- with gr.Row():
83
- i2v_center_scale = gr.Slider(minimum=0.1, maximum=2, step=0.1, elem_id="i2v_center_scale", label="center_scale", value=1)
84
- with gr.Row():
85
- i2v_d_phi = gr.Text(label='d_phi sequence, should start with 0')
86
- with gr.Row():
87
- i2v_d_theta = gr.Text(label='d_theta sequence, should start with 0')
88
- with gr.Row():
89
- i2v_d_r = gr.Text(label='d_r sequence, should start with 0')
90
- with gr.Row():
91
- i2v_steps = gr.Slider(minimum=1, maximum=50, step=1, elem_id="i2v_steps", label="Sampling steps", value=50)
92
- with gr.Row():
93
- i2v_seed = gr.Slider(label='Random Seed', minimum=0, maximum=max_seed, step=1, value=123)
94
- i2v_end_btn = gr.Button("Generate")
95
- # with gr.Tab(label='Result'):
96
- with gr.Column():
97
- with gr.Row():
98
- i2v_traj_video = gr.Video(label="Camera Trajectory",elem_id="traj_vid",autoplay=True,show_share_button=True)
99
- with gr.Row():
100
- i2v_output_video = gr.Video(label="Generated Video",elem_id="output_vid",autoplay=True,show_share_button=True)
101
-
102
- gr.Examples(examples=i2v_examples,
103
- inputs=[i2v_input_image, i2v_elevation, i2v_center_scale, i2v_d_phi, i2v_d_theta, i2v_d_r, i2v_steps, i2v_seed],
104
- outputs=[i2v_traj_video,i2v_output_video],
105
- fn = image2video.run_gradio,
106
- cache_examples='lazy',
107
- )
108
-
109
- # image2video.run_gradio(i2v_input_image='test/images/boy.png', i2v_elevation='10', i2v_d_phi='0 40', i2v_d_theta='0 0', i2v_d_r='0 0', i2v_center_scale=1, i2v_steps=50, i2v_seed=123)
110
- i2v_end_btn.click(inputs=[i2v_input_image, i2v_elevation, i2v_center_scale, i2v_d_phi, i2v_d_theta, i2v_d_r, i2v_steps, i2v_seed],
111
- outputs=[i2v_traj_video,i2v_output_video],
112
- fn = image2video.run_gradio
113
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
  return viewcrafter_iface
116
 
117
 
118
  viewcrafter_iface = viewcrafter_demo(opts)
119
  viewcrafter_iface.queue(max_size=10)
120
- viewcrafter_iface.launch()
121
- # viewcrafter_iface.launch(server_name='127.0.0.1', server_port=80, max_threads=1,debug=False)
122
 
 
1
  import os
2
  import torch
3
  import sys
4
+ import spaces #fixme
5
 
6
 
7
  import gradio as gr
 
9
  from configs.infer_config import get_parser
10
  from huggingface_hub import hf_hub_download
11
 
12
+ traj_examples = [
13
+ ['0 40', '0 0', '0 0'],
14
+ ['0 -35', '0 0', '0 -0.1'],
15
+ ['0 -3 -15 -20 -17 -5 0', '0 -2 -5 -10 -8 -5 0 2 5 3 0', '0 0'],
16
+ ['0 3 10 20 17 10 0', '0 -2 -8 -6 0 2 5 3 0', '0 -0.02 -0.09 -0.16 -0.09 0'],
17
+ ['0 30', '0 -1 -5 -4 0 1 5 4 0', '0 -0.2'],
18
+ ]
19
+
20
+ img_examples = [
21
+ ['test/images/boy.png',0,1],
22
+ ['test/images/car.jpeg',5,1],
23
+ ['test/images/fruit.jpg',5,1],
24
+ ['test/images/room.png',10,1],
25
+ ['test/images/castle.png',-4,1],
26
  ]
27
 
28
  max_seed = 2 ** 31
 
35
  if not os.path.exists(local_file):
36
  hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/', force_download=True)
37
 
38
+ download_model() #fixme
39
  parser = get_parser() # infer_config.py
40
  opts = parser.parse_args() # default device: 'cuda:0'
41
  opts.save_dir = './'
 
43
  test_tensor = torch.Tensor([0]).cuda()
44
  opts.device = str(test_tensor.device)
45
 
46
+ # install pytorch3d # fixme
47
  pyt_version_str=torch.__version__.split("+")[0].replace(".", "")
48
  version_str="".join([
49
  f"py3{sys.version_info.minor}_cu",
 
58
 
59
  from viewcrafter import ViewCrafter
60
 
61
+
62
  def viewcrafter_demo(opts):
63
  css = """#input_img {max-width: 1024px !important} #output_vid {max-width: 1024px; max-height:576px} #random_button {max-width: 100px !important}"""
64
  image2video = ViewCrafter(opts, gradio = True)
65
+ image2video.run_traj = spaces.GPU(image2video.run_traj, duration=50) # fixme
66
+ image2video.run_gen = spaces.GPU(image2video.run_gen, duration=250) # fixme
67
  with gr.Blocks(analytics_enabled=False, css=css) as viewcrafter_iface:
68
  gr.Markdown("<div align='center'> <h1> ViewCrafter: Taming Video Diffusion Models for High-fidelity Novel View Synthesis </span> </h1> \
69
  <h2 style='font-weight: 450; font-size: 1rem; margin: 0rem'>\
 
75
  <a href='https://scholar.google.com/citations?hl=en&user=4oXBp9UAAAAJ&view_op=list_works&sortby=pubdate/'>Ying Shan</a>\
76
  <a href=''>Yonghong Tian</a>\
77
  </h2> \
 
78
  <a style='font-size:18px;color: #000000' href=''> [ArXiv] </a>\
79
  <a style='font-size:18px;color: #000000' href='https://drexubery.github.io/ViewCrafter/'> [Project Page] </a>\
80
+ <a style='font-size:18px;color: #FF5DB0' href='https://github.com/Drexubery/ViewCrafter'> [Github] </a>\
81
+ <a style='font-size:18px;color: #000000' href='https://www.youtube.com/watch?v=WGIEmu9eXmU'> [Video] </a> </div>")
82
+
83
+
84
+ with gr.Column():
85
+ # step 0: tutorial
86
+ gr.Markdown("## Step 0: Read tutorial", show_label=False)
87
+ gr.Markdown("<div align='left' style='font-size:18px;color: #000000'>Please refer to the tutorial <a href='https://github.com/TencentARC/MotionCtrl/blob/svd/doc/tutorial.md' target='_blank'>here</a> for best practice, which includes the cameara system defination and the renderer parameters.</div>")
88
+
89
+ # step 2: input an image
90
+ gr.Markdown("---\n## Step 1: Input an Image, selet an elevation angle and a center_scale factor", show_label=False, visible=True)
91
+ gr.Markdown("<div align='left' style='font-size:18px;color: #000000'>1. Estimate an elevation angle that represents the angle at which the image was taken; a value bigger than 0 indicates a top-down view, and it doesn't need to be precise. <br>2. The origin of the world coordinate system is by default defined at the point cloud corresponding to the center pixel of the input image. You can adjust the position of the origin by modifying center_scale; a value smaller than 1 brings the origin closer to you.</div>")
92
+ with gr.Row(equal_height=True):
93
+ with gr.Column(scale=2):
94
+ with gr.Row():
95
+ i2v_input_image = gr.Image(label="Input Image",elem_id="input_img")
96
+ with gr.Row():
97
+ i2v_elevation = gr.Slider(minimum=-45, maximum=45, step=1, elem_id="elevation", label="elevation", value=5)
98
+ i2v_center_scale = gr.Slider(minimum=0.1, maximum=2, step=0.1, elem_id="i2v_center_scale", label="center_scale", value=1)
99
+ gr.Examples(examples=img_examples,
100
+ inputs=[i2v_input_image,i2v_elevation,i2v_center_scale],
101
+ examples_per_page=6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  )
103
+ # step 2 - camera trajectory generation
104
+ gr.Markdown("---\n## Step 2: Input camera trajectory", show_label=False, visible=True)
105
+ gr.Markdown("<div align='left' style='font-size:18px;color: #000000'> Input a d_phi sequence, a d_theta sequence, and a d_r sequence to generate a camera trajectory. In the sequences, a positive d_phi moves the camera to the right, a negative d_theta moves the camera up, and a negative d_r moves the camera forward. Ensure that each sequence starts with 0 and contains at least two elements (a start and an end). </div>")
106
+ with gr.Row():
107
+ with gr.Column():
108
+ # camera_mode = gr.Radio(choices=CAMERA_MOTION_MODE, value=CAMERA_MOTION_MODE[0], label="Camera Motion Control Mode", interactive=True, visible=False)
109
+ i2v_d_phi = gr.Text(label='d_phi sequence')
110
+ i2v_d_theta = gr.Text(label='d_theta sequence')
111
+ i2v_d_r = gr.Text(label='d_r sequence')
112
+ i2v_start_btn = gr.Button("Generate trajectory")
113
+ # camera_info = gr.Button(value="Proceed", visible=False)
114
+ with gr.Column():
115
+ i2v_traj_video = gr.Video(label="Camera Trajectory",elem_id="traj_vid",autoplay=True,show_share_button=True)
116
+
117
+ gr.Examples(examples=traj_examples,
118
+ inputs=[i2v_d_phi, i2v_d_theta, i2v_d_r],
119
+ )
120
+
121
+ # step 3 - Generate video
122
+ gr.Markdown("---\n## Step 3: Generate video", show_label=False, visible=True)
123
+ gr.Markdown("<div align='left' style='font-size:18px;color: #000000'> You can reduce the sampling steps for faster inference; try different random seed if the result is not satisfying. </div>")
124
+ with gr.Row():
125
+ with gr.Column():
126
+ i2v_steps = gr.Slider(minimum=1, maximum=50, step=1, elem_id="i2v_steps", label="Sampling steps", value=50)
127
+ i2v_seed = gr.Slider(label='Random seed', minimum=0, maximum=max_seed, step=1, value=123)
128
+ i2v_end_btn = gr.Button("Generate video")
129
+ # with gr.Tab(label='Result'):
130
+ with gr.Column():
131
+ i2v_output_video = gr.Video(label="Generated Video",elem_id="output_vid",autoplay=True,show_share_button=True)
132
+
133
+
134
+
135
+ i2v_start_btn.click(inputs=[i2v_input_image, i2v_elevation, i2v_center_scale, i2v_d_phi, i2v_d_theta, i2v_d_r],
136
+ outputs=[i2v_traj_video],
137
+ fn = image2video.run_traj
138
+ )
139
+
140
+ i2v_end_btn.click(inputs=[i2v_steps, i2v_seed],
141
+ outputs=[i2v_output_video],
142
+ fn = image2video.run_gen
143
+ )
144
 
145
  return viewcrafter_iface
146
 
147
 
148
  viewcrafter_iface = viewcrafter_demo(opts)
149
  viewcrafter_iface.queue(max_size=10)
150
+ viewcrafter_iface.launch() #fixme
151
+ # viewcrafter_iface.launch(server_name='11.220.92.96', server_port=80, max_threads=1,debug=False)
152
 
app_old.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+ import sys
4
+ import spaces
5
+
6
+
7
+ import gradio as gr
8
+ import random
9
+ from configs.infer_config import get_parser
10
+ from huggingface_hub import hf_hub_download
11
+
12
+ i2v_examples = [
13
+ ['test/images/boy.png', 0, 1.0, '0 40', '0 0', '0 0', 50, 123],
14
+ ['test/images/car.jpeg', 0, 1.0, '0 -35', '0 0', '0 -0.1', 50, 123],
15
+ ['test/images/fruit.jpg', 0, 1.0, '0 -3 -15 -20 -17 -5 0', '0 -2 -5 -10 -8 -5 0 2 5 3 0', '0 0', 50, 123],
16
+ ['test/images/room.png', 5, 1.0, '0 3 10 20 17 10 0', '0 -2 -8 -6 0 2 5 3 0', '0 -0.02 -0.09 -0.16 -0.09 0', 50, 123],
17
+ ['test/images/castle.png', 0, 1.0, '0 30', '0 -1 -5 -4 0 1 5 4 0', '0 -0.2', 50, 123],
18
+ ]
19
+
20
+ max_seed = 2 ** 31
21
+
22
+ def download_model():
23
+ REPO_ID = 'Drexubery/ViewCrafter_25'
24
+ filename_list = ['model.ckpt']
25
+ for filename in filename_list:
26
+ local_file = os.path.join('./checkpoints/', filename)
27
+ if not os.path.exists(local_file):
28
+ hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/', force_download=True)
29
+
30
+ download_model()
31
+ parser = get_parser() # infer_config.py
32
+ opts = parser.parse_args() # default device: 'cuda:0'
33
+ opts.save_dir = './'
34
+ os.makedirs(opts.save_dir,exist_ok=True)
35
+ test_tensor = torch.Tensor([0]).cuda()
36
+ opts.device = str(test_tensor.device)
37
+
38
+ # install pytorch3d
39
+ pyt_version_str=torch.__version__.split("+")[0].replace(".", "")
40
+ version_str="".join([
41
+ f"py3{sys.version_info.minor}_cu",
42
+ torch.version.cuda.replace(".",""),
43
+ f"_pyt{pyt_version_str}"
44
+ ])
45
+ print(version_str)
46
+ os.system(f"{sys.executable} -m pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html")
47
+ os.system("mkdir -p checkpoints/ && wget https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth -P checkpoints/")
48
+ print(f'>>> System info: {version_str}')
49
+
50
+
51
+ from viewcrafter import ViewCrafter
52
+
53
+ def viewcrafter_demo(opts):
54
+ css = """#input_img {max-width: 1024px !important} #output_vid {max-width: 1024px; max-height:576px} #random_button {max-width: 100px !important}"""
55
+ image2video = ViewCrafter(opts, gradio = True)
56
+ image2video.run_gradio = spaces.GPU(image2video.run_gradio, duration=300)
57
+ with gr.Blocks(analytics_enabled=False, css=css) as viewcrafter_iface:
58
+ gr.Markdown("<div align='center'> <h1> ViewCrafter: Taming Video Diffusion Models for High-fidelity Novel View Synthesis </span> </h1> \
59
+ <h2 style='font-weight: 450; font-size: 1rem; margin: 0rem'>\
60
+ <a href='https://scholar.google.com/citations?user=UOE8-qsAAAAJ&hl=zh-CN'>Wangbo Yu</a>, \
61
+ <a href='https://doubiiu.github.io/'>Jinbo Xing</a>, <a href=''>Li Yuan</a>, \
62
+ <a href='https://wbhu.github.io/'>Wenbo Hu</a>, <a href='https://xiaoyu258.github.io/'>Xiaoyu Li</a>,\
63
+ <a href=''>Zhipeng Huang</a>, <a href='https://scholar.google.com/citations?user=qgdesEcAAAAJ&hl=en/'>Xiangjun Gao</a>,\
64
+ <a href='https://www.cse.cuhk.edu.hk/~ttwong/myself.html/'>Tien-Tsin Wong</a>,\
65
+ <a href='https://scholar.google.com/citations?hl=en&user=4oXBp9UAAAAJ&view_op=list_works&sortby=pubdate/'>Ying Shan</a>\
66
+ <a href=''>Yonghong Tian</a>\
67
+ </h2> \
68
+ <a style='font-size:18px;color: #FF5DB0' href='https://github.com/Drexubery/ViewCrafter/blob/main/docs/render_help.md'> [Guideline] </a>\
69
+ <a style='font-size:18px;color: #000000' href=''> [ArXiv] </a>\
70
+ <a style='font-size:18px;color: #000000' href='https://drexubery.github.io/ViewCrafter/'> [Project Page] </a>\
71
+ <a style='font-size:18px;color: #000000' href='https://github.com/Drexubery/ViewCrafter'> [Github] </a> </div>")
72
+
73
+ #######image2video######
74
+ with gr.Tab(label="ViewCrafter_25, 'single_view_txt' mode"):
75
+ with gr.Column():
76
+ with gr.Row():
77
+ with gr.Column():
78
+ with gr.Row():
79
+ i2v_input_image = gr.Image(label="Input Image",elem_id="input_img")
80
+ with gr.Row():
81
+ i2v_elevation = gr.Slider(minimum=-45, maximum=45, step=1, elem_id="elevation", label="elevation", value=5)
82
+ with gr.Row():
83
+ i2v_center_scale = gr.Slider(minimum=0.1, maximum=2, step=0.1, elem_id="i2v_center_scale", label="center_scale", value=1)
84
+ with gr.Row():
85
+ i2v_d_phi = gr.Text(label='d_phi sequence, should start with 0')
86
+ with gr.Row():
87
+ i2v_d_theta = gr.Text(label='d_theta sequence, should start with 0')
88
+ with gr.Row():
89
+ i2v_d_r = gr.Text(label='d_r sequence, should start with 0')
90
+ with gr.Row():
91
+ i2v_steps = gr.Slider(minimum=1, maximum=50, step=1, elem_id="i2v_steps", label="Sampling steps", value=50)
92
+ with gr.Row():
93
+ i2v_seed = gr.Slider(label='Random Seed', minimum=0, maximum=max_seed, step=1, value=123)
94
+ i2v_end_btn = gr.Button("Generate")
95
+ # with gr.Tab(label='Result'):
96
+ with gr.Column():
97
+ with gr.Row():
98
+ i2v_traj_video = gr.Video(label="Camera Trajectory",elem_id="traj_vid",autoplay=True,show_share_button=True)
99
+ with gr.Row():
100
+ i2v_output_video = gr.Video(label="Generated Video",elem_id="output_vid",autoplay=True,show_share_button=True)
101
+
102
+ gr.Examples(examples=i2v_examples,
103
+ inputs=[i2v_input_image, i2v_elevation, i2v_center_scale, i2v_d_phi, i2v_d_theta, i2v_d_r, i2v_steps, i2v_seed],
104
+ outputs=[i2v_traj_video,i2v_output_video],
105
+ fn = image2video.run_gradio,
106
+ cache_examples='lazy',
107
+ )
108
+
109
+ # image2video.run_gradio(i2v_input_image='test/images/boy.png', i2v_elevation='10', i2v_d_phi='0 40', i2v_d_theta='0 0', i2v_d_r='0 0', i2v_center_scale=1, i2v_steps=50, i2v_seed=123)
110
+ i2v_end_btn.click(inputs=[i2v_input_image, i2v_elevation, i2v_center_scale, i2v_d_phi, i2v_d_theta, i2v_d_r, i2v_steps, i2v_seed],
111
+ outputs=[i2v_traj_video,i2v_output_video],
112
+ fn = image2video.run_gradio
113
+ )
114
+
115
+ return viewcrafter_iface
116
+
117
+
118
+ viewcrafter_iface = viewcrafter_demo(opts)
119
+ viewcrafter_iface.queue(max_size=10)
120
+ viewcrafter_iface.launch()
121
+ # viewcrafter_iface.launch(server_name='127.0.0.1', server_port=80, max_threads=1,debug=False)
122
+
configs/__pycache__/infer_config.cpython-39.pyc CHANGED
Binary files a/configs/__pycache__/infer_config.cpython-39.pyc and b/configs/__pycache__/infer_config.cpython-39.pyc differ
 
configs/inference_pvd_1024_local.yaml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ model:
2
+ pretrained_checkpoint: /apdcephfs_cq10/share_1290939/vg_share/vip3d_share/DC_1024/model.ckpt
3
+ base_learning_rate: 1.0e-05
4
+ scale_lr: False
5
+ target: lvdm.models.ddpm3d.VIPLatentDiffusion
6
+ params:
7
+ rescale_betas_zero_snr: True
8
+ parameterization: "v"
9
+ linear_start: 0.00085
10
+ linear_end: 0.012
11
+ num_timesteps_cond: 1
12
+ log_every_t: 200
13
+ timesteps: 1000
14
+ first_stage_key: video
15
+ cond_stage_key: caption
16
+ cond_stage_trainable: False
17
+ image_proj_model_trainable: True
18
+ conditioning_key: hybrid
19
+ image_size: [72, 128]
20
+ channels: 4
21
+ scale_by_std: False
22
+ scale_factor: 0.18215
23
+ use_ema: False
24
+ uncond_prob: 0.05
25
+ uncond_type: 'empty_seq'
26
+ rand_cond_frame: true
27
+ use_dynamic_rescale: true
28
+ base_scale: 0.3
29
+ fps_condition_type: 'fps'
30
+ perframe_ae: True
31
+ loop_video: Flase
32
+
33
+ unet_config:
34
+ target: lvdm.modules.networks.openaimodel3d.UNetModel
35
+ params:
36
+ in_channels: 8
37
+ out_channels: 4
38
+ model_channels: 320
39
+ attention_resolutions:
40
+ - 4
41
+ - 2
42
+ - 1
43
+ num_res_blocks: 2
44
+ channel_mult:
45
+ - 1
46
+ - 2
47
+ - 4
48
+ - 4
49
+ dropout: 0.1
50
+ num_head_channels: 64
51
+ transformer_depth: 1
52
+ context_dim: 1024
53
+ use_linear: true
54
+ use_checkpoint: True
55
+ temporal_conv: True
56
+ temporal_attention: True
57
+ temporal_selfatt_only: true
58
+ use_relative_position: false
59
+ use_causal_attention: False
60
+ temporal_length: 16
61
+ addition_attention: true
62
+ image_cross_attention: true
63
+ default_fs: 10
64
+ fs_condition: true
65
+
66
+ first_stage_config:
67
+ target: lvdm.models.autoencoder.AutoencoderKL
68
+ params:
69
+ embed_dim: 4
70
+ monitor: val/rec_loss
71
+ ddconfig:
72
+ double_z: True
73
+ z_channels: 4
74
+ resolution: 256
75
+ in_channels: 3
76
+ out_ch: 3
77
+ ch: 128
78
+ ch_mult:
79
+ - 1
80
+ - 2
81
+ - 4
82
+ - 4
83
+ num_res_blocks: 2
84
+ attn_resolutions: []
85
+ dropout: 0.0
86
+ lossconfig:
87
+ target: torch.nn.Identity
88
+
89
+ cond_stage_config:
90
+ target: lvdm.modules.encoders.condition.FrozenOpenCLIPEmbedder
91
+ params:
92
+ version: /apdcephfs_cq10/share_1290939/vg_share/vip3d_share/OpenCLIP-ViT-H-14-laion2B-s32B-b79K/blobs/9a78ef8e8c73fd0df621682e7a8e8eb36c6916cb3c16b291a082ecd52ab79cc4
93
+ freeze: true
94
+ layer: "penultimate"
95
+
96
+ img_cond_stage_config:
97
+ target: lvdm.modules.encoders.condition.FrozenOpenCLIPImageEmbedderV2
98
+ params:
99
+ version: /apdcephfs_cq10/share_1290939/vg_share/vip3d_share/OpenCLIP-ViT-H-14-laion2B-s32B-b79K/blobs/9a78ef8e8c73fd0df621682e7a8e8eb36c6916cb3c16b291a082ecd52ab79cc4
100
+ freeze: true
101
+
102
+ image_proj_stage_config:
103
+ target: lvdm.modules.encoders.resampler.Resampler
104
+ params:
105
+ dim: 1024
106
+ depth: 4
107
+ dim_head: 64
108
+ heads: 12
109
+ num_queries: 16
110
+ embedding_dim: 1280
111
+ output_dim: 1024
112
+ ff_mult: 4
113
+ video_length: 16
extern/dust3r/croco/models/__pycache__/blocks.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/croco/models/__pycache__/blocks.cpython-39.pyc and b/extern/dust3r/croco/models/__pycache__/blocks.cpython-39.pyc differ
 
extern/dust3r/croco/models/__pycache__/croco.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/croco/models/__pycache__/croco.cpython-39.pyc and b/extern/dust3r/croco/models/__pycache__/croco.cpython-39.pyc differ
 
extern/dust3r/croco/models/__pycache__/dpt_block.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/croco/models/__pycache__/dpt_block.cpython-39.pyc and b/extern/dust3r/croco/models/__pycache__/dpt_block.cpython-39.pyc differ
 
extern/dust3r/croco/models/__pycache__/masking.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/croco/models/__pycache__/masking.cpython-39.pyc and b/extern/dust3r/croco/models/__pycache__/masking.cpython-39.pyc differ
 
extern/dust3r/croco/models/__pycache__/pos_embed.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/croco/models/__pycache__/pos_embed.cpython-39.pyc and b/extern/dust3r/croco/models/__pycache__/pos_embed.cpython-39.pyc differ
 
extern/dust3r/croco/models/curope/__pycache__/__init__.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/croco/models/curope/__pycache__/__init__.cpython-39.pyc and b/extern/dust3r/croco/models/curope/__pycache__/__init__.cpython-39.pyc differ
 
extern/dust3r/croco/models/curope/__pycache__/curope2d.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/croco/models/curope/__pycache__/curope2d.cpython-39.pyc and b/extern/dust3r/croco/models/curope/__pycache__/curope2d.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/__init__.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/__init__.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/__init__.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/image_pairs.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/image_pairs.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/image_pairs.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/inference.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/inference.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/inference.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/model.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/model.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/model.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/optim_factory.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/optim_factory.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/optim_factory.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/patch_embed.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/patch_embed.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/patch_embed.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/post_process.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/post_process.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/post_process.cpython-39.pyc differ
 
extern/dust3r/dust3r/__pycache__/viz.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/__pycache__/viz.cpython-39.pyc and b/extern/dust3r/dust3r/__pycache__/viz.cpython-39.pyc differ
 
extern/dust3r/dust3r/cloud_opt/__pycache__/__init__.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/cloud_opt/__pycache__/__init__.cpython-39.pyc and b/extern/dust3r/dust3r/cloud_opt/__pycache__/__init__.cpython-39.pyc differ
 
extern/dust3r/dust3r/cloud_opt/__pycache__/base_opt.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/cloud_opt/__pycache__/base_opt.cpython-39.pyc and b/extern/dust3r/dust3r/cloud_opt/__pycache__/base_opt.cpython-39.pyc differ
 
extern/dust3r/dust3r/cloud_opt/__pycache__/commons.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/cloud_opt/__pycache__/commons.cpython-39.pyc and b/extern/dust3r/dust3r/cloud_opt/__pycache__/commons.cpython-39.pyc differ
 
extern/dust3r/dust3r/cloud_opt/__pycache__/init_im_poses.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/cloud_opt/__pycache__/init_im_poses.cpython-39.pyc and b/extern/dust3r/dust3r/cloud_opt/__pycache__/init_im_poses.cpython-39.pyc differ
 
extern/dust3r/dust3r/cloud_opt/__pycache__/optimizer.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/cloud_opt/__pycache__/optimizer.cpython-39.pyc and b/extern/dust3r/dust3r/cloud_opt/__pycache__/optimizer.cpython-39.pyc differ
 
extern/dust3r/dust3r/cloud_opt/__pycache__/pair_viewer.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/cloud_opt/__pycache__/pair_viewer.cpython-39.pyc and b/extern/dust3r/dust3r/cloud_opt/__pycache__/pair_viewer.cpython-39.pyc differ
 
extern/dust3r/dust3r/heads/__pycache__/__init__.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/heads/__pycache__/__init__.cpython-39.pyc and b/extern/dust3r/dust3r/heads/__pycache__/__init__.cpython-39.pyc differ
 
extern/dust3r/dust3r/heads/__pycache__/dpt_head.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/heads/__pycache__/dpt_head.cpython-39.pyc and b/extern/dust3r/dust3r/heads/__pycache__/dpt_head.cpython-39.pyc differ
 
extern/dust3r/dust3r/heads/__pycache__/linear_head.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/heads/__pycache__/linear_head.cpython-39.pyc and b/extern/dust3r/dust3r/heads/__pycache__/linear_head.cpython-39.pyc differ
 
extern/dust3r/dust3r/heads/__pycache__/postprocess.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/heads/__pycache__/postprocess.cpython-39.pyc and b/extern/dust3r/dust3r/heads/__pycache__/postprocess.cpython-39.pyc differ
 
extern/dust3r/dust3r/utils/__pycache__/__init__.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/utils/__pycache__/__init__.cpython-39.pyc and b/extern/dust3r/dust3r/utils/__pycache__/__init__.cpython-39.pyc differ
 
extern/dust3r/dust3r/utils/__pycache__/device.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/utils/__pycache__/device.cpython-39.pyc and b/extern/dust3r/dust3r/utils/__pycache__/device.cpython-39.pyc differ
 
extern/dust3r/dust3r/utils/__pycache__/geometry.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/utils/__pycache__/geometry.cpython-39.pyc and b/extern/dust3r/dust3r/utils/__pycache__/geometry.cpython-39.pyc differ
 
extern/dust3r/dust3r/utils/__pycache__/image.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/utils/__pycache__/image.cpython-39.pyc and b/extern/dust3r/dust3r/utils/__pycache__/image.cpython-39.pyc differ
 
extern/dust3r/dust3r/utils/__pycache__/misc.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/utils/__pycache__/misc.cpython-39.pyc and b/extern/dust3r/dust3r/utils/__pycache__/misc.cpython-39.pyc differ
 
extern/dust3r/dust3r/utils/__pycache__/path_to_croco.cpython-39.pyc CHANGED
Binary files a/extern/dust3r/dust3r/utils/__pycache__/path_to_croco.cpython-39.pyc and b/extern/dust3r/dust3r/utils/__pycache__/path_to_croco.cpython-39.pyc differ
 
lvdm/__pycache__/basics.cpython-39.pyc CHANGED
Binary files a/lvdm/__pycache__/basics.cpython-39.pyc and b/lvdm/__pycache__/basics.cpython-39.pyc differ
 
lvdm/__pycache__/common.cpython-39.pyc CHANGED
Binary files a/lvdm/__pycache__/common.cpython-39.pyc and b/lvdm/__pycache__/common.cpython-39.pyc differ
 
lvdm/__pycache__/distributions.cpython-39.pyc CHANGED
Binary files a/lvdm/__pycache__/distributions.cpython-39.pyc and b/lvdm/__pycache__/distributions.cpython-39.pyc differ
 
lvdm/__pycache__/ema.cpython-39.pyc CHANGED
Binary files a/lvdm/__pycache__/ema.cpython-39.pyc and b/lvdm/__pycache__/ema.cpython-39.pyc differ
 
lvdm/models/__pycache__/autoencoder.cpython-39.pyc CHANGED
Binary files a/lvdm/models/__pycache__/autoencoder.cpython-39.pyc and b/lvdm/models/__pycache__/autoencoder.cpython-39.pyc differ
 
lvdm/models/__pycache__/ddpm3d.cpython-39.pyc CHANGED
Binary files a/lvdm/models/__pycache__/ddpm3d.cpython-39.pyc and b/lvdm/models/__pycache__/ddpm3d.cpython-39.pyc differ
 
lvdm/models/__pycache__/utils_diffusion.cpython-39.pyc CHANGED
Binary files a/lvdm/models/__pycache__/utils_diffusion.cpython-39.pyc and b/lvdm/models/__pycache__/utils_diffusion.cpython-39.pyc differ
 
lvdm/models/samplers/__pycache__/ddim.cpython-39.pyc CHANGED
Binary files a/lvdm/models/samplers/__pycache__/ddim.cpython-39.pyc and b/lvdm/models/samplers/__pycache__/ddim.cpython-39.pyc differ
 
lvdm/models/samplers/__pycache__/ddim_multiplecond.cpython-39.pyc CHANGED
Binary files a/lvdm/models/samplers/__pycache__/ddim_multiplecond.cpython-39.pyc and b/lvdm/models/samplers/__pycache__/ddim_multiplecond.cpython-39.pyc differ
 
lvdm/modules/__pycache__/attention.cpython-39.pyc CHANGED
Binary files a/lvdm/modules/__pycache__/attention.cpython-39.pyc and b/lvdm/modules/__pycache__/attention.cpython-39.pyc differ
 
lvdm/modules/encoders/__pycache__/condition.cpython-39.pyc CHANGED
Binary files a/lvdm/modules/encoders/__pycache__/condition.cpython-39.pyc and b/lvdm/modules/encoders/__pycache__/condition.cpython-39.pyc differ
 
lvdm/modules/encoders/__pycache__/resampler.cpython-39.pyc CHANGED
Binary files a/lvdm/modules/encoders/__pycache__/resampler.cpython-39.pyc and b/lvdm/modules/encoders/__pycache__/resampler.cpython-39.pyc differ
 
lvdm/modules/networks/__pycache__/ae_modules.cpython-39.pyc CHANGED
Binary files a/lvdm/modules/networks/__pycache__/ae_modules.cpython-39.pyc and b/lvdm/modules/networks/__pycache__/ae_modules.cpython-39.pyc differ
 
lvdm/modules/networks/__pycache__/openaimodel3d.cpython-39.pyc CHANGED
Binary files a/lvdm/modules/networks/__pycache__/openaimodel3d.cpython-39.pyc and b/lvdm/modules/networks/__pycache__/openaimodel3d.cpython-39.pyc differ