commit
Browse files
app.py
CHANGED
|
@@ -23,26 +23,16 @@ from utils_das3r.rearrange import main as rearrange_main
|
|
| 23 |
from train_gui import main as train_main
|
| 24 |
from render import main as render_main
|
| 25 |
|
| 26 |
-
def get_dust3r_args_parser():
|
| 27 |
-
parser = argparse.ArgumentParser()
|
| 28 |
-
parser.add_argument("--image_size", type=int, default=512, choices=[512, 224], help="image size")
|
| 29 |
-
parser.add_argument("--model_path", type=str, default="submodules/dust3r/checkpoints/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth", help="path to the model weights")
|
| 30 |
-
parser.add_argument("--device", type=str, default='cuda', help="pytorch device")
|
| 31 |
-
parser.add_argument("--batch_size", type=int, default=1)
|
| 32 |
-
parser.add_argument("--schedule", type=str, default='linear')
|
| 33 |
-
parser.add_argument("--lr", type=float, default=0.01)
|
| 34 |
-
parser.add_argument("--niter", type=int, default=300)
|
| 35 |
-
parser.add_argument("--focal_avg", type=bool, default=True)
|
| 36 |
-
parser.add_argument("--n_views", type=int, default=3)
|
| 37 |
-
parser.add_argument("--base_path", type=str, default=GRADIO_CACHE_FOLDER)
|
| 38 |
-
return parser
|
| 39 |
-
|
| 40 |
|
| 41 |
def natural_sort(l):
|
| 42 |
convert = lambda text: int(text) if text.isdigit() else text.lower()
|
| 43 |
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key.split('/')[-1])]
|
| 44 |
return sorted(l, key=alphanum_key)
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
@spaces.GPU(duration=150)
|
| 47 |
def process(inputfiles, input_path='demo'):
|
| 48 |
if inputfiles:
|
|
@@ -64,11 +54,15 @@ def process(inputfiles, input_path='demo'):
|
|
| 64 |
imgs_path = temp_dir
|
| 65 |
output_path = f'./results/{input_path}/output'
|
| 66 |
rearranged_path = f'{output_path}_rearranged'
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
|
|
|
|
| 23 |
from train_gui import main as train_main
|
| 24 |
from render import main as render_main
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
def natural_sort(l):
|
| 28 |
convert = lambda text: int(text) if text.isdigit() else text.lower()
|
| 29 |
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key.split('/')[-1])]
|
| 30 |
return sorted(l, key=alphanum_key)
|
| 31 |
|
| 32 |
+
def cmd(command):
|
| 33 |
+
print(command)
|
| 34 |
+
os.system(command)
|
| 35 |
+
|
| 36 |
@spaces.GPU(duration=150)
|
| 37 |
def process(inputfiles, input_path='demo'):
|
| 38 |
if inputfiles:
|
|
|
|
| 54 |
imgs_path = temp_dir
|
| 55 |
output_path = f'./results/{input_path}/output'
|
| 56 |
rearranged_path = f'{output_path}_rearranged'
|
| 57 |
+
cmd(f"python dynamic_predictor/launch.py --mode=eval_pose_custom \
|
| 58 |
+
--pretrained=Kai422kx/das3r \
|
| 59 |
+
--dir_path={imgs_path} \
|
| 60 |
+
--output_dir={output_path} \
|
| 61 |
+
--use_pred_mask ")
|
| 62 |
+
# dynamic_predictor_main(pretrained='Kai422kx/das3r', dir_path=imgs_path, output_dir=output_path, use_pred_mask=True, n_iter=150)
|
| 63 |
+
# rearrange_main(output_dir=output_path, rearranged_path = rearranged_path)
|
| 64 |
+
# train_main(s = rearranged_path, m = rearranged_path, iter = 2000)
|
| 65 |
+
# render_main(s = rearranged_path, m = rearranged_path, iter = 2000, get_video = True)
|
| 66 |
|
| 67 |
|
| 68 |
|