Spaces:
Runtime error
Runtime error
add log
Browse files
app.py
CHANGED
|
@@ -197,27 +197,30 @@ def reconstruct(video_path, conf_thresh, kf_every,
|
|
| 197 |
fps = len(batch) / (end - start)
|
| 198 |
print(f'Finished reconstruction for {demo_name}, FPS: {fps:.2f}')
|
| 199 |
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
|
| 222 |
print(f'Finished Process results {demo_name}')
|
| 223 |
|
|
|
|
| 197 |
fps = len(batch) / (end - start)
|
| 198 |
print(f'Finished reconstruction for {demo_name}, FPS: {fps:.2f}')
|
| 199 |
|
| 200 |
+
try:
|
| 201 |
+
# Process results
|
| 202 |
+
pcds = []
|
| 203 |
+
for j, view in enumerate(batch):
|
| 204 |
+
image = view['img'].permute(0, 2, 3, 1).cpu().numpy()[0]
|
| 205 |
+
image = (image + 1) / 2
|
| 206 |
+
pts = preds[j]['pts3d' if j==0 else 'pts3d_in_other_view'].detach().cpu().numpy()[0]
|
| 207 |
+
pts_normal = pts2normal(preds[j]['pts3d' if j==0 else 'pts3d_in_other_view'][0]).cpu().numpy()
|
| 208 |
+
conf = preds[j]['conf'][0].cpu().data.numpy()
|
| 209 |
+
conf_sig = (conf - 1) / conf
|
| 210 |
+
if remove_background:
|
| 211 |
+
mask = generate_mask(image)
|
| 212 |
+
else:
|
| 213 |
+
mask = np.ones_like(conf)
|
| 214 |
+
|
| 215 |
+
combined_mask = (conf_sig > conf_thresh) & (mask > 0.5)
|
| 216 |
|
| 217 |
+
pcd = o3d.geometry.PointCloud()
|
| 218 |
+
pcd.points = o3d.utility.Vector3dVector(pts[combined_mask])
|
| 219 |
+
pcd.colors = o3d.utility.Vector3dVector(image[combined_mask])
|
| 220 |
+
pcd.normals = o3d.utility.Vector3dVector(pts_normal[combined_mask])
|
| 221 |
+
pcds.append(pcd)
|
| 222 |
+
except Exception as e:
|
| 223 |
+
print(repr(e))
|
| 224 |
|
| 225 |
print(f'Finished Process results {demo_name}')
|
| 226 |
|