trajectory.png,trajectory.mp4— Part A (required): ego vehicle's ground-plane trajectory, using the traffic light as the sole world reference.output/bev_partb.png,output/bev_partb.mp4— Part B (optional): ego-frame BEV also tracking the golf cart and barrels.output/debug_bbox_overlay_*.png,output/raw_distance_bearing.png,output/ego_trajectory.csv— sanity-check artifacts (see Validation).src/wa_cv/— pipeline code;scripts/run_part_a.py/run_part_b.py— entry points;tests/test_geometry.py— a synthetic round-trip unit test.
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# place the challenge dataset at ./dataset/ (rgb/, xyz/, and the bbox csv)
python3 scripts/run_part_a.py # -> trajectory.png, trajectory.mp4
python3 scripts/run_part_b.py # -> output/bev_partb.{png,mp4} (optional)
python3 tests/test_geometry.py # unit testsNo OpenCV or system ffmpeg is required — video export uses
imageio-ffmpeg's bundled binary; all array/image work is numpy/scipy/Pillow
(OpenCV wheels weren't reliably available for the dev machine's Python).
The delivered dataset differs from the write-up in ways the code detects
rather than assumes: files are left######.png / depth######.npz (not
frame_####.*), the npz key is "xyz" with a redundant 4th validity-flag
channel, and the CSV is frame,x1,y1,x2,y2. Depth (xyz/) is only present
for frames 149–298 of a 0–298 sequence, with further internal gaps (123 of
150) — the pipeline derives the usable frame set from disk instead of
assuming full coverage.
- Locate the light in 3D per frame: bbox-center pixel → sample a small patch around it in that frame's depth array (radius adaptive to bbox size) → drop invalid points (NaN/Inf/non-positive forward distance) → per-axis median of what's left (robust to occasional bad pixels).
- Clean the series: linearly interpolate frames with zero valid points; flag depth-glitch outliers via rolling median/MAD on distance-to-light. The raw signal is very smooth (near-monotonic, cm-scale jitter) — an early MAD-only check false-flagged 11/123 clean frames because a rolling median collapses to ~0 on a smooth trend; adding a 1.5 m absolute floor fixed it (final run: 0 outliers).
- Build the world frame:
alpha = atan2(Y_0, X_0)from the first usable frame's light bearing; rotate every frame's (forward, right) offset by that one fixed angle (frame 0 lands exactly on +X, per spec); flip sign for world-Y = left; invert (light pinned at origin, soego = origin − offset). This run: anchor frame 149,alpha = 6.73°. - Plot: equal-aspect, colored by frame order, light at the origin.
Key assumption: car heading is constant over the clip. One fixed landmark gives 2 numbers (range + bearing) per frame, but pose has 3 unknowns (x, y, heading) — underdetermined without an extra assumption, and the challenge's own tolerance for jitter signals this is the intended scope. A bearing-rate/constant-curvature estimator could recover approximate heading but amplifies noise from already-noisy data; left as future work.
Result: 123 usable frames (149–298, ≈5.0 s of the ~10 s clip — depth isn't available earlier). A near-straight ~20 m approach with a mild ~1.5 m leftward drift, matching manually spot-checked range/bearing (light distance drops smoothly 18.4 m → 8.2 m).
Stays in the ego frame (fixed at origin, no rotation needed — spec allows this simplification here).
- Barrels: HSV orange threshold + connected-component centroids, run every frame (apparent offset from the moving ego changes even though barrels are physically static).
- Golf cart: no single distinct color; an RGB frame-diff approach was tried first and abandoned after its detected pixel's depth disagreed with a manual crop of the cart's true location by ~2x — ambient sensor noise on this outdoor clip is high enough that naive diffing locks onto other moving edges instead. What worked: read depth directly — within a road-ahead ROI, drop ground-level points via the height channel, take the nearest remaining cluster. Produces a smooth 12.4 m → 4.9 m approach.
Bbox+patch-center overlays on sample frames; raw distance/bearing-vs-frame plot (confirms no indexing bugs); a synthetic round-trip unit test of the rotation/inversion math (exact recovery); a scale sanity check (all distances in the tens-of-meters range).
Constant-heading assumption (Part A); the golf-cart heuristic assumes it's the nearest off-ground object in its ROI (would need retuning or a real detector near other close obstacles); pedestrians and the second visible traffic light are not tracked (out of scope for the time available, though the same patch-sampling code would extend to them given a detector).