File size: 925 Bytes
18104f9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """Canonical naming for the stereo baselines swept in this experiment.
The generated views are stored under directory names that are NOT spelled
consistently across the tree ("0.10" vs "0.2"), and the annotation files use a
third spelling again ("0.20" for the correspondence, "0.2" for the image). All
of that is normalised here to a single canonical key: the baseline formatted
with two decimals ("0.00", "0.05", "0.10", "0.15", "0.20", "0.25"), which is
also what the result directories and the analysis are keyed by.
"""
BASELINES = ["0.00", "0.05", "0.10", "0.15", "0.20", "0.25"]
def canonical(baseline):
"""Any spelling of a baseline ("0", 0.2, "0.20", "0.2/") -> "0.20"."""
return f"{float(str(baseline).strip().strip('/')):.2f}"
def by_baseline(mapping):
"""Re-key a {baseline_spelling: value} dict by the canonical baseline."""
return {canonical(key): value for key, value in mapping.items()}
|