Spaces:
Running
on
Zero
Running
on
Zero
update
Browse files- viewcrafter.py +2 -2
viewcrafter.py
CHANGED
@@ -123,7 +123,7 @@ class ViewCrafter:
|
|
123 |
## FIXME hard coded candidate view数量, 以left为例,第一次迭代从[左,左上]中选取, 从第二次开始可以从[左,左上,左下]中选取
|
124 |
num_candidates = 2
|
125 |
candidate_poses,thetas,phis = generate_candidate_poses(c2ws, H, W, focals, principal_points, self.opts.d_theta[0], self.opts.d_phi[0],num_candidates, self.device)
|
126 |
-
_, viewmask = self.run_render([pcd[-1]], [imgs[-1]],masks, H, W, candidate_poses,num_candidates,use_cpu=
|
127 |
nbv_id = torch.argmin(viewmask.sum(dim=[1,2,3])).item()
|
128 |
save_image( viewmask.permute(0,3,1,2), os.path.join(self.opts.save_dir,f"candidate_mask0_nbv{nbv_id}.png"), normalize=True, value_range=(0, 1))
|
129 |
theta_nbv = thetas[nbv_id]
|
@@ -150,7 +150,7 @@ class ViewCrafter:
|
|
150 |
else:
|
151 |
raise KeyError(f"Invalid Mode: {self.opts.mode}")
|
152 |
|
153 |
-
render_results, viewmask = self.run_render([pcd[-1]], [imgs[-1]],masks, H, W, camera_traj,num_views,use_cpu=
|
154 |
render_results = render_results.to(self.device)
|
155 |
render_results = F.interpolate(render_results.permute(0,3,1,2), size=(576, 1024), mode='bilinear', align_corners=False).permute(0,2,3,1)
|
156 |
render_results[0] = self.img_ori
|
|
|
123 |
## FIXME hard coded candidate view数量, 以left为例,第一次迭代从[左,左上]中选取, 从第二次开始可以从[左,左上,左下]中选取
|
124 |
num_candidates = 2
|
125 |
candidate_poses,thetas,phis = generate_candidate_poses(c2ws, H, W, focals, principal_points, self.opts.d_theta[0], self.opts.d_phi[0],num_candidates, self.device)
|
126 |
+
_, viewmask = self.run_render([pcd[-1]], [imgs[-1]],masks, H, W, candidate_poses,num_candidates,use_cpu=False)
|
127 |
nbv_id = torch.argmin(viewmask.sum(dim=[1,2,3])).item()
|
128 |
save_image( viewmask.permute(0,3,1,2), os.path.join(self.opts.save_dir,f"candidate_mask0_nbv{nbv_id}.png"), normalize=True, value_range=(0, 1))
|
129 |
theta_nbv = thetas[nbv_id]
|
|
|
150 |
else:
|
151 |
raise KeyError(f"Invalid Mode: {self.opts.mode}")
|
152 |
|
153 |
+
render_results, viewmask = self.run_render([pcd[-1]], [imgs[-1]],masks, H, W, camera_traj,num_views,use_cpu=False)
|
154 |
render_results = render_results.to(self.device)
|
155 |
render_results = F.interpolate(render_results.permute(0,3,1,2), size=(576, 1024), mode='bilinear', align_corners=False).permute(0,2,3,1)
|
156 |
render_results[0] = self.img_ori
|