Algorithm Search⌘K

Definitionadvanced

IDF1 score

Also called identity F1 score.

The F1 score of detections correctly identified after a global one-to-one matching of predicted and true trajectories, a measure of identity preservation.

The IDF1 score measures how well a multi-object tracker keeps the identities of the objects over a whole video. Each true trajectory is matched to at most one computed trajectory, once, for the whole video, by a one-to-one matching that maximizes the number of frames in which the two agree. A detection counts as correct only if it belongs to the trajectory matched to its object. IDF1 is the F1 score, the harmonic mean of precision and recall, of these identity-correct detections. Ristani et al. introduced it in 2016 together with the identity precision IDP and recall IDR. Where MOTA counts an identity switch once, in one frame, IDF1 counts every frame that carries the wrong identity.

Definition

The ground truth has true trajectories oo, each a set of frames with a box, and the tracker has computed trajectories hh. In one frame, the detections of oo and hh agree when both are present and the intersection over union of their boxes is at least a threshold Δ\Delta, such as 0.50.5; the paper also allows a distance on the ground plane, with Δ=1\Delta = 1 meter. Let

n(o,h)=the number of frames in which o and h agree,n(o, h) = \text{the number of frames in which } o \text{ and } h \text{ agree},

and let ∣o∣|o| and ∣h∣|h| be the numbers of frames in which they are present. For a one-to-one matching μ\mu of true to computed trajectories, the identity true positives are ∑(o,h)∈μn(o,h)\sum_{(o, h) \in \mu} n(o, h). The matching of IDF1 is one that makes this sum largest, and

IDTP=max⁡μ∑(o,h)∈μn(o,h),IDFN=∑o∣o∣−IDTP,IDFP=∑h∣h∣−IDTP,\mathrm{IDTP} = \max_\mu \sum_{(o, h) \in \mu} n(o, h), \quad \mathrm{IDFN} = \sum_o |o| - \mathrm{IDTP}, \quad \mathrm{IDFP} = \sum_h |h| - \mathrm{IDTP},
IDP=IDTPIDTP+IDFP,IDR=IDTPIDTP+IDFN,IDF1=2 IDTP2 IDTP+IDFP+IDFN=2 IDTP∑o∣o∣+∑h∣h∣.\mathrm{IDP} = \frac{\mathrm{IDTP}}{\mathrm{IDTP} + \mathrm{IDFP}}, \quad \mathrm{IDR} = \frac{\mathrm{IDTP}}{\mathrm{IDTP} + \mathrm{IDFN}}, \quad \mathrm{IDF1} = \frac{2\, \mathrm{IDTP}}{2\, \mathrm{IDTP} + \mathrm{IDFP} + \mathrm{IDFN}} = \frac{2\, \mathrm{IDTP}}{\sum_o |o| + \sum_h |h|}.

The computation is a maximum weight matching in a bipartite graph:

  1. IDF1(the true and the computed trajectories, the threshold Δ)
  2. 1for each frame, each true detection and each computed detection: if IoU ≥ Δ, add 1 to n(o, h)
  3. 2find a one-to-one matching μ of true to computed trajectories with the largest sum of n (Hungarian)
  4. 3IDTP ← that sum; IDFN ← (true detections) - IDTP; IDFP ← (computed detections) - IDTP
  5. 4IDP ← IDTP / (computed detections); IDR ← IDTP / (true detections); IDF1 ← 2 IDTP / (both)

