(raw_depth: np.ndarray, refined_depth: np.ndarray, inference_ms: float)
| 68 | |
| 69 | |
| 70 | def 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 | |
| 88 | def trt_dtype_to_torch(dtype: Any) -> torch.dtype: |
no test coverage detected