MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / depth_mae

Function depth_mae

scripts/worldmirror/compare_to_reference.py:128–150  ·  view source on GitHub ↗

Return list of (filename, mae, ok) per depth_XXXX.npy pair.

(ref_dir: Path, cand_dir: Path)

Source from the content-addressed store, hash-verified

126
127
128def depth_mae(ref_dir: Path, cand_dir: Path):
129 """Return list of (filename, mae, ok) per depth_XXXX.npy pair."""
130 out = []
131 ref_files = sorted((ref_dir / "depth").glob("depth_*.npy"))
132 cand_dir_depth = cand_dir / "depth"
133 for rf in ref_files:
134 cf = cand_dir_depth / rf.name
135 if not cf.exists():
136 out.append((rf.name, None, False))
137 continue
138 a = np.load(rf).astype(np.float64)
139 b = np.load(cf).astype(np.float64)
140 if a.shape != b.shape:
141 out.append((rf.name, float("nan"), False))
142 continue
143 # Ignore NaNs symmetrically.
144 mask = np.isfinite(a) & np.isfinite(b)
145 if not mask.any():
146 out.append((rf.name, 0.0, True))
147 continue
148 mae = float(np.mean(np.abs(a[mask] - b[mask])))
149 out.append((rf.name, mae, mae < MAE_THRESHOLD))
150 return out
151
152
153def png_u8_mae(ref_dir: Path, cand_dir: Path, subdir: str, prefix: str):

Callers 1

mainFunction · 0.85

Calls 2

appendMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected