init
Browse files- .gitmodules +3 -0
- app.py +36 -0
- mast3r +1 -0
- requirements.txt +15 -0
.gitmodules
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[submodule "mast3r"]
|
| 2 |
+
path = mast3r
|
| 3 |
+
url = https://github.com/naver/mast3r
|
app.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2024-present Naver Corporation. All rights reserved.
|
| 2 |
+
# Licensed under CC BY-NC-SA 4.0 (non-commercial use only).
|
| 3 |
+
#
|
| 4 |
+
# --------------------------------------------------------
|
| 5 |
+
# masst3r demo
|
| 6 |
+
# --------------------------------------------------------
|
| 7 |
+
import os
|
| 8 |
+
import sys
|
| 9 |
+
import os.path as path
|
| 10 |
+
import torch
|
| 11 |
+
import tempfile
|
| 12 |
+
|
| 13 |
+
HERE_PATH = path.normpath(path.dirname(__file__)) # noqa
|
| 14 |
+
MASt3R_REPO_PATH = path.normpath(path.join(HERE_PATH, './mast3r')) # noqa
|
| 15 |
+
sys.path.insert(0, MASt3R_REPO_PATH) # noqa
|
| 16 |
+
|
| 17 |
+
from mast3r.demo import main_demo
|
| 18 |
+
from mast3r.model import AsymmetricMASt3R
|
| 19 |
+
from mast3r.utils.misc import hash_md5
|
| 20 |
+
|
| 21 |
+
import matplotlib.pyplot as pl
|
| 22 |
+
pl.ion()
|
| 23 |
+
|
| 24 |
+
torch.backends.cuda.matmul.allow_tf32 = True # for gpu >= Ampere and pytorch >= 1.12
|
| 25 |
+
batch_size = 1
|
| 26 |
+
|
| 27 |
+
weights_path = "naver/" + 'MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric'
|
| 28 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 29 |
+
model = AsymmetricMASt3R.from_pretrained(weights_path).to(device)
|
| 30 |
+
chkpt_tag = hash_md5(weights_path)
|
| 31 |
+
|
| 32 |
+
# mast3r will write the 3D model inside tmpdirname/chkpt_tag
|
| 33 |
+
with tempfile.TemporaryDirectory(suffix='_mast3r_gradio_demo') as tmpdirname:
|
| 34 |
+
cache_path = os.path.join(tmpdirname, chkpt_tag)
|
| 35 |
+
os.makedirs(cache_path, exist_ok=True)
|
| 36 |
+
main_demo(tmpdirname, model, device, 512, server_name=None, server_port=None, silent=True, share=None)
|
mast3r
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Subproject commit f64a2f2a44834824dc1d34f445ad747cbfc4f1e2
|
requirements.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
scikit-learn
|
| 2 |
+
pillow-heif
|
| 3 |
+
torch
|
| 4 |
+
torchvision
|
| 5 |
+
roma
|
| 6 |
+
gradio
|
| 7 |
+
matplotlib
|
| 8 |
+
tqdm
|
| 9 |
+
opencv-python
|
| 10 |
+
scipy
|
| 11 |
+
einops
|
| 12 |
+
trimesh
|
| 13 |
+
tensorboard
|
| 14 |
+
pyglet<2
|
| 15 |
+
huggingface-hub[torch]>=0.22
|