Update app.py
Browse files
app.py
CHANGED
|
@@ -82,14 +82,8 @@ def save_splat_file(splat_data, output_path):
|
|
| 82 |
with open(output_path, "wb") as f:
|
| 83 |
f.write(splat_data)
|
| 84 |
|
| 85 |
-
def get_reconstructed_scene(outdir, model, device):
|
| 86 |
|
| 87 |
-
image_files = sorted(
|
| 88 |
-
[
|
| 89 |
-
os.path.join(outdir, "images", f)
|
| 90 |
-
for f in os.listdir(os.path.join(outdir, "images"))
|
| 91 |
-
]
|
| 92 |
-
)
|
| 93 |
images = [process_image(img_path) for img_path in image_files]
|
| 94 |
images = torch.stack(images, dim=0).unsqueeze(0).to(device) # [1, K, 3, 448, 448]
|
| 95 |
b, v, c, h, w = images.shape
|
|
@@ -270,7 +264,7 @@ def generate_splats_from_images(image_paths, session_id=None):
|
|
| 270 |
|
| 271 |
print("Running run_model...")
|
| 272 |
with torch.no_grad():
|
| 273 |
-
plyfile, video, depth_colored = get_reconstructed_scene(base_dir, model, device)
|
| 274 |
|
| 275 |
end_time = time.time()
|
| 276 |
print(f"Total time: {end_time - start_time:.2f} seconds (including IO)")
|
|
|
|
| 82 |
with open(output_path, "wb") as f:
|
| 83 |
f.write(splat_data)
|
| 84 |
|
| 85 |
+
def get_reconstructed_scene(outdir, image_files, model, device):
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
images = [process_image(img_path) for img_path in image_files]
|
| 88 |
images = torch.stack(images, dim=0).unsqueeze(0).to(device) # [1, K, 3, 448, 448]
|
| 89 |
b, v, c, h, w = images.shape
|
|
|
|
| 264 |
|
| 265 |
print("Running run_model...")
|
| 266 |
with torch.no_grad():
|
| 267 |
+
plyfile, video, depth_colored = get_reconstructed_scene(base_dir, image_paths, model, device)
|
| 268 |
|
| 269 |
end_time = time.time()
|
| 270 |
print(f"Total time: {end_time - start_time:.2f} seconds (including IO)")
|