jiaweir commited on
Commit
c122ae9
β€’
1 Parent(s): e8ff8db
Files changed (3) hide show
  1. app.py +1 -1
  2. lgm/infer_demo.py +3 -2
  3. main_4d_demo.py +1 -1
app.py CHANGED
@@ -211,7 +211,7 @@ def optimize_stage_1(image_block: Image.Image, preprocess_chk: bool, seed_slider
211
 
212
  # stage 1
213
  # subprocess.run(f'python lgm/infer.py big --resume {ckpt_path} --test_path tmp_data/{img_hash}_rgba.png', shell=True)
214
- process_lgm(opt, f'tmp_data/{img_hash}_rgba.png', pipe_mvdream, model, rays_embeddings)
215
  # return [os.path.join('logs', 'tmp_rgba_model.ply')]
216
  return os.path.join('vis_data', f'{img_hash}_rgba_static.mp4')
217
 
 
211
 
212
  # stage 1
213
  # subprocess.run(f'python lgm/infer.py big --resume {ckpt_path} --test_path tmp_data/{img_hash}_rgba.png', shell=True)
214
+ process_lgm(opt, f'tmp_data/{img_hash}_rgba.png', pipe_mvdream, model, rays_embeddings, seed_slider)
215
  # return [os.path.join('logs', 'tmp_rgba_model.ply')]
216
  return os.path.join('vis_data', f'{img_hash}_rgba_static.mp4')
217
 
lgm/infer_demo.py CHANGED
@@ -47,7 +47,7 @@ IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225)
47
 
48
 
49
  # process function
50
- def process(opt: Options, path, pipe, model, rays_embeddings):
51
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
52
  tan_half_fov = np.tan(0.5 * np.deg2rad(opt.fovy))
53
  proj_matrix = torch.zeros(4, 4, dtype=torch.float32, device=device)
@@ -72,7 +72,8 @@ def process(opt: Options, path, pipe, model, rays_embeddings):
72
  if image.shape[-1] == 4:
73
  image = image[..., :3] * image[..., 3:4] + (1 - image[..., 3:4])
74
 
75
- mv_image = pipe('', image, guidance_scale=5.0, num_inference_steps=30, elevation=0)
 
76
  mv_image = np.stack([mv_image[1], mv_image[2], mv_image[3], mv_image[0]], axis=0) # [4, 256, 256, 3], float32
77
 
78
  # generate gaussians
 
47
 
48
 
49
  # process function
50
+ def process(opt: Options, path, pipe, model, rays_embeddings, seed):
51
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
52
  tan_half_fov = np.tan(0.5 * np.deg2rad(opt.fovy))
53
  proj_matrix = torch.zeros(4, 4, dtype=torch.float32, device=device)
 
72
  if image.shape[-1] == 4:
73
  image = image[..., :3] * image[..., 3:4] + (1 - image[..., 3:4])
74
 
75
+ generator = torch.manual_seed(seed)
76
+ mv_image = pipe('', image, guidance_scale=5.0, num_inference_steps=30, elevation=0, generator=generator)
77
  mv_image = np.stack([mv_image[1], mv_image[2], mv_image[3], mv_image[0]], axis=0) # [4, 256, 256, 3], float32
78
 
79
  # generate gaussians
main_4d_demo.py CHANGED
@@ -571,7 +571,7 @@ class GUI:
571
  hor = (hor+delta_hor) % 360
572
 
573
 
574
- imageio.mimwrite(f'vis_data/{opt.save_path}.mp4', image_list, fps=7)
575
 
576
  if self.gui:
577
  while True:
 
571
  hor = (hor+delta_hor) % 360
572
 
573
 
574
+ imageio.mimwrite(f'vis_data/{self.opt.save_path}.mp4', image_list, fps=7)
575
 
576
  if self.gui:
577
  while True: