()
| 44 | |
| 45 | |
| 46 | def main() -> None: |
| 47 | args = parse_args() |
| 48 | |
| 49 | datasets: dict[str, type[Dataset]] = { |
| 50 | "eth3d": DatasetETH3D, |
| 51 | "blended-mvs": DatasetBlendedMVS, |
| 52 | "imc2023": DatasetIMC2023, |
| 53 | "imc2024": DatasetIMC2024, |
| 54 | } |
| 55 | |
| 56 | metrics = {} |
| 57 | for dataset_name in args.datasets: |
| 58 | if dataset_name not in datasets: |
| 59 | pycolmap.logging.error(f"Unknown dataset: {dataset_name}") |
| 60 | return |
| 61 | |
| 62 | pycolmap.logging.info(f"Evaluating dataset: {dataset_name}") |
| 63 | |
| 64 | dataset = datasets[dataset_name]( |
| 65 | data_path=args.data_path, |
| 66 | categories=args.categories, |
| 67 | scenes=args.scenes, |
| 68 | run_path=args.run_path, |
| 69 | run_name=args.run_name, |
| 70 | ) |
| 71 | |
| 72 | scene_infos = dataset.list_scenes() |
| 73 | |
| 74 | if args.fast: |
| 75 | scene_infos = filter_smallest_scenes_per_category( |
| 76 | scene_infos, args.fast_num_scenes |
| 77 | ) |
| 78 | |
| 79 | if not scene_infos: |
| 80 | pycolmap.logging.warning("No scenes found") |
| 81 | return |
| 82 | |
| 83 | metrics[dataset_name] = process_scenes( |
| 84 | args=args, |
| 85 | scene_infos=scene_infos, |
| 86 | prepare_scene=dataset.prepare_scene, |
| 87 | position_accuracy_gt=dataset.position_accuracy_gt, |
| 88 | ) |
| 89 | |
| 90 | pycolmap.logging.info("Results:\n" + create_result_table(metrics)) |
| 91 | |
| 92 | report_path = args.run_path / args.run_name / (args.report_name + ".pkl") |
| 93 | pycolmap.logging.info(f"Saving report to: {report_path}") |
| 94 | with open(report_path, "wb") as report_file: |
| 95 | pickle.dump(metrics, report_file) |
| 96 | |
| 97 | |
| 98 | if __name__ == "__main__": |
no test coverage detected