Kinematic Tracker
📖 Live docs: https://kovalp.github.io/kinematic-tracker-docs/
This tracker is based on kinematic Kalman filters. The system state can consist of multiple parts,
each defined by its kinematic order and dimensionality. For example, to track cuboids
aligned with Cartesian axes, we might decide for a constant-acceleration motion model
for Cartesian coordinates and a constant-position motion model for the sizes of the cuboids.
This choice is encoded by orders = [3, 1]. The dimensionality of both parts (coordinates and sizes)
is 3. Therefore dimensions = [3, 3] in our example.
The state of the cuboids aligned with Cartesian axes will have 12 variables. Internally, block-diagonal states are used, i.e.
state = p_x, v_x, a_x, p_y, v_y, a_y, p_z, v_z, a_z, s_x, s_y, s_z
To simplify the input/output processing, one might find attractive a derivative-sorted order
state = p_x, p_y, p_z, s_x, s_y, s_z, v_x, v_y, v_z, a_x, a_y, a_z
This package provides utility classes for such conversion (block-diagonal ↔ derivative sorted).
Process noise models
The tracker supports the following process noise models:
- White-noise based, adaptive (
finite_diff): a custom model adapting the noise variance. - White-noise based, fixed variance (
const). - Diagonal, fixed variance (
diagonal).
Association metrics
A number of association metrics are implemented. Some of the metrics are experimental.
- Mahalanobis with the innovation covariance (H P Hᵀ + R) -- default.
- Axes-aligned GIoU for segments, bounding boxes, cuboids etc.
- 3D yaw-only GIoU (volumetric GIoU for cuboids oriented by yaw).
- Mahalanobis with size-modulated covariance (experimental).
- IoU-like two-yaw (experimental): based on Mahalanobis distance with diagonal covariance.
Installation
The tracker needs OpenCV (cv2), but does not force a particular OpenCV distribution.
If your project already uses OpenCV (opencv-python, opencv-python-headless,
opencv-contrib-python, ...), just install the tracker and it will use that OpenCV
pip install kinematic-tracker
Otherwise, let the tracker bring OpenCV via an extra: headless (no GUI) or gui (with HighGUI)
pip install kinematic-tracker[headless]
Do not install several OpenCV distributions side by side: they share the same cv2 module
and break each other. Importing the tracker without any OpenCV raises an ImportError
explaining the options.
Usage
Track cuboids aligned with Cartesian axes (constant-acceleration positions, constant sizes):
import numpy as np
from kinematic_tracker import NdKkfTracker
tracker = NdKkfTracker(orders_x=[3, 1], num_dims=[3, 3])
tracker.set_measurement_std_dev(0, 0.5) # positions [m]
tracker.set_measurement_std_dev(1, 1.0) # sizes [m]
# Two cuboids moving along x; detections are rows (pos_x, pos_y, pos_z, size_x, size_y, size_z).
for step in range(5):
stamp_ns = step * 100_000_000 # 10 Hz
det_rz = np.array(
[[0.0 + 0.5 * step, 0.0, 0.0, 4.5, 2.0, 1.7], [10.0 - 0.3 * step, 5.0, 0.0, 8.7, 2.7, 3.1]]
)
ids_r = np.array([7, 15]) # detection IDs (optional)
tracker.advance(stamp_ns, det_rz, ids_r)
for track in tracker.tracks_c[0]: # tracks of class 0
x = track.kkf.kalman_filter.statePost.ravel() # block-diagonal order, see above
print(track.creation_id, 'position', x[[0, 3, 6]], 'velocity', x[[1, 4, 7]])
More examples are available in the test/tutorials folder.
The test folder is available in the source package
pip download kinematic-tracker --no-binary :all: --no-deps
Use kinematic-tracker as a dependency
If the project already depends on an OpenCV distribution, then
uv add kinematic-tracker
Otherwise, add it with an extra providing OpenCV: headless or, if you need a GUI-enabled
OpenCV, gui
uv add kinematic-tracker --extra headless
Metadata
Release files for kinematic-tracker 24.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kinematic_tracker-24.3.0.tar.gz | 334.7 kB | Without provenance | Details for kinematic_tracker-24.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kinematic_tracker-24.3.0-py3-none-any.whl | Python 3 | none | any | Details for kinematic_tracker-24.3.0-py3-none-any.whl |
Total release size: 395.3 kB
Release files / kinematic_tracker-24.3.0.tar.gz
| Download URL | kinematic_tracker-24.3.0.tar.gz |
|---|---|
| Size | 334.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cafe6afeec8bd2ac3568d8c4e83ea5ff465fc2d23897bcc8905898704d64b7e
|
|
BLAKE2b-256 checksum How to use checksums |
c4f0a62cc7a51910e52d058b41477963a610cec13a0812d3e45a574dfd15e486
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / kinematic_tracker-24.3.0-py3-none-any.whl
| Download URL | kinematic_tracker-24.3.0-py3-none-any.whl |
|---|---|
| Size | 60.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c359ed9622e2aa70a1dcb70496ebfd4266d3769476c057cf68c9160193cedb5
|
|
BLAKE2b-256 checksum How to use checksums |
df2e0760da300014f299cab825abbff746d6f9bb9eb6729161ec6b7f6afeb436
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for kinematic-tracker 24.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.