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

Function get_thresholds_and_weights

src/depth_pro/eval/boundary_metrics.py:224–242  ·  view source on GitHub ↗

Generate thresholds and weights for the given range. Args: ---- t_min (float): Minimum threshold. t_max (float): Maximum threshold. N (int): Number of thresholds. Returns: ------- Tuple[np.ndarray, np.ndarray]: Array of thresholds and corresponding w

(
    t_min: float, t_max: float, N: int
)

Source from the content-addressed store, hash-verified

222
223
224def get_thresholds_and_weights(
225 t_min: float, t_max: float, N: int
226) -> Tuple[np.ndarray, np.ndarray]:
227 """Generate thresholds and weights for the given range.
228
229 Args:
230 ----
231 t_min (float): Minimum threshold.
232 t_max (float): Maximum threshold.
233 N (int): Number of thresholds.
234
235 Returns:
236 -------
237 Tuple[np.ndarray, np.ndarray]: Array of thresholds and corresponding weights.
238
239 """
240 thresholds = np.linspace(t_min, t_max, N)
241 weights = thresholds / thresholds.sum()
242 return thresholds, weights
243
244
245def invert_depth(depth: np.ndarray, eps: float = 1e-6) -> np.ndarray:

Callers 2

SI_boundary_F1Function · 0.85
SI_boundary_RecallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected