Update app.py
Browse files
app.py
CHANGED
|
@@ -28,18 +28,18 @@ device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
| 28 |
outdir = "/tmp/rayst3r"
|
| 29 |
|
| 30 |
moge_model = MoGeModel.from_pretrained("Ruicheng/moge-vitl").to(device)
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
#
|
| 43 |
|
| 44 |
|
| 45 |
def depth2uint16(depth):
|
|
@@ -112,8 +112,6 @@ def rayst3r_to_glb(img,depth_dict,mask,max_total_points=10e6,rotated=False):
|
|
| 112 |
prep_for_rayst3r(img,depth_dict,mask)
|
| 113 |
print('Doneneee')
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
# rayst3r_points = eval_scene(rayst3r_model,os.path.join(outdir, "input"),do_filter_all_masks=True,dino_model=dino_model, device = device).cpu()
|
| 118 |
|
| 119 |
# # subsample points
|
|
|
|
| 28 |
outdir = "/tmp/rayst3r"
|
| 29 |
|
| 30 |
moge_model = MoGeModel.from_pretrained("Ruicheng/moge-vitl").to(device)
|
| 31 |
+
dino_model = torch.hub.load('facebookresearch/dinov2', "dinov2_vitl14_reg")
|
| 32 |
+
dino_model.eval()
|
| 33 |
+
dino_model.to(device)
|
| 34 |
|
| 35 |
+
print("Loading RaySt3R model")
|
| 36 |
+
rayst3r_checkpoint = hf_hub_download("bartduis/rayst3r", "rayst3r.pth")
|
| 37 |
+
rayst3r_model = EvalWrapper(rayst3r_checkpoint,device='cpu')
|
| 38 |
+
rayst3r_model = rayst3r_model.to(device)
|
| 39 |
+
print("Loaded all models")
|
| 40 |
|
| 41 |
+
print("Loading MoGe model")
|
| 42 |
+
# Load the model from huggingface hub (or load from local).
|
| 43 |
|
| 44 |
|
| 45 |
def depth2uint16(depth):
|
|
|
|
| 112 |
prep_for_rayst3r(img,depth_dict,mask)
|
| 113 |
print('Doneneee')
|
| 114 |
|
|
|
|
|
|
|
| 115 |
# rayst3r_points = eval_scene(rayst3r_model,os.path.join(outdir, "input"),do_filter_all_masks=True,dino_model=dino_model, device = device).cpu()
|
| 116 |
|
| 117 |
# # subsample points
|