init project
Browse files
app.py
CHANGED
|
@@ -467,15 +467,11 @@ def get_reconstructed_scene(outdir, filelist, schedule, niter, min_conf_thr,
|
|
| 467 |
elif scenegraph_type == "oneref":
|
| 468 |
scenegraph_type = scenegraph_type + "-" + str(refid)
|
| 469 |
|
| 470 |
-
print('0')
|
| 471 |
pairs = make_pairs(imgs, scene_graph=scenegraph_type, prefilter=None, symmetrize=True)
|
| 472 |
-
print('a')
|
| 473 |
output = inference(pairs, pe3r.mast3r, device, batch_size=1, verbose=not silent)
|
| 474 |
-
print('b')
|
| 475 |
mode = GlobalAlignerMode.PointCloudOptimizer if len(imgs) > 2 else GlobalAlignerMode.PairViewer
|
| 476 |
scene_1 = global_aligner(output, cog_seg_maps, rev_cog_seg_maps, cog_feats, device=device, mode=mode, verbose=not silent)
|
| 477 |
lr = 0.01
|
| 478 |
-
print('c')
|
| 479 |
# if mode == GlobalAlignerMode.PointCloudOptimizer:
|
| 480 |
loss = scene_1.compute_global_alignment(tune_flg=True, init='mst', niter=niter, schedule=schedule, lr=lr)
|
| 481 |
|
|
@@ -527,6 +523,8 @@ def get_reconstructed_scene(outdir, filelist, schedule, niter, min_conf_thr,
|
|
| 527 |
def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
|
| 528 |
mask_sky, clean_depth, transparent_cams, cam_size):
|
| 529 |
|
|
|
|
|
|
|
| 530 |
texts = [text]
|
| 531 |
inputs = pe3r.siglip_tokenizer(text=texts, padding="max_length", return_tensors="pt")
|
| 532 |
inputs = {key: value.to(device) for key, value in inputs.items()}
|
|
|
|
| 467 |
elif scenegraph_type == "oneref":
|
| 468 |
scenegraph_type = scenegraph_type + "-" + str(refid)
|
| 469 |
|
|
|
|
| 470 |
pairs = make_pairs(imgs, scene_graph=scenegraph_type, prefilter=None, symmetrize=True)
|
|
|
|
| 471 |
output = inference(pairs, pe3r.mast3r, device, batch_size=1, verbose=not silent)
|
|
|
|
| 472 |
mode = GlobalAlignerMode.PointCloudOptimizer if len(imgs) > 2 else GlobalAlignerMode.PairViewer
|
| 473 |
scene_1 = global_aligner(output, cog_seg_maps, rev_cog_seg_maps, cog_feats, device=device, mode=mode, verbose=not silent)
|
| 474 |
lr = 0.01
|
|
|
|
| 475 |
# if mode == GlobalAlignerMode.PointCloudOptimizer:
|
| 476 |
loss = scene_1.compute_global_alignment(tune_flg=True, init='mst', niter=niter, schedule=schedule, lr=lr)
|
| 477 |
|
|
|
|
| 523 |
def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
|
| 524 |
mask_sky, clean_depth, transparent_cams, cam_size):
|
| 525 |
|
| 526 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 527 |
+
|
| 528 |
texts = [text]
|
| 529 |
inputs = pe3r.siglip_tokenizer(text=texts, padding="max_length", return_tensors="pt")
|
| 530 |
inputs = {key: value.to(device) for key, value in inputs.items()}
|