The paper writes line L2 as a minimum cost problem. It adds a false negative node for each true trajectory and a false positive node for each computed one, so that a trajectory can stay unmatched. Matching oo to hh costs the frames in which they do not agree, ∣o∣+∣h∣−2n(o,h)|o| + |h| - 2 n(o, h); leaving oo unmatched costs ∣o∣|o|, and leaving hh unmatched costs ∣h∣|h|. These facts follow from the definition and are proved in the correctness file of this page:

  • Theorem: the two forms agree. The minimum cost of the form of the paper is ∑o∣o∣+∑h∣h∣−2 IDTP\sum_o |o| + \sum_h |h| - 2\, \mathrm{IDTP}, which is IDFN+IDFP\mathrm{IDFN} + \mathrm{IDFP}. So both forms give the same IDTP.
  • Theorem: the bound by detection. IDF1 is at most the F1 score of the detections, where each frame uses its own best one-to-one matching. Identity can only lower the score.
  • Theorem: symmetry. Swapping the roles of the ground truth and the tracker keeps IDTP and IDF1 and swaps IDP and IDR.

With mm trajectories on the larger side, the Hungarian algorithm of line L2 costs O(m3)O(m^3), and line L1 costs one IoU for each pair of detections in the same frame.

Examples and non-examples

  • A swap. Two objects stand still for 6 frames, and the tracker follows them with aa and bb. After frame 4 the two identities swap. Then n(1,a)=4n(1, a) = 4, n(1,b)=2n(1, b) = 2, n(2,b)=4n(2, b) = 4 and n(2,a)=2n(2, a) = 2, so the best matching is 1→a1 \to a, 2→b2 \to b with IDTP=8\mathrm{IDTP} = 8. There are 12 true and 12 computed detections, so IDFN=IDFP=4\mathrm{IDFN} = \mathrm{IDFP} = 4 and IDF1=IDP=IDR=16/24=2/3\mathrm{IDF1} = \mathrm{IDP} = \mathrm{IDR} = 16/24 = 2/3. MOTA counts 2 switches in 12 objects and gives 5/65/6.
  • A late switch. One object over 100 frames, tracked by aa in the first 50 frames and by bb in the last 50. The best matching takes one of them, so IDTP=50\mathrm{IDTP} = 50 and IDF1=100/200=1/2\mathrm{IDF1} = 100/200 = 1/2, while MOTA is 0.990.99. A tracker that keeps one identity for all 100 frames but adds one false positive gets IDF1=200/201\mathrm{IDF1} = 200/201 and the same MOTA.
  • Not the F1 of detections. In both examples every object is detected in every frame, so the F1 score of detections is 1. IDF1 is lower because it also asks for the right identity.
  • Not a frame by frame measure. The matching is global: a computed trajectory that switches to a new object late in the video can still be matched to its first object, and the frames after the switch are errors.
  • More correct boxes can lower IDF1. A computed trajectory aa is matched to object 1 and also covers object 2 for 3 frames in which nothing else covers object 2. Those 3 boxes are correct detections, but they count as IDFP, and object 2 stays IDFN either way. A tracker that leaves them out has the same IDTP and a smaller denominator, so a higher IDF1.

MOTA uses a matching in each frame and counts identity switches as events; IDF1 uses one matching for the whole video and counts frames. The two often rank trackers in different orders. HOTA also measures association over the whole video, but for each true positive pair it looks at the overlap of the two whole trajectories, and it averages over the threshold Δ\Delta; its authors point out that IDF1 ignores the association of the parts that are not matched, and that it can fall when the detection gets better, as in the example above. Detection F1 and precision and recall are the same formulas without identity. Trackers with appearance features, such as Deep SORT, aim to raise IDF1 by keeping identities through occlusions, and the ByteTrack paper reports IDF1 together with MOTA and HOTA. The Python code of this page computes the identity measures with exact fractions, and its tests compare the matching with all matchings, check that the form of the paper with extra nodes gives the same minimum, and check the bound by detection and the symmetry on random sequences.

Proof: The maximum overlap matching and the minimum cost form of the paper give the same IDTP, and IDF1 is at most the F1 score of detectionsfull

Notation as on the page. True trajectories o1,…,oto_1, \ldots, o_t have lengths ∣oi∣|o_i|, computed trajectories h1,…,hch_1, \ldots, h_c have lengths ∣hj∣|h_j|, and nij=n(oi,hj)n_{ij} = n(o_i, h_j) is the number of frames in which they agree. Let L=∑i∣oi∣+∑j∣hj∣L = \sum_i |o_i| + \sum_j |h_j|.

Claim 1: line L2 finds IDTP

The Hungarian algorithm on the costs −nij-n_{ij}, with the pairs of nij=0n_{ij} = 0 then removed, returns a one-to-one matching with the largest total ∑nij\sum n_{ij}.

Proof. Every one-to-one matching μ\mu of rows and columns extends to a full assignment of the smaller side by adding pairs, and since nij≥0n_{ij} \ge 0 this does not lower the total. So the largest total over matchings equals the largest total over assignments, which the Hungarian algorithm finds (its optimality is proved on the SORT proof and the Hungarian algorithm page). Removing pairs with nij=0n_{ij} = 0 does not change the total. □\square

Claim 2: the form of the paper gives the same IDTP

Build the square cost matrix of size t+ct + c of the code. Rows are o1,…,oto_1, \ldots, o_t and the false positive nodes hˉ1,…,hˉc\bar h_1, \ldots, \bar h_c; columns are h1,…,hch_1, \ldots, h_c and the false negative nodes oˉ1,…,oˉt\bar o_1, \ldots, \bar o_t. The costs are ∣oi∣+∣hj∣−2nij|o_i| + |h_j| - 2 n_{ij} for (oi,hj)(o_i, h_j), ∣oi∣|o_i| for (oi,oˉi)(o_i, \bar o_i), ∣hj∣|h_j| for (hˉj,hj)(\bar h_j, h_j), 0 for (hˉj,oˉi)(\bar h_j, \bar o_i), and a cost β>L\beta > L for every other pair. Then the minimum cost of a perfect assignment is L−2 IDTP=IDFN+IDFPL - 2\, \mathrm{IDTP} = \mathrm{IDFN} + \mathrm{IDFP}.

Proof. First, every matching μ\mu of true to computed trajectories gives a perfect assignment of cost L−2∑(i,j)∈μnijL - 2 \sum_{(i,j) \in \mu} n_{ij}. Take the pairs of μ\mu; match each unmatched oio_i to oˉi\bar o_i and each unmatched hjh_j to hˉj\bar h_j. The hˉj\bar h_j of the matched hjh_j and the oˉi\bar o_i of the matched oio_i are left; there are ∣μ∣|\mu| of each, and they pair up at cost 0. Every trajectory appears in exactly one paid pair, so the cost is ∑i∣oi∣+∑j∣hj∣−2∑μnij\sum_i |o_i| + \sum_j |h_j| - 2 \sum_\mu n_{ij}.

Second, every perfect assignment π\pi of cost at most LL is of this form. A cost of β>L\beta > L is too much, so π\pi uses only the allowed pairs. Then each oio_i goes to some hjh_j or to oˉi\bar o_i, and each hjh_j comes from some oio_i or from hˉj\bar h_j. The pairs (oi,hj)(o_i, h_j) of π\pi form a matching μ\mu, and the cost is, as above, L−2∑μnijL - 2 \sum_\mu n_{ij} plus the zero pairs.

The matching with no pairs gives cost LL, so the minimum is at most LL, and by the two parts it is min⁡μ(L−2∑μnij)=L−2 IDTP\min_\mu (L - 2 \sum_\mu n_{ij}) = L - 2\, \mathrm{IDTP}. Finally IDFN+IDFP=(∑i∣oi∣−IDTP)+(∑j∣hj∣−IDTP)=L−2 IDTP\mathrm{IDFN} + \mathrm{IDFP} = (\sum_i |o_i| - \mathrm{IDTP}) + (\sum_j |h_j| - \mathrm{IDTP}) = L - 2\, \mathrm{IDTP}. □\square

The paper links two regular nodes only when the trajectories overlap in time. Here every pair has an edge, but a pair with nij=0n_{ij} = 0 costs ∣oi∣+∣hj∣|o_i| + |h_j|, the same as leaving both unmatched, so the minimum does not change. The tests compute both forms on random sequences.

Claim 3: IDF1 is at most the F1 score of detections

For each frame ff, let mfm_f be the size of a largest one-to-one matching of the true and the computed detections of the frame with IoU at least Δ\Delta, and let TP=∑fmf\mathrm{TP} = \sum_f m_f. Then IDTP≤TP\mathrm{IDTP} \le \mathrm{TP}, so IDF1=2 IDTP/L≤2 TP/L\mathrm{IDF1} = 2\, \mathrm{IDTP} / L \le 2\, \mathrm{TP} / L.

Proof. Fix the matching μ\mu of IDTP. In frame ff, take the pairs (o,h)∈μ(o, h) \in \mu that agree in ff. Since μ\mu is one-to-one, these pairs form a one-to-one matching of the detections of ff, and each has IoU at least Δ\Delta. So their number is at most mfm_f. Summing over the frames, the number of agreeing frames of the pairs of μ\mu, which is IDTP, is at most ∑fmf\sum_f m_f. □\square

Claim 4: symmetry and the harmonic mean

Exchanging the ground truth and the tracker keeps IDTP and IDF1 and swaps IDP and IDR. If IDTP>0\mathrm{IDTP} > 0, IDF1 is the harmonic mean of IDP and IDR.

Proof. IoU is symmetric, so the exchange turns the matrix nn into its transpose, and a matching of the transpose has the same total. So IDTP is the same, LL is the same, and IDF1 is the same. IDP divides IDTP by the computed detections and IDR by the true ones, so they swap. For the harmonic mean, IDTP+IDFP=∑j∣hj∣\mathrm{IDTP} + \mathrm{IDFP} = \sum_j |h_j| and IDTP+IDFN=∑i∣oi∣\mathrm{IDTP} + \mathrm{IDFN} = \sum_i |o_i|, so 1/IDP+1/IDR=L/IDTP1/\mathrm{IDP} + 1/\mathrm{IDR} = L / \mathrm{IDTP}, and 2/(1/IDP+1/IDR)=2 IDTP/L=IDF12 / (1/\mathrm{IDP} + 1/\mathrm{IDR}) = 2\, \mathrm{IDTP} / L = \mathrm{IDF1}. □\square

Code

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

idf1_score.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/idf1-score/. The authors are listed in prov/QK543C.jsonl.
"""The identity measures IDP, IDR and IDF1 (Ristani et al. 2016), with IoU.

A sequence is a list of frames; a frame is a dict from an identity to a box
(x1, y1, x2, y2). A true trajectory o and a computed trajectory h agree in a
frame when both are present and IoU >= delta. n(o, h) is the number of such
frames. One global one-to-one matching of true to computed trajectories with
the largest total n gives IDTP; then
  IDFN = (true detections) - IDTP,  IDFP = (computed detections) - IDTP,
  IDF1 = 2 IDTP / (true detections + computed detections).
The paper states the matching as a minimum cost problem with extra nodes for
the unmatched trajectories; min_cost_with_dummy_nodes builds that form, and
the tests check that both forms agree. All values are exact fractions.
"""

from fractions import Fraction


def iou(a, b):
    w = min(a[2], b[2]) - max(a[0], b[0])
    h = min(a[3], b[3]) - max(a[1], b[1])
    inter = w * h if w > 0 and h > 0 else 0
    union = (a[2] - a[0]) * (a[3] - a[1]) + (b[2] - b[0]) * (b[3] - b[1]) - inter
    return Fraction(inter) / union if union > 0 else Fraction(0)


def hungarian_min(cost):
    """Minimum cost assignment of a rectangular matrix; exact for integers and fractions.
    Returns the sorted pairs (row, column), min(rows, columns) of them."""
    r = len(cost)
    if r == 0 or len(cost[0]) == 0:
        return []
    c = len(cost[0])
    flip = r > c
    if flip:
        cost = [list(col) for col in zip(*cost)]
        r, c = c, r
    inf = float("inf")
    u, v = [0] * (r + 1), [0] * (c + 1)
    p, way = [0] * (c + 1), [0] * (c + 1)
    for i in range(1, r + 1):
        p[0], j0 = i, 0
        minv, used = [inf] * (c + 1), [False] * (c + 1)
        while True:
            used[j0] = True
            i0, delta, j1 = p[j0], inf, 0
            for j in range(1, c + 1):
                if not used[j]:
                    cur = cost[i0 - 1][j - 1] - u[i0] - v[j]
                    if cur < minv[j]:
                        minv[j], way[j] = cur, j0
                    if minv[j] < delta:
                        delta, j1 = minv[j], j
            for j in range(c + 1):
                if used[j]:
                    u[p[j]] += delta
                    v[j] -= delta
                else:
                    minv[j] -= delta
            j0 = j1
            if p[j0] == 0:
                break
        while True:
            j1 = way[j0]
            p[j0] = p[j1]
            j0 = j1
            if j0 == 0:
                break
    pairs = [(p[j] - 1, j - 1) for j in range(1, c + 1) if p[j] != 0]
    if flip:
        pairs = [(b, a) for a, b in pairs]
    return sorted(pairs)


def overlap_counts(gt_frames, hyp_frames, delta=Fraction(1, 2)):
    """Returns (true ids, computed ids, n, true lengths, computed lengths)."""
    gt_ids = sorted({o for f in gt_frames for o in f}, key=repr)
    hyp_ids = sorted({h for f in hyp_frames for h in f}, key=repr)
    gi = {o: i for i, o in enumerate(gt_ids)}
    hi = {h: j for j, h in enumerate(hyp_ids)}
    n = [[0] * len(hyp_ids) for _ in gt_ids]
    glen, hlen = [0] * len(gt_ids), [0] * len(hyp_ids)
    for gt, hyp in zip(gt_frames, hyp_frames):  # @line L1
        for o, a in gt.items():
            glen[gi[o]] += 1
            for h, b in hyp.items():
                if iou(a, b) >= delta:
                    n[gi[o]][hi[h]] += 1
        for h in hyp:
            hlen[hi[h]] += 1
    return gt_ids, hyp_ids, n, glen, hlen


def max_overlap_matching(n):
    """A one-to-one matching of rows to columns with the largest total n.
    Returns (pairs, total); pairs with n = 0 are left out."""
    if not n or not n[0]:
        return [], 0
    pairs = [(i, j) for i, j in hungarian_min([[-x for x in row] for row in n]) if n[i][j] > 0]  # @line L2
    return pairs, sum(n[i][j] for i, j in pairs)


def idf1(gt_frames, hyp_frames, delta=Fraction(1, 2)):
    """Returns a dict with idtp, idfn, idfp, idp, idr, idf1 and the matched identities."""
    gt_ids, hyp_ids, n, glen, hlen = overlap_counts(gt_frames, hyp_frames, delta)
    pairs, idtp = max_overlap_matching(n)
    total_gt, total_hyp = sum(glen), sum(hlen)
    idfn = total_gt - idtp  # @line L3
    idfp = total_hyp - idtp
    idp = Fraction(idtp, total_hyp) if total_hyp else None  # @line L4
    idr = Fraction(idtp, total_gt) if total_gt else None
    f1 = Fraction(2 * idtp, total_gt + total_hyp) if total_gt + total_hyp else None
    return {"idtp": idtp, "idfn": idfn, "idfp": idfp, "idp": idp, "idr": idr, "idf1": f1,
            "matching": [(gt_ids[i], hyp_ids[j]) for i, j in pairs]}


def min_cost_with_dummy_nodes(n, glen, hlen):
    """The form of the paper: rows are the true trajectories and one false positive
    node per computed trajectory; columns are the computed trajectories and one false
    negative node per true trajectory. Matching o to h costs the misses of both,
    glen + hlen - 2 n; o to its own false negative node costs glen; the false
    positive node of h to h costs hlen; two extra nodes cost 0. Returns the minimum."""
    t, c = len(glen), len(hlen)
    size = t + c
    big = sum(glen) + sum(hlen) + 1  # no edge
    cost = [[big] * size for _ in range(size)]
    for i in range(t):
        for j in range(c):
            cost[i][j] = glen[i] + hlen[j] - 2 * n[i][j]
        cost[i][c + i] = glen[i]
    for j in range(c):
        cost[t + j][j] = hlen[j]
        for i in range(t):
            cost[t + j][c + i] = 0
    pairs = hungarian_min(cost)
    return sum(cost[i][j] for i, j in pairs)
test_idf1_score.py 125 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/idf1-score/. The authors are listed in prov/QK543C.jsonl.

import itertools
import random
from fractions import Fraction

from idf1_score import idf1, iou, max_overlap_matching, min_cost_with_dummy_nodes, overlap_counts

HALF = Fraction(1, 2)
P1 = (0, 0, 10, 10)
P2 = (40, 0, 50, 10)


def brute_max_total(n):
    rows = len(n)
    cols = len(n[0]) if rows else 0
    best = 0
    for k in range(min(rows, cols) + 1):
        for rs in itertools.combinations(range(rows), k):
            for cs in itertools.permutations(range(cols), k):
                best = max(best, sum(n[i][j] for i, j in zip(rs, cs)))
    return best


def test_page_example_swap():
    # object 1 stays at P1 and object 2 at P2; a and b swap after frame 4
    gt = [{1: P1, 2: P2}] * 6
    hyp = [{"a": P1, "b": P2}] * 4 + [{"a": P2, "b": P1}] * 2
    r = idf1(gt, hyp)
    assert r["matching"] == [(1, "a"), (2, "b")]
    assert (r["idtp"], r["idfn"], r["idfp"]) == (8, 4, 4)
    assert r["idf1"] == r["idp"] == r["idr"] == Fraction(2, 3)


def test_one_switch_against_one_false_positive():
    gt = [{1: P1}] * 100
    switch = [{"a": P1}] * 50 + [{"b": P1}] * 50
    assert idf1(gt, switch)["idf1"] == HALF
    extra = [{"a": P1}] * 100
    extra[37] = {"a": P1, "z": P2}
    assert idf1(gt, extra)["idf1"] == Fraction(200, 201)


def test_perfect_and_empty():
    gt = [{1: P1, 2: P2}] * 3
    assert idf1(gt, gt)["idf1"] == 1
    r = idf1(gt, [{}] * 3)
    assert (r["idf1"], r["idr"], r["idp"]) == (0, 0, None)


def test_matching_against_brute_force():
    rng = random.Random(1)
    for _ in range(300):
        r, c = rng.randint(1, 4), rng.randint(1, 4)
        n = [[rng.randint(0, 6) for _ in range(c)] for _ in range(r)]
        pairs, total = max_overlap_matching(n)
        assert len({i for i, _ in pairs}) == len(pairs) == len({j for _, j in pairs})
        assert total == brute_max_total(n)


def random_box(rng):
    x, y = rng.randint(0, 10), rng.randint(0, 10)
    return (x, y, x + rng.randint(3, 6), y + rng.randint(3, 6))


def random_sequence(rng):
    start = {o: random_box(rng) for o in range(3)}
    names = {o: "abc"[o] for o in range(3)}
    gt_frames, hyp_frames = [], []
    for t in range(rng.randint(1, 8)):
        gt, hyp = {}, {}
        for o, b in start.items():
            if rng.random() < 0.8:
                gt[o] = (b[0] + t, b[1], b[2] + t, b[3])
                if rng.random() < 0.2:
                    names[o] = rng.choice("abcde")
                if rng.random() < 0.8 and names[o] not in hyp:
                    dx = rng.randint(-1, 1)
                    hyp[names[o]] = (gt[o][0] + dx, gt[o][1], gt[o][2] + dx, gt[o][3])
        if rng.random() < 0.3:
            hyp["z"] = random_box(rng)
        gt_frames.append(gt)
        hyp_frames.append(hyp)
    return gt_frames, hyp_frames


def frame_max_matches(gt, hyp):
    objs, hyps = list(gt), list(hyp)
    best = 0
    for k in range(min(len(objs), len(hyps)) + 1):
        for rs in itertools.combinations(objs, k):
            for cs in itertools.permutations(hyps, k):
                if all(iou(gt[o], hyp[h]) >= HALF for o, h in zip(rs, cs)):
                    best = max(best, k)
    return best


def test_dummy_node_form_and_detection_bound():
    rng = random.Random(2)
    for _ in range(80):
        gt_frames, hyp_frames = random_sequence(rng)
        _, _, n, glen, hlen = overlap_counts(gt_frames, hyp_frames)
        r = idf1(gt_frames, hyp_frames)
        assert r["idtp"] == brute_max_total(n)
        # the minimum cost of the form of the paper is IDFN + IDFP
        assert min_cost_with_dummy_nodes(n, glen, hlen) == r["idfn"] + r["idfp"]
        assert r["idfn"] + r["idtp"] == sum(glen)
        assert r["idfp"] + r["idtp"] == sum(hlen)
        # IDF1 is at most the F1 of detections with the best matching in each frame
        tp = sum(frame_max_matches(g, h) for g, h in zip(gt_frames, hyp_frames))
        total = sum(glen) + sum(hlen)
        if total:
            assert r["idf1"] <= Fraction(2 * tp, total)
            assert r["idf1"] == 2 / (1 / r["idp"] + 1 / r["idr"]) if r["idtp"] else r["idf1"] == 0


def test_symmetry():
    rng = random.Random(3)
    for _ in range(40):
        gt_frames, hyp_frames = random_sequence(rng)
        a = idf1(gt_frames, hyp_frames)
        b = idf1(hyp_frames, gt_frames)
        assert a["idtp"] == b["idtp"] and a["idf1"] == b["idf1"]
        assert (a["idp"], a["idr"]) == (b["idr"], b["idp"])

References

  1. Ergys Ristani, Francesco Solera, Roger S. Zou, Rita Cucchiara and Carlo Tomasi, Performance measures and a data set for multi-target, multi-camera tracking, ECCV 2016 Workshops, 17-35, Section 3.3 (the bipartite graph with false positive and false negative nodes, Eq. 3 and Eq. 4), Section 3.4 (IDFN, IDFP and IDTP, Eq. 6 to 8, and IDP, IDR and IDF1, Eq. 9 to 11), Figure 1 (the comparison with the counts of events)
  2. Keni Bernardin and Rainer Stiefelhagen, Evaluating multiple object tracking performance: the CLEAR MOT metrics, EURASIP Journal on Image and Video Processing 2008, article 246309, the definitions of MOTA and of the mismatch count, which IDF1 is compared with
  3. Jonathon Luiten, Aljosa Osep, Patrick Dendorfer, Philip Torr, Andreas Geiger, Laura Leal-Taixe and Bastian Leibe, HOTA: a higher order metric for evaluating multi-object tracking, International Journal of Computer Vision 129(2), 2021, 548-578, Section 4.2 (IDF1 in the notation of HOTA) and Section 7 (detection matching against trajectory matching, and why IDF1 can fall when detection improves)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH2 full proof
  • correctness: no review record reviews/QK543C/proof-correctness.yaml
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/QK543C/text.yaml