Add angle spline interpolation postprocessing pass#13
Merged
Conversation
This was referenced Apr 15, 2026
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.
Summary
This PR adds a new opt-in postprocessing pass
AngleSplineInterpolationPassthat derives bounding box heading angles by fitting a cubic spline to each vehicle's trajectory.Motivation
Existing rotation adjustment relies on frame-to-frame movement vectors, which can be noisy. Fitting a spline to the entire trajectory provides a globally smooth estimate of heading direction.
Changes
New feature:
--angle-spline-interpolation SInvoke from the CLI with
--housekeeping --angle-spline-interpolation <S>whereSis thesplprepsmoothing factor (s=0= exact interpolation, larger = smoother curve).Algorithm
scipy.interpolate.splprepscipy.interpolate.splev(der=1)atan2(dy, dx)of the tangentObjects with fewer than 4 unique positions are skipped gracefully.
Pipeline placement
Runs after
RotationAdjustmentPass(step 8b) and beforeDuplicateRemovalPass, so IoU-based duplicate detection uses the corrected angles.Provenance
The flag and smoothing value are recorded in
build_arguments_string()and captured by thedataprovprovenance chain.Files changed
pyproject.toml— addedscipy>=1.10.0to markit dependency groupmarkit/markitlib/postprocessing/_passes/angle_spline_interpolation.py— new passmarkit/markitlib/postprocessing/_passes/__init__.py,passes.py,__init__.py— exportsmarkit/run_markit.py— CLI arg, pipeline wiring, provenance trackingmarkit/markitlib/config.py— config attributemarkit/tests/test_angle_spline_interpolation.py— 16 unit testsTests
All 138 existing tests continue to pass. 16 new tests cover: straight-line, curved trajectory, stationary frame forward-fill, too-few-points skip, width/height normalisation, housekeeping tag, statistics, smoothing factor effect, multiple objects, and the deduplication helper.