Spaces:
Sleeping
Sleeping
Commit ·
31cebd2
1
Parent(s): 2b1f990
check device in run_depth
Browse files
app.py
CHANGED
|
@@ -239,7 +239,7 @@ def run_depth_estimation(
|
|
| 239 |
).to(dtype=torch.float32, device=device)
|
| 240 |
|
| 241 |
dpt_pack = {
|
| 242 |
-
'c2w': c2w
|
| 243 |
'K': K,
|
| 244 |
'depth_mask': depth_mask,
|
| 245 |
'depth': depth
|
|
@@ -256,14 +256,14 @@ def run_depth_estimation(
|
|
| 256 |
else:
|
| 257 |
instance_mask = (seg_image.reshape(-1, 3) == instance_label).all(axis=-1).reshape(H, W)
|
| 258 |
mask_pack.append(instance_mask)
|
| 259 |
-
fg_mask = torch.from_numpy(np.stack(mask_pack).any(axis=0))
|
| 260 |
|
| 261 |
scene_est_depth_pts, scene_est_depth_pts_colors = \
|
| 262 |
-
project2ply(depth_mask, depth, input_image, K, c2w)
|
| 263 |
save_ply_path = os.path.join(work_space, "scene_pcd.glb")
|
| 264 |
|
| 265 |
fg_depth_pts, _ = \
|
| 266 |
-
project2ply(fg_mask, depth, input_image, K, c2w)
|
| 267 |
_, trans, scale = normalize_vertices(fg_depth_pts)
|
| 268 |
|
| 269 |
if trans.shape[0] == 1:
|
|
|
|
| 239 |
).to(dtype=torch.float32, device=device)
|
| 240 |
|
| 241 |
dpt_pack = {
|
| 242 |
+
'c2w': c2w,
|
| 243 |
'K': K,
|
| 244 |
'depth_mask': depth_mask,
|
| 245 |
'depth': depth
|
|
|
|
| 256 |
else:
|
| 257 |
instance_mask = (seg_image.reshape(-1, 3) == instance_label).all(axis=-1).reshape(H, W)
|
| 258 |
mask_pack.append(instance_mask)
|
| 259 |
+
fg_mask = torch.from_numpy(np.stack(mask_pack).any(axis=0))
|
| 260 |
|
| 261 |
scene_est_depth_pts, scene_est_depth_pts_colors = \
|
| 262 |
+
project2ply(depth_mask.to(device), depth.to(device), input_image.to(device), K.to(device), c2w.to(device))
|
| 263 |
save_ply_path = os.path.join(work_space, "scene_pcd.glb")
|
| 264 |
|
| 265 |
fg_depth_pts, _ = \
|
| 266 |
+
project2ply(fg_mask.to(device), depth.to(device), input_image.to(device), K.to(device), c2w.to(device))
|
| 267 |
_, trans, scale = normalize_vertices(fg_depth_pts)
|
| 268 |
|
| 269 |
if trans.shape[0] == 1:
|