Feature/gaussian point model - #22
Open
sridhs21 wants to merge 11 commits into
Open
Conversation
…w, col, class columns for X/Omax/Omin points), with a backfill pass that writes CSVs for already-cached frames without re-running the classifier.
…d truth at the point level. match_points takes two coordinate arrays and a matching radius, builds a grid index on the gt side, and does greedy 1-to-1 nearest-neighbor matching to figure out tp/fp/fn (with optional confidence ordering so high-confidence preds claim matches first). evaluate_point_predictions runs that across many frames and gives back a global summary plus per-frame metrics. load_xpts_csv and load_xpts_csvs_for_frames are tiny helpers for reading the CSV format the cache builder emits.
…oint-list CSVs onto disk. backfill_xpts_csv.py walks a cache directory and writes per-frame {N}_xpts.csv files from existing {N}_xpts.npy plus optsMax/optsMin files, with an --output-dir flag for cases where the source cache isn't writable (like the PKPM cache, which is owned by another user). predict_points.py loads a trained checkpoint, runs inference over the cached frames of a dataset, post-processes the predicted heatmap with connected-component NMS to extract one peak per blob above threshold, then writes the predicted points as per-frame CSVs with row/col/confidence columns. Between them they cover both sides of the comparison: ground-truth points from the deterministic classifier, and predicted points from a neural net.
…st scoring together. Takes a predictions root directory (subdirs per dataset), loads the predicted xpts CSVs with their confidences plus the matching ground-truth CSVs from the per-dataset cache mirror, and runs evaluate_point_predictions from point_metrics on each dataset. Prints a per-dataset F1/precision/recall/TP/FP/FN table for the given checkpoint, and optionally writes the full per-frame breakdown to JSON via --json-out. Takes --radius and --datasets flags so you can tweak the matching radius or pick which subset of datasets to score without editing the script. Together with predict_points.py this closes the loop from checkpoint through NMS extraction through point-level comparison.
…tmapLoss, --gaussianSigma/--targetType/--heatmap* args) onto the point-list branch so a single working tree can both train at varying sigma and score with the point-list metric, for the sigma sweep experiment.
…PKPM run through cache build, prediction, and scoring
Contributor
|
Thank you. With the change to the model, are there changes needed in the top level README (e.g., new command line args, etc.)? |
sridhs21
marked this pull request as draft
August 21, 2026 17:17
sridhs21
force-pushed
the
feature/gaussian-point-model
branch
from
September 4, 2026 17:01
d5979f1 to
074899a
Compare
…instead of hardcoding them
sridhs21
force-pushed
the
feature/gaussian-point-model
branch
from
September 4, 2026 17:11
074899a to
deb3d38
Compare
… config is scored at its own best cutoff
…, and RC_* path variables in the README
sridhs21
marked this pull request as ready for review
September 11, 2026 13:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks the X-point detector to train on Gaussian heatmap targets and evaluates it at the point level instead of per pixel. The hyperparameter-tuning work this branch was originally stacked on has since merged in #21, so this PR now contains only the point-level and Gaussian changes.
Gaussian heatmap model (
XPointMLTest.py)--targetType gaussianrenders each ground-truth X-point as a 2D Gaussian peak (--gaussianSigma, default 3) instead of the dilated 9×9 binary mask;binaryis still the default--lossFunction heatmap_focal: CornerNet/CenterNet-style penalty-reduced focal loss, with--heatmapAlpha/--heatmapBetaPoint-level evaluation
point_metrics.py:extract_peaks(vectorized connected-component NMS, one peak per region above the threshold) andmatch_points(greedy one-to-one matching within a radius, highest confidence first), plus aggregation over framesrun_hessian_and_build_cache.py: also writes a ground-truth{N}_xpts.csv(row, col, class) for every cached framebackfill_xpts_csv.py: writes those CSVs for caches built earlier, with--output-dirfor caches that aren't writablepredict_points.py: runs a checkpoint over cached frames and writes per-frame predicted{N}_xpts.csvfiles with confidencesscore_point_predictions.py: matches predictions to ground truth and reports F1 / precision / recall / TP / FP / FN per datasetTuning
optuna_tuner_gaussian.py: Optuna tuner for the Gaussian model that maximizes point-level F1 on the validation frames rather than minimizing validation loss--threshold-grid) instead of being fixed at 0.3, so every configuration is scored at its own best operating point; the winning threshold is recorded per trialData and configuration
PKPMv2) supported in cache building, prediction, and scoringpredict_points.pyandscore_point_predictions.pyare built fromRC_EXTRACT_DIR/RC_CACHE_BASE/RC_PKPM_V0_ROOT(the same convention asrun_hessian_and_build_cache.py), with the shared DeltaAI locations as defaults, so launchers can point them at another environment without code changestest_xpoint_transfer.py:THRESHOLDenvironment variable for the pixel-level transfer evaluationREADME