py123d_detection.core.velocity

Box velocities derived from object tracks.

Some datasets (Argoverse 2, KITTI-360, …) annotate no velocity, so their 123D logs carry zeros. PETR-style models regress gt_velocity, so the export can derive one the way the nuScenes devkit’s box_velocity does, per track in the global frame at the log’s native frame rate:

  • both neighbours within max_dt_s: v = (p[k+1] - p[k-1]) / (t[k+1] - t[k-1])

  • one neighbour within max_dt_s: the one-sided difference with that neighbour

  • no neighbour within max_dt_s: 0

The devkit uses a 1.5 s limit on 2 Hz keyframes and returns nan in the last case, which mmdetection3d then replaces by 0. The 0.25 s default tolerates one dropped frame at 10 Hz. The reference converters implement the same rule, so their pickles can be diffed against exports.

Functions

velocities_from_track(times_us, centers[, ...])

Velocities of one track.

Classes

TrackVelocityTable([max_dt_s])

Per-frame, per-track velocities of one log.

py123d_detection.core.velocity.velocities_from_track(times_us, centers, max_dt_s=0.25)[source]

Velocities of one track.

Parameters:
  • times_us (ndarray) – (N,) timestamps in microseconds, sorted ascending.

  • centers (ndarray) – (N, 3) box centres at those timestamps.

  • max_dt_s (float) – Neighbours further away than this are ignored.

Return type:

ndarray

Returns:

(N, 3) velocities in units of centers per second.

class py123d_detection.core.velocity.TrackVelocityTable(max_dt_s=0.25)[source]

Bases: object

Per-frame, per-track velocities of one log.

classmethod from_scene(scene, max_dt_s=0.25)[source]

Derive velocities for every track in scene.

Pass the native-rate view of the log: a subsampled one would stretch the differences over several frames.

Return type:

TrackVelocityTable

at(timestamp_us)[source]

Velocities of the tracks observed at one frame, keyed by track token.

Return type:

Mapping[str, ndarray]