Skip to content

Improve precision of lane attribution - #585

Open
vcharraut wants to merge 6 commits into
3.0from
vcha/lane-selection
Open

vcharraut wants to merge 6 commits into
3.0from
vcha/lane-selection

Conversation

@vcharraut

@vcharraut vcharraut commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

What

Improve lane attribution at intersections and between opposing lanes, while reducing frame-to-frame lane flicker.

Replace the linear distance/heading score and topology-dependent switching costs with a vehicle-axis fit:

fit = distance_to_segment²
    + (vehicle_length / 2)² × sin²(heading_difference)
    + (vehicle_width / 2)² × (1 − cos(heading_difference)) / 2

The axis term distinguishes crossing lanes while treating forward and reverse headings as parallel to the same lane. The smaller direction term resolves nearby opposing lanes without dominating physical proximity.

  • Preserve finite-segment projection, the three-vehicle-width search cutoff, and interpolated height filtering.
  • Add 0.35 × (vehicle_width / 2)² when switching away from an existing lane. This stabilizes near-equal candidates; an ineligible previous lane cannot remain selected.
  • Keep one best candidate in one segment scan. Remove topology lookups and four obsolete selection-weight/switching constants; no candidate groups, timers, or new agent state.

How

This PR has been totally made via LLM. I created a benchmark to quantify the current score of the lane selection algorithm and asked a LLM to improve it.

Benchmark and methodology

  • Dataset: 330 deterministic poses on CARLA Town10HD, selected across 17 categories from a 2,040-case generator. Coverage includes aligned/ambiguous intersections, opposite and perpendicular headings, lateral offsets, parallel/opposing lane boundaries, lane history/transitions, off-lane poses, and vertical separation.
  • Challenging boundary cases: 25 poses at a 40/60 split between parallel lane centers, 25 at 30/70, and 30 positioned 70% toward an opposing lane while facing along the farther lane.
  • Reproducibility: x/y perturbations are uniform in [-0.25, 0.25] m with seed 20260808. Vehicles are 4.5 m long, 2 m wide, and evaluated at 10 m/s.
  • Ground truth: human annotations specify acceptable lane IDs and a wrong-way flag. Multiple lane IDs may be accepted for an ambiguous pose. Annotation images display lane IDs and direction arrows without the selector output; the generator does not assign expected lanes.

Before / after results

Metric Previous Latest Change
Lane accuracy 80.30% (265/330) 93.64% (309/330) +13.33 pp
Wrong-way accuracy 84.24% (278/330) 97.27% (321/330) +13.03 pp
Combined accuracy 78.48% (259/330) 91.52% (302/330) +13.03 pp
Weighted global score 78.33% 91.77% +13.44 pp

Lane accuracy accepts any human-listed lane ID. Wrong-way accuracy compares the annotated flag with the selected lane's heading (cos(heading_difference) < 0 above 2.5 m/s). Combined accuracy requires both to be correct.

The weighted score is sum(case_weight × combined_correct) / sum(case_weight): all between_* cases have weight 1.2, ambiguous intersections 0.95, and other cases 1.0. Percentage-point changes use unrounded values.

Largest lane-accuracy gains:

Category Previous Latest
Between opposing lanes, 70/30 8/30 27/30
Ambiguous intersections 5/25 18/25
Opposite heading 33/40 40/40
Between parallel lanes, 30/70 23/25 25/25

On combined correctness, 46 cases improve and 3 regress: intersection_000_ambiguous, perpendicular_lane_97, and offset_left_lane_167.

Intersection stability

A separate temporal ablation replays 50 intersection poses for 20 frames each, alternates position by ±2 cm and heading by ±0.5°, and feeds the selected lane back into the next frame.

  • Vehicle-axis fit without hysteresis: 114 lane switches across 6 flickering cases.
  • Vehicle-axis fit with the latest switching margin: 0 switches.

This comparison isolates the switching margin within the new algorithm; it is not the old-versus-new static benchmark. Increasing the coefficient from 0.25 to 0.35 leaves all 330 static result rows unchanged.

@vcharraut vcharraut changed the title Change lane selection Improve precision of lane attribution Sep 2, 2026
@vcharraut
vcharraut marked this pull request as ready for review September 14, 2026 16:00
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.

1 participant