Python module for multiple hypothesis tracking. Based on the article:
C. Kim, F. Li, A. Ciptadi and J. M. Rehg, "Multiple Hypothesis Tracking Revisited," 2015 IEEE International Conference on Computer Vision (ICCV), Santiago, Chile, 2015, pp. 4696-4704, doi: 10.1109/ICCV.2015.533.
URL: https://ieeexplore.ieee.org/document/7410890
This implementation utilizes motion scoring only (no appearance scoring)
Install the latest version of Python 3
$ pip install openmht
To also plot tracks after completion, install matplotlib:
$ pip install matplotlib
Format the input CSV columns with frame number and pixel positions using the examples under SampleData/ as a reference. The U,V values represent the 2D positions of objects/detections in that frame. A value of None in the output CSV indicates a missed detection. The Track column indicates the final track ID for a detection.
Modify parameters by editing the params.txt input file. Please read the paper mentioned above to understand how these parameters can be updated to improve performance and accuracy:
Parameter | Description |
---|---|
v | The image (frame) area in pixels (Default: 307200). The likelihood under the null hypothesis for an observation becomes the probability of detection PD=1/V. |
dth | Gating area for new detections implemented as the threshold for the Mahalinobis distance d2 between the observation and prediction (Default=1000). |
Parameter | Description |
---|---|
k | Gain or blending factor. Higher gain results in a greater influence of the measurement relative to the filter's prediction (Default=0). |
q | Initial estimate of the process noise covariance (Default=0.00001). |
r | Initial estimate of the measurement noise covariance (Default=0.01). |
Parameter | Description |
---|---|
n | Look back N frames and prune all branches that diverge from the solution. A larger N yields a more accurate solution due to a larger window, but will take a longer time (Default=1). |
bth | If the number of branches exceeds the number Bth then prune the track tree to only retain the top Bth branches. |
nmiss | A track hypothesis is deleted if it reaches Nmiss consecutive frames of missing observations. |
OpenMHT takes in the input CSV detections and the parameter file, and saves to the provided output CSV file:
$ python -m openmht InputDetections.csv OutputDetections.csv ParameterFile.txt
A default parameter file is provided in this repository: params.txt
For generating track plots, add the --plot parameter (requires matplotlib):
$ python -m openmht ... --plot
Results from running SampleData/SampleInput.csv:
Input | Output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|