(
scenes: Iterable[Scene],
methods: Iterable[Method],
metrics: Iterable[Metric],
)
| 168 | |
| 169 | |
| 170 | def load_metrics( |
| 171 | scenes: Iterable[Scene], |
| 172 | methods: Iterable[Method], |
| 173 | metrics: Iterable[Metric], |
| 174 | ) -> pd.DataFrame: |
| 175 | metrics = tuple(metrics) |
| 176 | |
| 177 | data = defaultdict(list) |
| 178 | |
| 179 | for method in methods: |
| 180 | for scene in scenes: |
| 181 | # Load the scene's metrics. |
| 182 | try: |
| 183 | with ( |
| 184 | METRICS_PATH |
| 185 | / f"{METRICS_PREFIX}{method.tag}_{scene.tag}/metrics.json" |
| 186 | ).open("r") as f: |
| 187 | scene_metrics = json.load(f) |
| 188 | except FileNotFoundError: |
| 189 | scene_metrics = {} |
| 190 | |
| 191 | # Load the runtime separately. |
| 192 | try: |
| 193 | # NoPE-NeRF runtimes are different since it combines view synthesis with |
| 194 | # camera pose estimation. |
| 195 | if method == METHOD_NOPENERF: |
| 196 | with ( |
| 197 | METRICS_PATH |
| 198 | / f"{METRICS_PREFIX}{method.tag}_{scene.tag}/runtime.json" |
| 199 | ).open("r") as f: |
| 200 | scene_metrics["runtime"] = json.load(f)["runtime"] |
| 201 | else: |
| 202 | with (RESULTS_PATH / method.tag / scene.tag / "runtime.json").open( |
| 203 | "r" |
| 204 | ) as f: |
| 205 | scene_metrics["runtime"] = json.load(f)["runtime"] |
| 206 | |
| 207 | # Convert seconds to minutes. |
| 208 | scene_metrics["runtime"] = scene_metrics["runtime"] / 60 |
| 209 | except FileNotFoundError: |
| 210 | pass |
| 211 | |
| 212 | if METRIC_COLMAP_ATE in metrics: |
| 213 | if method in (METHOD_COLMAP, METHOD_MVSCOLMAP): |
| 214 | scene_metrics["ate"] = None |
| 215 | else: |
| 216 | try: |
| 217 | gt = load_trajectory(METHOD_COLMAP, scene) |
| 218 | hat = load_trajectory(method, scene) |
| 219 | scene_metrics["ate"] = compute_ate(gt, hat)[0] |
| 220 | except FileNotFoundError: |
| 221 | scene_metrics["ate"] = None |
| 222 | |
| 223 | # Select the metrics we care about. |
| 224 | for metric in metrics: |
| 225 | data["scene_tag"].append(scene.tag) |
| 226 | data["scene_full_name"].append(scene.full_name) |
| 227 |
no test coverage detected