skills/cv/hungarian-matching-detection-eval/SKILL.md
Evaluates 3D object detection by matching predicted and ground-truth coordinates via the Hungarian algorithm, then computing F-beta score.
npx skillsauth add wenmin-wu/ds-skills cv-hungarian-matching-detection-evalInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Standard IoU-based metrics don't work for point-based 3D detections (particle picking, cell centers). Instead, compute a distance matrix between predicted and ground-truth coordinates, solve the optimal 1-to-1 assignment with the Hungarian algorithm, then count matches within a distance threshold to compute precision, recall, and F-beta.
from scipy.optimize import linear_sum_assignment
from scipy.spatial.distance import cdist
import numpy as np
def fbeta_score(pred_coords, gt_coords, threshold=10.0, beta=4.0):
if len(pred_coords) == 0 and len(gt_coords) == 0:
return 1.0
if len(pred_coords) == 0 or len(gt_coords) == 0:
return 0.0
dist = cdist(pred_coords, gt_coords)
row_ind, col_ind = linear_sum_assignment(dist)
tp = sum(dist[r, c] <= threshold for r, c in zip(row_ind, col_ind))
fp = len(pred_coords) - tp
fn = len(gt_coords) - tp
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
recall = tp / (tp + fn) if (tp + fn) > 0 else 0
denom = (beta**2 * precision + recall)
return (1 + beta**2) * precision * recall / denom if denom > 0 else 0
cdistlinear_sum_assignment (Hungarian)data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF