Skip to content

I-24 stitching (experimental)

This page reports the state of an open experiment: joining the trajectory fragments of I-24 MOTION into vehicles again (stitching). It is for readers who want to use, check or continue the stitching. If you only need lane labels on I-24, you do not need this page: see I-24 MOTION, which also describes the data and the preparation. To try the stitching right away, go to 8. Reproduce.

The code is trajlab.experimental.i24_stitching; its API may change, and its results are not validated like the rest of trajlab.

Every number names its windows and date. A window is a time slice of one direction (WB = westbound, EB = eastbound), 10 min long unless noted. Development means the windows of 2022-11-22 (INCEPTION v1.0) on which the method was built, calibrated and compared: seven calibration windows of 5 min and three development windows (section 3). The evaluation on 2022-11-29 was fixed in advance and run once; its rows are marked 2022-11-29.

Words for the places where pieces meet. A camera break (or hand-over, or seam) is the place along the road where one camera's view ends and the next one's begins. A link is a decision that two fragments belong to one vehicle; the point where they are joined is the joint, and the positions filled in across a gap between them are the bridge. The end of the earlier fragment is its tail, the start of the later one the head.

Parameter set: N2v3_K (the shipped parameter set; the short codes of all variants are explained in section 4), trajlab/experimental/i24_stitching/data/i24_stitching_n2v3_k.json, sha256 d44db645a75e90887074c64d60cb411dc3f54c81b488b7804473a439acd14a8e. Values identical to the file used in the evaluation; verified by bit-identical outputs.

1. Goal and starting point

  • Fragmentation. The provider delivers one fragment per camera view; the median fragment lasts 9-10 s. A vehicle crossing the 4-mile section is cut into dozens of fragments, most of them at the camera breaks.
  • Survival per camera break without stitching (median share of the tracks seen 100 m before a break that reach 100 m after it; development): WB 07:30 congested 0.17-0.34, WB 09:10 free 0.61-0.80, EB 07:30 free 0.50. Continuation across the hand-overs (a fragment ending within 60 m of a break, reaching 50 m past it): 1-2 %.
  • Lateral saw-tooth. The lateral error of each camera's mapping steps at the camera breaks by up to 3 m. Without the lateral correction per camera (called M4 in the study, described on I-24 MOTION), a lateral gate cannot tell a hand-over from a lane change, so the correction is a precondition of the stitching.

Lateral saw-tooth before and after the correction

Mean deviation of the four lane centers from their running median, westbound 2022-11-22 09:10-09:20 (development), (a) provider positions, (b) corrected with the shipped table. Dashed: camera breaks.

2. Method of the shipped parameter set (N2v3_K)

The stitching uses the cascade of trajlab.processing.stitching (StitchingStage). A cascade is a sequence of stages; each stage is one pass over all fragment ends. It describes each end by position, speed and class, gives every possible tail-head pair a cost, assigns the pairs one to one (a pair is left out if a second candidate is almost as good), and joins the pairs it keeps. A gate is a limit that a pair must not exceed to be considered at all.

Symbols: v is the speed of the tail [m/s], g the gap duration between tail and head [s], σx and σy the spread of the position difference along and across the road [m], dx, dy the offset between two cameras [m] and τ its time part [s].

  1. Overlap stage (fragments that overlap in time at a hand-over, up to 3 s): an offset per camera hand-over (dx + τ v, dy) is subtracted from the position difference. It is estimated by Theil-Sen (a line fit that takes the median of the pairwise slopes, robust to outliers) on unambiguous overlap pairs, at least 100 per seam, else pooled. Gates of 3 σx and 4 σy with σx = 0.2 + 0.13 v; a pair is ambiguous if a second candidate lies within 0.5 σ.
  2. Gap stages up to 5 s, one copy per traffic state of the tail (congested < 10 m/s, transition 10-18 m/s, free ≥ 18 m/s): acceleration envelope 2.0 / 4.0 / 1.0 m/s², lateral tolerance 1.0 + 0.4 g [m], at most 3 m.
  3. Speed gate of the gap stages: |Δv| ≤ 3 m/s + 0.25 m/s per second of gap.
  4. Neighbor prediction for free-flow tails: where the head should start is predicted from the mean displacement of the tail's leader and follower in its lane over the gap; tolerance 3.45 + 5.04 g [m] (the 95 % band of its error) instead of the envelope. This is a simple precursor of an adaptive smoothing of the speed field (Treiber & Helbing 2002); the smoothing itself is not implemented.
  5. Class as a cost term: a class mismatch adds one along-road error unit (the parameter base_x_error_m) to the cost; only a length difference of 4 m or more rejects. Neighboring cameras label one vehicle differently (on real candidate pairs 22-25 % differ by more than 0.6 m in length or 0.2 m in width; development).
  6. low_speed_link: links whose tail ends below 5 m/s are flagged; stitching in standing queues is not validated.

Preparation: run_i24motion_preparation with the shipped lateral table of the window's traffic state and the cut at the median strip; duplicates kept. Bridges: a cubic Hermite curve (a smooth curve that matches position and speed at both ends) across the gap, after trimming 1.5 s at both fragment ends.

