MCPcopy Create free account
hub / github.com/Ar-Ray-code/lingbot-depth-trt / make_comparison

Function make_comparison

python/scripts/live_demo.py:70–85  ·  view source on GitHub ↗
(raw_depth: np.ndarray, refined_depth: np.ndarray, inference_ms: float)

Source from the content-addressed store, hash-verified

68
69
70def make_comparison(raw_depth: np.ndarray, refined_depth: np.ndarray, inference_ms: float) -> np.ndarray:
71 valid = np.isfinite(raw_depth) & (raw_depth > 0) & np.isfinite(refined_depth) & (refined_depth > 0)
72 if valid.any():
73 vals = np.concatenate([raw_depth[valid], refined_depth[valid]])
74 vmin = float(np.percentile(vals, 1))
75 vmax = float(np.percentile(vals, 99))
76 else:
77 vmin, vmax = 0.0, 1.0
78
79 raw_vis = depth_to_color(raw_depth, vmin=vmin, vmax=vmax)
80 refined_vis = depth_to_color(refined_depth, vmin=vmin, vmax=vmax)
81 put_label(raw_vis, "raw depth")
82 put_label(refined_vis, "refined depth")
83 comparison = np.concatenate([raw_vis, refined_vis], axis=1)
84 put_top_right_text(comparison, f"{inference_ms:.1f} ms")
85 return comparison
86
87
88def trt_dtype_to_torch(dtype: Any) -> torch.dtype:

Callers 1

run_demoFunction · 0.85

Calls 3

depth_to_colorFunction · 0.85
put_labelFunction · 0.85
put_top_right_textFunction · 0.85

Tested by

no test coverage detected