| 33 | |
| 34 | |
| 35 | def get_args_parser(): |
| 36 | parser = argparse.ArgumentParser() |
| 37 | parser.add_argument("--dataset", type=str, required=True, help="visloc dataset to eval") |
| 38 | parser_weights = parser.add_mutually_exclusive_group(required=True) |
| 39 | parser_weights.add_argument("--weights", type=str, help="path to the model weights", default=None) |
| 40 | parser_weights.add_argument("--model_name", type=str, help="name of the model weights", |
| 41 | choices=["MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric"]) |
| 42 | |
| 43 | parser.add_argument("--confidence_threshold", type=float, default=1.001, |
| 44 | help="confidence values higher than threshold are invalid") |
| 45 | parser.add_argument('--pixel_tol', default=5, type=int) |
| 46 | |
| 47 | parser.add_argument("--coarse_to_fine", action='store_true', default=False, |
| 48 | help="do the matching from coarse to fine") |
| 49 | parser.add_argument("--max_image_size", type=int, default=None, |
| 50 | help="max image size for the fine resolution") |
| 51 | parser.add_argument("--c2f_crop_with_homography", action='store_true', default=False, |
| 52 | help="when using coarse to fine, crop with homographies to keep cx, cy centered") |
| 53 | |
| 54 | parser.add_argument("--device", type=str, default='cuda', help="pytorch device") |
| 55 | parser.add_argument("--pnp_mode", type=str, default="cv2", choices=['cv2', 'poselib', 'pycolmap'], |
| 56 | help="pnp lib to use") |
| 57 | parser_reproj = parser.add_mutually_exclusive_group() |
| 58 | parser_reproj.add_argument("--reprojection_error", type=float, default=5.0, help="pnp reprojection error") |
| 59 | parser_reproj.add_argument("--reprojection_error_diag_ratio", type=float, default=None, |
| 60 | help="pnp reprojection error as a ratio of the diagonal of the image") |
| 61 | |
| 62 | parser.add_argument("--max_batch_size", type=int, default=48, |
| 63 | help="max batch size for inference on crops when using coarse to fine") |
| 64 | parser.add_argument("--pnp_max_points", type=int, default=100_000, help="pnp maximum number of points kept") |
| 65 | parser.add_argument("--viz_matches", type=int, default=0, help="debug matches") |
| 66 | |
| 67 | parser.add_argument("--output_dir", type=str, default=None, help="output path") |
| 68 | parser.add_argument("--output_label", type=str, default='', help="prefix for results files") |
| 69 | return parser |
| 70 | |
| 71 | |
| 72 | @torch.no_grad() |