3. How it is evaluated

  • Artificial gaps. Fragments of at least 12 s are cut with a gap drawn uniformly between 0.5 and 5 s; precision (the share of links made that are correct) and recall (the share of cuts that are re-linked) of re-linking them, per traffic state of the tail. A link to a fragment that runs parallel to the uncut original (the other camera's view of the same vehicle) counts as correct.
  • Hand-over ground truth. Unambiguous overlap pairs of two cameras within 60 m of a break, cut to gaps of 0.5-5 s. They are the easy cases: the hand-over ground truth is optimistic (its recall lies well above the real survival per break, below). In congestion only pairs with a tail speed of at least 5 m/s count: below that, the "unambiguous" overlap pairs are often not one vehicle (precision 0.07 at ≤ 1 m/s, 0.96 at 7.5-10 m/s; development).
  • Obvious pairs (label-free): a tail and a head with a gap of -3 to 5 s, the head within 5 m of the tail's extrapolation, |Δv| ≤ 1.5 m/s, the same lane, and no second candidate in the doubled window.
  • Upper bound (oracle): the share of the fragment ends at a camera break that have at least one kinematically plausible head in a later camera section within 5, 10 or 15 s.
  • Calibration rule. Per traffic state, the configuration with the highest recall among those with precision ≥ 0.95 on artificial gaps and hand-over pairs (two seeds pooled).
  • Separation. Calibration and development: 2022-11-22 (seven calibration windows of 5 min and three development windows). Evaluation: 2022-11-29, two free-flow windows (WB 09:10, EB 07:30) and the first congested westbound window between 06:30 and 08:20 (WB 06:40), chosen from the document headers only, with criteria and code fixed before any data of that day were read.

4. Measures per variant

The tables below use short codes for the variants. Each variant adds one change to the one before it:

Short code Descriptive name What it is
unstitched provider fragments the provider's fragments, not joined
M3 earlier I-24 set an earlier I-24 parameter set of the same cascade (calibrated at the Bell Road on-ramp on 2022-11-22), with a gap stage up to 11 s and offsets for gap pairs
B base I-24 offsets in the overlap stage only, dimension gate, default envelopes
N2 wide gates B without the dimension gate, envelope × 2, wide lateral tolerance, neighbor prediction in free flow
N2v3 wide gates + speed gate N2 with the speed gate
N2v3_K wide gates + speed gate + class cost N2v3 with the class as a cost term (the shipped set)
N2v3_L wide gates + speed gate + lane test N2v3 with a lane test instead of the lateral gate for gaps up to 2 s
N2v3_LK lane test + class cost N2v3_L with the class as a cost term

Ground truth, precision / recall (development: calibration and development windows of 2022-11-22, seeds 0 and 1; mix = hand-over pairs and artificial gaps up to 5 s, 1:1; congested hand-over pairs from a tail speed of 5 m/s, ¹ all hand-over pairs):

Variant Mix congested Mix transition Mix free Hand-over congested (≥ 5 m/s) Hand-over free Artificial free
N2 0.933 / 0.876 ¹ 0.975 / 0.928 0.966 / 0.862 0.948 / 0.885 0.969 / 0.844 0.962 / 0.880
N2v3 0.972 / 0.888 0.975 / 0.893 0.969 / 0.842 0.947 / 0.841 0.972 / 0.825 0.966 / 0.860
N2v3_K 0.971 / 0.889 0.975 / 0.895 0.966 / 0.845 0.948 / 0.847 0.971 / 0.833 0.962 / 0.858
N2v3_L 0.956 / 0.852 0.946 / 0.840 0.935 / 0.782 0.937 / 0.832 0.948 / 0.795 0.921 / 0.769
N2v3_LK 0.954 / 0.853 0.943 / 0.842 0.929 / 0.785 0.937 / 0.838 0.946 / 0.801 0.911 / 0.767
N2v3_K, 2022-11-29 WB 06:40 ² 0.965 / 0.902 0.974 / 0.881 0.960 / 0.834 0.928 / 0.843 0.951 / 0.826 0.972 / 0.845
N2v3_K, 2022-11-29 WB 09:10 ² 0.977 / 0.882 0.972 / 0.894 0.972 / 0.881 0.970 / 0.841 0.970 / 0.882 0.973 / 0.879
N2v3_K, 2022-11-29 EB 07:30 ² – – 0.962 / 0.839 – 0.974 / 0.828 0.951 / 0.849

² Evaluation windows: WB 06:40 is congested, WB 09:10 and EB 07:30 are free flow; – : fewer than 30 cuts. The evaluation, its criteria and its full result are on the page I-24 MOTION: N2v3_K does not meet the fixed criteria in full (the hand-over part fails in congestion at precision 0.928, the settling criterion fails in all three windows, the visual check is not met on EB 07:30 with 3 wrong links of 30).

B was calibrated on artificial gaps of 0.5-10 s (precision / recall congested 0.959 / 0.469, transition 0.950 / 0.464, free 0.971 / 0.448; on gaps up to 5 s 0.988 / 0.916, 0.986 / 0.908, 0.987 / 0.844). M3 on the same corrected positions: precision 0.947 / 0.935 in westbound congestion. A trial run of the procedure on 2022-11-22 EB 09:00-09:05 (free flow) gave N2v3_K 0.950 / 0.811 on artificial gaps and 0.951 / 0.772 at the hand-overs.

Label-free measures (development, 2022-11-22; pipeline runs of the whole window):

Measure, window unstitched M3 B N2 N2v3 N2v3_K
obvious pairs linked, all three windows – – 0.614 0.830 0.830 0.859
obvious pairs linked, WB 07:30 / WB 09:10 / EB 07:30 – – 0.69 / 0.60 / 0.43 0.87 / 0.83 / 0.72 0.87 / 0.83 / 0.72 0.90 / 0.86 / 0.75
|a| > 4 m/s² samples per vehicle-km, WB 07:30 0.008 0.153 0.100 0.389 0.143 –
|a| > 4 m/s² samples per vehicle-km, WB 09:10 / EB 07:30 0.011 / 0.004 0.029 / 0.035 0.022 / 0.034 0.069 / 0.110 – –
unexplained leader changes per vehicle-km, WB 07:30 0.230 0.231 0.189 0.238 0.199 –
unexplained leader changes per vehicle-km, WB 09:10 / EB 07:30 0.018 / 0.046 0.020 / 0.045 0.016 / 0.036 0.018 / 0.042 – –
joints with |Δa| > 3 m/s², WB 07:30 / WB 09:10 / EB 07:30 – 2.9 / 30 / 20 % 0.4 / 1.3 / 0.6 % 0.7 / 1.2 / 1.1 % – –

N2v3_L and N2v3_LK link more obvious pairs (0.878 and 0.912 over all windows) but fall below precision 0.95 in free flow and transition. N2v3_K was not measured over whole development windows; its outliers and leader changes over the whole window come from the evaluation:

Label-free measures of the evaluation (2022-11-29, pipeline runs of the whole window, unstitched / N2v3_K / M3):

Measure WB 06:40 (congested) WB 09:10 (free) EB 07:30 (free)
|a| > 4 m/s² samples per vehicle-km 0.008 / 0.147 / 0.114 0.013 / 0.081 / 0.069 0.014 / 0.046 / 0.031
jerk above the unstitched p99.9, samples per vehicle-km 3.2 / 8.3 / 10.3 1.0 / 6.8 / 10.4 0.3 / 6.4 / 8.3
unexplained leader changes per vehicle-km 0.310 / 0.316 / 0.340 0.120 / 0.102 / 0.114 0.050 / 0.040 / 0.042
links 0 / 11 693 / 10 330 0 / 8 553 / 6 451 0 / 4 378 / 2 514
continuation across the hand-overs 0.021 / 0.376 / 0.325 0.019 / 0.460 / 0.354 0.014 / 0.392 / 0.235
joints with |Δa| > 3 m/s² – / 0.4 % / 2.4 % – / 0.7 % / 10.6 % – / 0.7 % / 22.1 %
edge_settling share 0.174 / 0.113 / 0.119 0.210 / 0.120 / 0.139 0.296 / 0.183 / 0.231

The stitched runs have more acceleration and jerk outliers per vehicle-km than the unstitched runs (N2v3_K 0.046-0.147 against 0.008-0.014 samples with |a| > 4 m/s²; slightly more than M3); the joints themselves stay smooth. The outliers come from links with large speed differences, which the pipeline's reconstruction turns into long braking or acceleration phases.

Survival per camera break (median; development, then the evaluation):

Window, traffic state unstitched N2v3_K
2022-11-22 WB 07:30, congested 0.17-0.34 0.50-0.70
2022-11-22 WB 09:10, free 0.61-0.80 0.77-0.86
2022-11-22 EB 07:30, free 0.50 0.70
2022-11-29 WB 06:40, whole window (median over 33 breaks) 0.23 0.53
2022-11-29 WB 06:40, congested / transition / free ³ 0.18 / 0.21 / 0.35 0.40 / 0.51 / 0.60
2022-11-29 WB 09:10, whole window (median over 40 breaks) 0.51 0.72
2022-11-29 WB 09:10, congested / transition / free ³ 0.31 / 0.36 / 0.45 0.51 / 0.61 / 0.72
2022-11-29 EB 07:30, whole window (median over 37 breaks) 0.52 0.70
2022-11-29 EB 07:30, free ³ 0.44 0.68

The 2022-11-22 ranges are the medians over the road sections between coverage holes. ³ By the traffic state of the track before the break, pooled over all breaks; this split was computed after the evaluation from its outputs and is reported only (EB 07:30 has too few congested and transition tracks). A scene of 3-4 vehicles over 1-3 breaks needs about 0.98. The hand-over ground truth (recall 0.83-0.88 on 2022-11-29) is far more optimistic than this survival.

Survival per camera break

Survival per camera break along the road, 2022-11-22 development windows WB 07:30 (congested), WB 09:10 and EB 07:30 (free flow), unstitched (circles) and N2v3_K (triangles, parameter sha256 d44db645…). Dashed: 0.98.

Time-space diagram, unstitched and N2v3_K

Lane 2 over 1 km and 150 s, starting 240 s after the window start, 2022-11-22 WB 09:10 (development), (a) unstitched, (b) N2v3_K (parameter sha256 d44db645…); crosses mark the joints.

5. What did not help

All on the development windows of 2022-11-22.

  • A lane rule as an additional filter (a pair only within one lane, or into the neighboring lane with lateral motion towards it): recall lower by 0.3-3.4 points at equal precision in every state. The lateral gates are already below a lane width; the rule only removed correct links near a lane boundary.
  • Platoon order (a head must lie between the tail's leader and follower in its lane): congested hand-over precision 0.826 → 0.830, recall unchanged.
  • Occlusion by long vehicles: a vehicle longer than 8 m within ±10 m on the camera side was next to 10.6 / 7.9 / 5.2 % of the fragment ends (congested / transition / free) and to 11.9 / 9.7 / 5.5 % of random interior points: no elevation at the ends.
  • A camera offset per pair across a hand-over only (offsets for gap pairs only if tail and head lie in different camera sections): ground truth within noise; on EB more obvious pairs left unlinked (34 % against 28 %).
  • Hand-over offsets for all gap pairs: they shift continuations within one camera by 2-3 m at free-flow speed; free-flow recall on gaps up to 5 s 0.65 against 0.84 with the offsets in the overlap stage only.
  • A lane test instead of the lateral gate (variant L, for gaps up to 2 s): links more obvious pairs, but precision below 0.95 in free flow (0.935) and transition (0.946).
  • Longer gaps. Gap limits of 8-10 s: the extra links have precision 0.58-0.87. Longer gaps only where unique: 0.72 / 0.51 / 0.84 (congested / transition / free). A joint assignment of the ends beyond 5 s (exact min-cost matching with position, speed, length, lateral position, platoon order and lane balance): best precision 0.79-0.90 at recall 0.16-0.22.
  • Trimming the fragment ends before the gates (1.0 or 1.5 s, against the settling): mix precision 0.88-0.92 at recall 0.81-0.90.
  • A kinematic veto (undo links with a rough joint): the |a| > 4 m/s² outliers of N2 do not lie at the joints (18 % within 2 s of a bridge, the same as the share of all samples there); they come from links with large speed jumps, which the speed gate of N2v3 addresses.

First rejecting test of the obvious pairs left unlinked

Obvious pairs left unlinked by B, N2 and N2v3_K, by the first test that rejects them, 2022-11-22 development windows WB 07:30, WB 09:10 and EB 07:30 (N2v3_K: parameter sha256 d44db645…). "Lateral" is mostly the settling of the tail's lateral position in its last 1-2 s.

6. Upper bound and causes

Oracle (development): share of the fragment ends at a break with a candidate within 5 / 10 / 15 s, and linked:

Window, state (tails) ≤ 5 s ≤ 10 s ≤ 15 s linked by B linked by N2 N2 linked among those with a candidate ≤ 5 s
WB 07:30 congested (7 559) 0.43 0.62 0.72 0.24 0.36 0.83
WB 07:30 transition (7 054) 0.67 0.80 0.84 0.38 0.51 0.76
WB 07:30 free (3 382) 0.62 0.72 0.74 0.31 0.51 0.81
WB 09:10 free (10 994) 0.71 0.80 0.84 0.34 0.54 0.75
EB 07:30 free (8 684) 0.67 0.77 0.82 0.23 0.46 0.69

Upper bound and linked share

Share of the fragment ends at a camera break with a plausible head within 5, 10 and 15 s (bars) and the share linked by B and N2, 2022-11-22 development windows.

Ambiguity is the limit. Of the fragment ends that N2v3_K leaves unlinked, 77-88 % have a kinematically plausible partner within 15 s (development: WB 07:30 0.88, WB 09:10 0.77, EB 07:30 0.83). Vehicles do not vanish for 15 s; the partners are there but cannot be told apart: 56-58 % of the unlinked tails have no candidate within 5 s, and no assignment of the longer gaps reached precision 0.95.

Causes of the ends without a candidate within 15 s (development, unfiltered provider fragments as reference):

Cause Tails Heads
exit to or entry from a ramp 15-27 % 35-51 %
successor just outside the speed or position gate (1.4-1.8 gate widths) 36-46 % 20-32 %
the fitting fragment continues another vehicle 12-15 % 16-21 %
unexplained 13-18 % 6-9 %
identity swap with a neighbor 3-4 % 2-3 %
data hole ≤ 3 % ≤ 3 %
removed by the preparation ≤ 4 % ≤ 4 %

Tracks that begin or end inside camera sections. In congestion (WB 07:30, development) the ends inside the sections dominate; long vehicles (> 8 m) are 29-45 % of the tails inside sections, 2.2-2.7 times their share of all fragments, so they fragment inside the sections, probably in the provider's tracker.

7. Open problems and starting points

  • Disambiguation beyond 5 s. A min-cost flow over gaps up to 15 s with gap-dependent spreads per camera pair, the class and the order in the lane as side conditions; the provider's own reconstruction formulates the association as a min-cost network flow (Wang et al. 2024). Expected gain on the development data: +0.05-0.10 precision, not 0.95.
  • The settling at the fragment ends. About 45 % of the obvious pairs left unlinked are rejected laterally at an end whose lateral position drifts away in its last 1-2 s: an end state taken from the samples before the settling, for the gates only, is untested.
  • Survival at the worst breaks. Survival falls to 0.20-0.31 at single breaks (WB 07:30 at 4 695, 2 425, 5 425 m; EB at 6 805 m; development): the offsets and gates there need a look of their own.
  • Long vehicles inside camera sections need a link with a length gate and a ground truth of their own.
  • Standing queues are not validated (hand-over ground truth only from 5 m/s; links flagged low_speed_link).
  • Analyses without stitching. For travel times, speed fields and other aggregate questions, virtual trajectories integrated through the smoothed speed field avoid the fragmentation altogether (Ji et al. 2024).

8. Reproduce

from trajlab.datasets import i24

folder = i24.read_i24motion_day(
    "I24MOTION/11-22-2022.zip", "2022-11-22 09:10", "2022-11-22 09:20", out_dir="windows/wb_0910", direction=-1
)
window = i24.read_i24motion_window(folder, -1)
result = i24.run_i24motion(window, "i24_motion", options=i24.I24MotionOptions(stitching="experimental"))
print(result.links)  # link records per stage; result.low_speed_links: the flag per link

Or in the preset: dataset: {stitching: experimental}. The script examples/i24/run_window.py --stitching experimental runs a window end to end. The parameter file is trajlab/experimental/i24_stitching/data/i24_stitching_n2v3_k.json (sha256 above); the figures are drawn by docs/scripts/make_i24_stitching_figures.py from the outputs of such runs.

References

  • Gloudemans, D., Wang, Y., Ji, J., Zachár, G., Barbour, W., Hall, E., Cebelak, M., Smith, L., & Work, D. B. (2023). I-24 MOTION: An instrument for freeway traffic science. Transportation Research Part C: Emerging Technologies, 155, 104311. doi:10.1016/j.trc.2023.104311
  • Ji, J., Wang, Y., Gloudemans, D., Zachár, G., Barbour, W., & Work, D. B. (2024). Virtual trajectories for I-24 MOTION: Data and tools. Forum for Innovative Sustainable Transportation Systems (FISTS). arXiv:2311.10888
  • Treiber, M., & Helbing, D. (2002). An adaptive smoothing method for traffic state identification from incomplete information. Preprint, arXiv:cond-mat/0210050.
  • Wang, Y., Gloudemans, D., Ji, J., Teoh, Z. N., Liu, L., Zachár, G., Barbour, W., & Work, D. (2024). Automatic vehicle trajectory data reconstruction at scale. Transportation Research Part C: Emerging Technologies, 160,
  • doi:10.1016/j.trc.2024.104520