Jie Hu
commited on
Commit
·
5412668
1
Parent(s):
9c25e98
init project
Browse files- .DS_Store +0 -0
- app.py +3 -6
- modules/.DS_Store +0 -0
- modules/dust3r/cloud_opt/base_opt.py +0 -3
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
app.py
CHANGED
|
@@ -39,7 +39,8 @@ import torchvision.transforms as tvf
|
|
| 39 |
|
| 40 |
|
| 41 |
silent = False
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
def _convert_scene_output_to_glb(outdir, imgs, pts3d, mask, focals, cams2world, cam_size=0.05,
|
|
@@ -244,7 +245,6 @@ def slerp_multiple(vectors, t_values):
|
|
| 244 |
|
| 245 |
# @torch.no_grad
|
| 246 |
# def get_mask_from_img_sam1(mobilesamv2, yolov8, sam1_image, yolov8_image, original_size, input_size, transform):
|
| 247 |
-
# device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 248 |
|
| 249 |
# sam_mask=[]
|
| 250 |
# img_area = original_size[0] * original_size[1]
|
|
@@ -444,8 +444,6 @@ def get_reconstructed_scene(outdir, filelist, schedule, niter, min_conf_thr,
|
|
| 444 |
"""
|
| 445 |
if len(filelist) < 2:
|
| 446 |
raise gradio.Error("Please input at least 2 images.")
|
| 447 |
-
|
| 448 |
-
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 449 |
|
| 450 |
images = Images(filelist=filelist, device=device)
|
| 451 |
|
|
@@ -499,6 +497,7 @@ def get_reconstructed_scene(outdir, filelist, schedule, niter, min_conf_thr,
|
|
| 499 |
|
| 500 |
outfile = get_3D_model_from_scene(outdir, scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 501 |
clean_depth, transparent_cams, cam_size)
|
|
|
|
| 502 |
# also return rgb, depth and confidence imgs
|
| 503 |
# depth is normalized with the max value for all images
|
| 504 |
# we apply the jet colormap on the confidence maps
|
|
@@ -524,8 +523,6 @@ def get_reconstructed_scene(outdir, filelist, schedule, niter, min_conf_thr,
|
|
| 524 |
# def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
|
| 525 |
# mask_sky, clean_depth, transparent_cams, cam_size):
|
| 526 |
|
| 527 |
-
# device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 528 |
-
|
| 529 |
# texts = [text]
|
| 530 |
# inputs = pe3r.siglip_tokenizer(text=texts, padding="max_length", return_tensors="pt")
|
| 531 |
# inputs = {key: value.to(device) for key, value in inputs.items()}
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
silent = False
|
| 42 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 43 |
+
pe3r = Models(device)
|
| 44 |
|
| 45 |
|
| 46 |
def _convert_scene_output_to_glb(outdir, imgs, pts3d, mask, focals, cams2world, cam_size=0.05,
|
|
|
|
| 245 |
|
| 246 |
# @torch.no_grad
|
| 247 |
# def get_mask_from_img_sam1(mobilesamv2, yolov8, sam1_image, yolov8_image, original_size, input_size, transform):
|
|
|
|
| 248 |
|
| 249 |
# sam_mask=[]
|
| 250 |
# img_area = original_size[0] * original_size[1]
|
|
|
|
| 444 |
"""
|
| 445 |
if len(filelist) < 2:
|
| 446 |
raise gradio.Error("Please input at least 2 images.")
|
|
|
|
|
|
|
| 447 |
|
| 448 |
images = Images(filelist=filelist, device=device)
|
| 449 |
|
|
|
|
| 497 |
|
| 498 |
outfile = get_3D_model_from_scene(outdir, scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 499 |
clean_depth, transparent_cams, cam_size)
|
| 500 |
+
torch.cuda.empty_cache()
|
| 501 |
# also return rgb, depth and confidence imgs
|
| 502 |
# depth is normalized with the max value for all images
|
| 503 |
# we apply the jet colormap on the confidence maps
|
|
|
|
| 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 |
# texts = [text]
|
| 527 |
# inputs = pe3r.siglip_tokenizer(text=texts, padding="max_length", return_tensors="pt")
|
| 528 |
# inputs = {key: value.to(device) for key, value in inputs.items()}
|
modules/.DS_Store
CHANGED
|
Binary files a/modules/.DS_Store and b/modules/.DS_Store differ
|
|
|
modules/dust3r/cloud_opt/base_opt.py
CHANGED
|
@@ -55,9 +55,6 @@ class BasePCOptimizer (nn.Module):
|
|
| 55 |
iterationsCount=None,
|
| 56 |
verbose=True):
|
| 57 |
super().__init__()
|
| 58 |
-
|
| 59 |
-
self.device = device
|
| 60 |
-
|
| 61 |
if not isinstance(view1['idx'], list):
|
| 62 |
view1['idx'] = view1['idx'].tolist()
|
| 63 |
if not isinstance(view2['idx'], list):
|
|
|
|
| 55 |
iterationsCount=None,
|
| 56 |
verbose=True):
|
| 57 |
super().__init__()
|
|
|
|
|
|
|
|
|
|
| 58 |
if not isinstance(view1['idx'], list):
|
| 59 |
view1['idx'] = view1['idx'].tolist()
|
| 60 |
if not isinstance(view2['idx'], list):
|