Download Processing_Code/docs/METHOD_NOTES.md from InterestingITS/U-EASWS: direct link, hf CLI and curl.
- Browser
- Download file 7.45 kB
-
https://huggingface.co/datasets/InterestingITS/U-EASWS/resolve/main/Processing_Code/docs/METHOD_NOTES.md
- Command line
-
hf download hf://datasets/InterestingITS/U-EASWS/Processing_Code/docs/METHOD_NOTES.md
-
curl -L -o METHOD_NOTES.md https://huggingface.co/datasets/InterestingITS/U-EASWS/resolve/main/Processing_Code/docs/METHOD_NOTES.md
Processing methods and numerical settings
Coordinates and vehicle length
Source-image points are mapped to the master image by RANSAC homography with a 3-pixel threshold. Metric conversion subtracts the master-image origin, applies the mean measured distance/pixel scale, and reverses image y. The supplied configurations use no additional rotation. See CALIBRATION.md.
Vehicle-length estimation constructs the four corners of each pixel bounding box, transforms them with the same calibration, and takes the longitudinal maximum-minus-minimum as a frame-level length candidate. Invalid and nonpositive candidates are removed. A 1.5-IQR filter is applied when at least four candidates exist. The 25th percentile is assigned as the fixed vehicle length when at least five candidates remain. The separate length table records retained counts and the quality category: good for at least 20 frames, limited for 5-19, and insufficient below five.
Trajectory screening and reconstruction
Tracks are sorted chronologically. Screening uses the observed record count divided by FPS, with a minimum duration of 0.5 s and at least 15 observations. A track with duration at least 2 s, extent diagonal below 1 m and mean path speed below 0.5 m/s is rejected by the low-motion rule. Mean path speed is accumulated path distance divided by the observed-count duration. Rejected records and screening measurements are written separately.
Coordinate interpolation uses a linear method for two observations and PCHIP for three or more; screening is performed before interpolation. Lane values are filled forwards and then backwards. Symmetric exponential moving averaging uses a 0.6 s window; the supplied reconstruction calculates velocities and accelerations from the smoothed positions. Frame, Time_s and source lineage are retained with the offsets passed to the command.
Vehicle pairing and local coordinates
Use one released observation-group Basic CSV per run, or one source recording for source-labelled inputs. Within each frame and travel direction, candidate vehicle pairs satisfy 0.5 m <= center distance < 50 m. The pair list is directed, so both orientations of an eligible pair are represented. Position difference is POV minus EV; velocity difference is EV minus POV. The relative-velocity direction defines local +Y and its right perpendicular defines local +X. Pairs with exactly zero relative speed are excluded.
The signed heading angle is -atan2(cross(vEV,vPOV),dot(vEV,vPOV)) in degrees. The binary class is cangle=1 for 5 <= abs(angle) <= 175 degrees and 0 otherwise. When either individual velocity is zero, Angle_Defined=false; the implemented atan2(0,0)=0 convention is retained. Distances are meters and relative speeds are m/s.
Balanced fitting samples
Fitting first excludes relative speeds above 30 m/s, separates the angle categories and rounds relative speed to one decimal. Dense speed bins are sampled uniformly without replacement to 50000 pair-frame observations with seed 42 by default. Sparse bins within each category are pooled, sorted by actual speed and divided into complete 50000-row blocks. Each complete block receives its mean speed rounded to one decimal; the final incomplete block is discarded. Runtime group summaries record counts and representative-speed labels.
Inference groups by cangle,round_v. Coincident representative labels are combined, with a seeded downsample to 50000 observations when necessary. Sample_Group_ID retains the sampling-block label. The complete candidate list is used for final annotation, while the balanced subset is used for fitting.
Driver-space parameter estimation
The inference procedure follows Jiao et al. (2023a), Inferring vehicle spacing in urban traffic from trajectory data, Section 2.3, equation (8) and Algorithm 1: doi:10.1016/j.trc.2023.104289.
The adopted adjusted log-likelihood objective is:
J = sum(log(1 + epsilon - PR_i)), epsilon = 1e-4
At each iteration, the four directional scale parameters are selected by grid search minimizing their individual second finite differences of J. The grid step is 0.1 m and the second-difference step is 0.5 m. Conditional on the updated scales, the four shape parameters are estimated by constrained maximum likelihood estimation within the adopted likelihood formulation: L-BFGS-B minimizes -J subject to beta >= 2. The scale update uses the curvature criterion; MLE refers to the conditional shape update.
The supplied fitting entrypoint uses width=2.0 m, length=5.0 m and the 0.5th percentile for initialization. These are model initialization settings. Beta starts at 2, search bounds are determined from conditional spacing subsets, and parameter values are rounded to one decimal. The initial percentile setting is passed to np.percentile. The default max_iter value is 50, and the iteration-limit check uses iteration > max_iter.
The iteration stops when rounded parameter vectors converge. For recurring vectors, the implemented cycle-resolution rule chooses the smallest summed approximate shape-parameter p-values. The runtime summary records each group's optimization status and sample counts. Bounds, parameter finiteness, sample size and optimizer status are checked before the complete parameter table is written.
Jiao et al. (2023b), Identifying Vehicle Interaction at Urban Intersections: A Comparison of Proximity Resistance, Time-to-Collision, and Post-Encroachment-Time, Section II-A, describes PR-based interaction identification and refers to the same parameter-inference framework: doi:10.1109/ITSC57777.2023.10422682.
Risk and interaction annotation
Risk annotation uses per-vehicle length estimates and the trajectory lane, direction and time fields. TTC and DRAC use the selected same-lane leader; DRAC is capped at 15 m/s². Cut-in PET is evaluated from future crossing times at the detected event frame, with negative values clipped to zero and the existing per-vehicle/frame event selection retained. Command options specify any explicit missing-length fallback.
Interaction annotation uses all eligible candidate pairs, the appropriate fitted parameter table and the full Basic trajectories. It writes PR and interaction type for all candidates. PR > exp(-1) controls the effective-interaction flag. The nearest-speed parameter lookup follows the supplied rule; --speed-tolerance can impose an explicit matching tolerance. A repeated ego/frame may have several target vehicles. Records without an eligible candidate use the existing Safe type label.
Reading the released Basic timing format
The Basic files carry Delta_t_s in seconds and may combine 30 fps and 60 fps sequences. Risk annotation can derive the time coordinate directly from those frame intervals. Nonmissing intervals must be positive, finite and consistent among all vehicles at the same frame. Per-vehicle frames must be consecutive, with an interval on each record after its first. The time coordinate accumulates the common frame intervals within each connected sequence; disconnected sequences get separate Time_Reference_ID values and zero-based local Time_s. Every vehicle must stay in one time reference. PET compares vehicle times that share the same event frame and time reference. The TTC, DRAC and PET formulas are unchanged.