Skip to content

Feature/gaussian point model - #22

Draft
sridhs21 wants to merge 8 commits into
mainfrom
feature/gaussian-point-model
Draft

Feature/gaussian point model#22
sridhs21 wants to merge 8 commits into
mainfrom
feature/gaussian-point-model

Conversation

@sridhs21

@sridhs21 sridhs21 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Reworks the X-point detector to train on Gaussian heatmap targets and to be
evaluated at the point level instead of per pixel. Stacked on the
hyperparameter-tuning and point-list-rework work, so it's a large PR; the
main pieces:

Gaussian heatmap model

  • --targetType gaussian places a Gaussian on each X-point (--gaussianSigma)
    instead of a dilated binary mask
  • FocalHeatmapLoss (CenterNet-style penalty-reduced focal loss) with
    --heatmapAlpha / --heatmapBeta

Point-level scoring pipeline

  • point_metrics.py: greedy 1-to-1 nearest-neighbor matching within a radius,
    plus the shared extract_peaks (connected-component NMS, one peak per blob)
  • predict_points.py: run a checkpoint, extract peaks, write per-frame
    {N}_xpts.csv with confidences
  • run_hessian_and_build_cache.py (renamed from build_transfer_cache.py):
    emits ground-truth {N}_xpts.csv from the deterministic Hessian classifier
  • backfill_xpts_csv.py: writes CSVs from already-cached frames
  • score_point_predictions.py: aggregates predicted vs ground-truth CSVs into
    per-dataset F1/precision/recall tables

Training / tuning infrastructure

  • New CLI knobs (baseChannels, posRatio, warmupEpochs, scheduler, SWA)
  • Optuna tuners, including a Gaussian-aware one that maximizes point-level F1
  • test_xpoint_transfer.py for zero-shot eval on the 5M / 10M datasets

Data

  • Second PKPM run (PKPMv2) threaded through cache build, prediction, and scoring.

Swaroop Sridhar and others added 8 commits June 17, 2026 18:23
…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
@cwsmith

cwsmith commented Aug 20, 2026

Copy link
Copy Markdown
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
sridhs21 marked this pull request as draft August 21, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants