MCPcopy
hub / github.com/apple/ml-depth-pro / SI_boundary_F1

Function SI_boundary_F1

src/depth_pro/eval/boundary_metrics.py:262–292  ·  view source on GitHub ↗

Calculate Scale-Invariant Boundary F1 Score for depth-based ground-truth. Args: ---- predicted_depth (np.ndarray): Predicted depth matrix. target_depth (np.ndarray): Ground truth depth matrix. t_min (float, optional): Minimum threshold. Defaults to 1.05. t_ma

(
    predicted_depth: np.ndarray,
    target_depth: np.ndarray,
    t_min: float = 1.05,
    t_max: float = 1.25,
    N: int = 10,
)

Source from the content-addressed store, hash-verified

260
261
262def SI_boundary_F1(
263 predicted_depth: np.ndarray,
264 target_depth: np.ndarray,
265 t_min: float = 1.05,
266 t_max: float = 1.25,
267 N: int = 10,
268) -> float:
269 """Calculate Scale-Invariant Boundary F1 Score for depth-based ground-truth.
270
271 Args:
272 ----
273 predicted_depth (np.ndarray): Predicted depth matrix.
274 target_depth (np.ndarray): Ground truth depth matrix.
275 t_min (float, optional): Minimum threshold. Defaults to 1.05.
276 t_max (float, optional): Maximum threshold. Defaults to 1.25.
277 N (int, optional): Number of thresholds. Defaults to 10.
278
279 Returns:
280 -------
281 float: Scale-Invariant Boundary F1 Score.
282
283 """
284 assert predicted_depth.ndim == target_depth.ndim == 2
285 thresholds, weights = get_thresholds_and_weights(t_min, t_max, N)
286 f1_scores = np.array(
287 [
288 boundary_f1(invert_depth(predicted_depth), invert_depth(target_depth), t)
289 for t in thresholds
290 ]
291 )
292 return np.sum(f1_scores * weights)
293
294
295def SI_boundary_Recall(

Callers

nothing calls this directly

Calls 3

boundary_f1Function · 0.85
invert_depthFunction · 0.85

Tested by

no test coverage detected