All projects

Highway Traffic Intelligence

Highway Traffic Balancing and Spatiotemporal Forecasting

Zero-to-one prototype for highway-network traffic monitoring, multi-source data fusion, spatiotemporal forecasting, and imbalance assessment—from raw ETC and link-speed feeds to FastAPI services.

Type
Industry
Context
Algorithm Engineer · JSTI Group · Oct 2024–May 2025
Focus
PyTorch · FastAPI · Spatiotemporal forecasting · Spatial indexing
Highlight
Sole developer · <10% dev. >30 km/h

#My contribution

As the team's sole developer, designed and built an end-to-end prototype for highway-network traffic monitoring, forecasting, and imbalance assessment, from raw multi-source data ingestion to FastAPI services.

I worked as an Algorithm Engineer at JSTI Group Limited (Shanghai) from October 2024 to May 2025, taking an ambiguous regional expressway balancing mandate—focused on the Nanjing/Jiangsu highway network—from raw data exploration and system architecture through working code modules, a technical proposal, and field validation.

#Multi-source data fusion and ETC anomaly diagnosis

Real-world highway feeds come from separate agencies with mismatched update cadences, coordinate systems, and road segmentations. I engineered an ingestion and alignment layer spanning five dynamic and static data streams: ETC gantry records, internet link-speed feeds (Baidu Map API, 7,260 links covering ~1,441.5 km), toll/checkpoint counts, weather observations, and incident/control logs.

  • Scheduled ingestion & alignment: polled live link-speed data every 2 minutes and weather every 20 minutes via APScheduler into a thread-safe producer–consumer Queue buffer (1,000-record capacity). Temporally aligned asynchronous streams using cubic-spline interpolation and sliding-window aggregation, and spatially mapped heterogeneous GIS/link IDs onto standardized 200 m sub-segments.
  • ETC trip reconstruction & clock-drift diagnosis: reconstructed vehicle trajectories and gantry topology from raw ETC logs, repairing logical errors where a single gantry appeared as the simultaneous predecessor of two downstream gantries. When computed segment speeds showed implausible outliers (>300 km/h, occasionally >400 km/h), cross-gantry inspection traced the cause to gantry clock desynchronization rather than sensor noise; I combined DBSCAN, GMM, and LOF (cross-checked against multi-gantry anchor spans) to flag and filter faulty gantries.
  • Multimodal representation: built a deep autoencoder to fuse multi-source features, using Bayesian optimization to tune source weights and PCA/ICA to separate external disturbance factors such as rainfall and traffic incidents.

#Spatial indexing, routing, and FastAPI services

To bridge engineering mileposts (stake numbers) with GPS coordinates and road-network queries, I built the core spatial and service modules:

  • Stake-number–GPS conversion engine: built path-aware interpolation (PileInterpolator) on BD09 planar projections (at least one interpolated point per metre, scaled by actual-to-nominal distance ratio) paired with a cKDTree spatial index and road-direction cosine matching (PileQuery) to avoid cross-road mismatches—achieving <0.5 m error within 100 m.
  • Weather-weighted road graph: modelled the highway network as a NetworkX weighted directed graph combining live link speeds, historical fallbacks, and weather impact factors, using Dijkstra shortest-path search with automatic disconnected-link fallback (expanding search radius 50 m → 100 m → 200 m).
  • Anomaly alerts & APIs: implemented a 30-step sliding-window monitor tracking speed ZZ-scores (±2σ\pm 2\sigma), exponential-smoothing congestion jumps (>30%), and rainfall thresholds (>10 mm) to trigger three-tier alerts (Yellow / Orange / Red) and exposed status, route, and alert endpoints via FastAPI.

#Spatiotemporal forecasting and imbalance detection

  • Initial forecasting prototypes (PyTorch): implemented initial STGCN + Bi-LSTM (with multi-head self-attention) and Transformer models, including a joint volume–speed architecture (shared spatiotemporal encoder with task-specific decoders) targeting 15- to 120-minute horizons. Hyperparameter fine-tuning and formal benchmark evaluation were planned as next steps before production rollout.
  • Traffic imbalance assessment: combined GMM and Fuzzy C-Means (FCM) traffic-state classification with DBSCAN-based adaptive thresholds to localize emerging bottlenecks and estimate queue length, saturation, and severity—producing structured state signals for downstream control logic.

#Field validation at G36 Maqun Interchange

I validated segment-level speed, congestion index, and queue-length estimates against Baidu link benchmarks and on-site observations at Nanjing's G36 Maqun Interchange across afternoon and evening peak windows:

Traffic regime Comparison vs. reference & field observations
Free-flow / light congestion (>30 km/h) Speed and congestion index matched within <10% deviation; queue length agreed at 0 km.
Moderate congestion (10–30 km/h) Speed/index deviation widened (~17–20%) and linear link-length summation overestimated queue length (Baidu<actual<algorithm\text{Baidu} < \text{actual} < \text{algorithm}), because link-level averages miss stop-and-go waves.
Severe congestion (<10 km/h) High consistency across speed, congestion index, and observed queue length.

This validation pinpointed why speed-only link aggregation breaks down during transition regimes and motivated incorporating flow–density relationships in subsequent iterations.

#Planned decision layer

Separately from the implemented monitoring, forecasting, and imbalance prototype, I authored the architectural proposal for a future closed-loop control layer combining traffic aggregation–dissipation wave theory, knowledge-graph strategy matching, and multi-objective reinforcement learning for coordinated variable speed limits, ramp control, and dynamic hard-shoulder opening.