Skip to content

MinCostMatching may return incorrect result with infinite edges #8

@jvlmdr

Description

@jvlmdr

Note: This bug did not seem to change the results for any tracker on the MOT17 train set.

There is a small bug that can cause MinCostMatching() to return the wrong solution when there are infinite-cost edges.
Minimum working example:

MinCostMatching([inf 4 2; 1 inf inf; 5 inf inf])

Expected result: (* could be 0 or 1)

   0   0   1
   1   0   0
   0   *   0

Actual result:

   0   1   0
   1   0   0
   0   0   1

From what I've seen, this bug only occurs when the optimal solution is not a perfect matching (i.e. in the example above, the largest matching contains 2 edges, not 3). It seems like it can be fixed by either avoiding the use of infinite-cost edges or by modifying this line:

alldist[i][j] = distMatrix[j*nOfRows + i];

to be:

alldist[i][j] = min(INF, distMatrix[j*nOfRows + i]);

Alternatively, one could change the comparison to use < INF instead of != INF:

if (Lmate[i] < nOfColumns && alldist[i][Lmate[i]] != INF)

This issue does not affect clearMOTMex() since it is aware of INF when it constructs the cost matrix.

It could affect IDmeasures.m, but perhaps it has no impact in practice because a perfect matching always exists.

If MinCostMatching() is used instead of Hungarian() in preprocessResult.m, then it is important to consider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions