feat(trajectory_planning): add BEV-only multi-sample trajectory scorer and shifted inference schedule#76
Open
FLagbusted wants to merge 1 commit into
Conversation
216c0bb to
a98d436
Compare
…r and shifted inference schedule Signed-off-by: Flagbusted <justthefourofus@proton.me>
a98d436 to
c5850c2
Compare
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.
PR title (Conventional Commits, per CONTRIBUTING.md semantic-pull-request check)
feat(trajectory_planning): add BEV-only multi-sample trajectory scorer and shifted inference schedule
PR body
Summary
Adds a Phase 1, training-free upgrade to the flow-matching driving policy,
scoped to exactly what was discussed in the 17/06 WG meeting: get
multi-sample scoring working against the BEV/map data we already have,
without building GoalFlow's full goal-point vocabulary + learned DAC
classifier yet (tracked separately as Phase 2).
Implements #75 .
What changed
Model/model_components/trajectory_planning/trajectory_scorer.py—
TrajectoryComplianceScorer, a zero-trainable-parameter wrapper thatdraws K samples from any
BasePlannerand re-ranks them by drivable-areacompliance (raw rasterized map pixel lookup) + kinematic comfort
(acceleration/curvature bound violations).
Model/model_components/trajectory_planning/flow_matching_planner.py— adds an optional
timestep_schedule="shifted"inference modeimplementing GoalFlow's
(alpha·t)/(1+(alpha-1)·t)timestep warp.Default (
"uniform") is byte-for-byte identical to current behaviour;this is purely additive.
Why
FlowMatchingPlanner(#40) generates one trajectory per forward call withno scoring or compliance check. GoalFlow (arXiv:2503.05689, discussed this
week) shows multi-sample generation + re-ranking meaningfully improves
both safety compliance and final score (PDMS), but its full method needs a
goal-point vocabulary and a learned BEV semantic segmentation head neither
KITScenes nor L2D currently feed into this repo. This PR takes only the
part of that idea that needs nothing new: the rasterized map image already
produced by
RasterizedMapEncoder's input pipeline (#55) is enough to do adeterministic drivable-area check without training anything.
Code snippet — usage example
Testing done
tests/test_trajectory_scorer.py) — unit-testeddecode_trajectory_to_xy,project_xy_to_bev_pixel,drivable_area_compliance,kinematic_comfort_score, andTrajectoryComplianceScorer.sample_and_scoreagainst a fake plannersatisfying the
BasePlannercontract. Shapes, OOB-point handling, bothselection modes, and the invalid-selection-mode error path all verified.
Runs on CPU with no trained model or dataset required.
KITScenes data and a trained
FlowMatchingPlannercheckpoint cannot berun for the next few days due to the contributor's machine being
unavailable. Will update this PR with ADE/quality numbers once hardware
is back — this is not blocking code or calibration review, only the
final merge decision.
project_xy_to_bev_pixelnot yetverified against the actual KITScenes/L2D renderer pixel convention.
Requesting review from whoever owns the map renderer before merge.
timestep_schedule="shifted"quality impact on a real validation split not yet measured. Only the
alpha=1.0 == uniformalgebraic identity and basic schedule shapeswere confirmed locally.
Checklist
FlowMatchingPlanner.forward()unchanged(
timestep_schedule="uniform"is the default)ruff check .passes