![Build Status](https://travis-ci.org/piercus/object-tracking-measure.svg?branch=master)
Object Tracking measure
This project aims to calculate metrics for tracking algorithm (especially MOTA, IDF1)
MOTA
See [1].
const otm = require('object-tracking-measure');
const groundTruths = [
[
[22, 33, 20, 20],
[22, 33, 20, 20],
[22, 33, 20, 20],
[22, 33, 20, 20]
],
[
[22, 33, 20, 20],
null,
[25, 35, 20, 20],
[39, 41, 20, 20]
]
];
const predictions = [
[
[23, 33, 22, 20],
[21, 35, 20, 26],
[23, 33, 22, 20],
[21, 35, 20, 26]
],
[
[23, 33, 20, 20],
null,
[23, 35, 22, 20],
[39, 35, 20, 26]
]
];
otm.mota({
groundTruths,
predictions
});
IDF1
See [2].
const otm = require('object-tracking-measure');
const groundTruths = [
[
[22, 33, 20, 20],
[22, 33, 20, 20],
[22, 33, 20, 20],
[22, 33, 20, 20]
],
[
[22, 33, 20, 20],
null,
[25, 35, 20, 20],
[39, 41, 20, 20]
]
];
const predictions = [
[
[23, 33, 22, 20],
[21, 35, 20, 26],
[23, 33, 22, 20],
[21, 35, 20, 26]
],
[
[23, 33, 20, 20],
null,
[23, 35, 22, 20],
[39, 35, 20, 26]
]
];
otm.idf1({
groundTruths,
predictions
});
Advanced usage
By default, object-tracking-measure uses
- distance between boxes is (1 - Intersection Over Union) (using mean-average-precision library)
- threshold is 1 (i.e. IOU = 0 - no overlap)
You can cutomize this, for example to track distance between {x,y} points like
const otm = require('object-tracking-measure');
const groundTruths = [
[
{x: 22, y: 34},
{x: 22, y: 34},
{x: 22, y: 34},
{x: 22, y: 34}
],
[
{x: 55, y: 68},
null,
{x: 55, y: 68},
{x: 55, y: 68}
]
];
const predictions = [
[
{x: 22, y: 34},
{x: 22, y: 34},
{x: 22, y: 34},
{x: 22, y: 34}
],
[
{x: 55, y: 68},
null,
{x: 55, y: 68},
{x: 55, y: 68}
]
];
otm.idf1({
groundTruths,
predictions,
distFn: ((a,b) => Math.sqrt(((a.x - b.x) * (a.x - b.x)) + ((a.y - b.y) * (a.y - b.y)))),
threshold: 2
});
Inspect ID Metric
const measure = otm.idDetails({
groundTruths,
predictions
});
console.log(otm.idInspect(Object.assign({}, measure, {
columns: process.stdout.columns - 20
})))
will print
--
GroundTruth[0]✓――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――✓
Prediction[0] ✓――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――✓
|----------------------------|----------------------------|---------------------------
0 1 2
--
GroundTruth[1]✓―――――――――――――――――――――――――――✓?―――――――――――――――――――――――――――?✓――――――――――――――――――――――――――✓
Prediction[1] ✓―――――――――――――――――――――――――――✓?―――――――――――――――――――――――――――?✓――――――――――――――――――――――――――✓
|----------------------------|----------------------------|---------------------------
Inspect MOT Metric
const measure = otm.motDetails({
groundTruths,
predictions
});
console.log(otm.motInspect(Object.assign({}, measure, {
columns: process.stdout.columns - 20
})))
will print
0[0] 1-1-1-1-1-1-1-1-1-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-
1[1] 0-0-0-0-0-0-0-0-0-0---------------------1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-
Other tools
getStats
const result = otm.getStats({
track: [
[22, 33, 20, 20],
null,
[25, 35, 20, 20],
[39, 41, 20, 20],
null
]
});
fastGetNullSegment
const result = otm.fastGetNullSegment({
track: [
[22, 33, 20, 20],
null,
null,
null,
[25, 35, 20, 20],
[39, 41, 20, 20],
null
]
});
References
[1]
Keni Bernardin and Rainer Stiefelhagen (2008).
Evaluating Multiple Object Tracking Performance: The CLEAR MOT Metrics
[2]
Ergys Ristani1, Francesco Solera2, Roger S. Zou1, Rita Cucchiara2, and Carlo Tomasi1 (2016).
Performance Measures and a Data Set for Multi-Target, Multi-Camera Tracking