Stereo_Depth / dataset /baselines.py
LLDDSS's picture
Upload folder using huggingface_hub
18104f9 verified
Raw History Blame Contribute Delete
925 Bytes
"""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()}