A Spatiotemporal Entropy & Eco-Dynamics Estimation Framework Using Computer Vision
EcoTraffic transforms roadside video into a set of environment-aware motion disorder metrics using:
- Object detection (YOLOv8)
- Motion tracking (Kalman + SORT assignment)
- Velocity time-series modeling
- Shannon entropy of velocity distributions
- Kinetic energy variance
- Per-cell spatiotemporal entropy fields
- Eco-dynamics proxies (efficiency + CO₂ trend estimate)
This project fits directly into the theme Automotive × Object Detection × Environment by converting simple video into interpretable environmental indicators of traffic flow.
Unlike classical CV projects, EcoTraffic does not focus on detection accuracy. Detection is merely a measurement layer. The core idea is physical modeling of traffic motion through entropy and kinetic dispersion.
All metrics are logged into frame_metrics.csv, enabling deep time-series analysis and environmental trend estimation.
Using tracked vehicle centroids:
A rolling global velocity window of size ( W = 200 ) (as in the code) forms an empirical PDF:
This distribution evolves over time and serves as the basis for entropy and energy statistics.
Interpretation:
- High entropy → diverse velocities → unstable traffic → stop-go turbulence
- Low entropy → uniform movement → stable traffic flow
Your code computes this exactly via a histogram over recent velocity magnitudes.
For each instantaneous speed:
Then global variance:
This reflects motion turbulence and “jerkiness” in the flow.
The frame is divided into a grid:
- Width = 16 cells
- Height = 9 cells
- Each cell stores up to 100 recent speeds
For each cell ( c ):
Producing a 2D entropy heatmap (not displayed in the output video but computed internally).
These models are deliberately simplified proxies (as you wrote in code).
Used constants:
ALPHA = 1.0
BETA = 1.0
GAMMA = 0.0
These are not physical CO₂ units, only a trend signal combining turbulence & disorder.
The code uses:
K1 = 1.0
K2 = 0.5
K3 = 0.0
| Module | Description |
|---|---|
| Detection | YOLOv8-l (only for bounding boxes) |
| Tracking | Kalman Filter (x, y, vx, vy) + Hungarian assignment |
| Velocity Modeling | Δx-Δy displacement per frame |
| Entropy | Shannon entropy on histogram of last 200 velocities |
| Energy Dispersion | Variance of kinetic energies |
| Grid Entropy | Local cell-wise velocity entropy map |
| Eco-Dynamics | Efficiency + CO₂ trend proxy |
| Statistics | Pearson, Spearman, ANOVA, Mann-Whitney |
Exported to frame_metrics.csv:
| Column | Meaning |
|---|---|
| frame | Frame index |
| entropy | Shannon entropy ( S(t) ) |
| sigma_E2 | Kinetic energy variance |
| efficiency | ( \eta(t) ) |
| E_co2 | CO₂ trend estimate |
| n_tracks | Number of active objects |
| mean_speed_frame | Avg. instantaneous per-frame speed |
The correlation analysis yielded:
/outputs/eco_entropy_output.mp4
→ Shows bounding boxes, track IDs, entropy, σE², efficiency, CO₂.
All numerical results are saved into:
This CSV is the primary dataset for downstream analytics and environmental insights.
- A thermodynamics-inspired modeling of traffic flow
- Direct extraction of environment-related signals from plain video
- Integration of object detection + tracking + information theory
- A practical framework for environmental mobility analytics
- Full reproducibility with a single Python file
- Speeds are in pixels/frame, not physical units
- CO₂ output is a proxy, not physically calibrated
- Single-camera perspective may cause occlusions
- Entropy computed only on velocity magnitude, not directional fields
- Grid entropy computed but not rendered visually in the output video (by design)
EcoTraffic reframes traffic analysis as a non-equilibrium dynamical system, combining:
- entropy modeling
- kinetic energy variance
- stochastic velocity distributions
- eco-dynamic proxies
- segment-wise statistical tests





