-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ID and HOTA metric performance improvements (#23)
* Improve ID metrics to use less memory * Improve HOTA and ID metrics computation * One more simplification
- Loading branch information
Showing
5 changed files
with
117 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "0.1.7" | ||
__version__ = "0.1.8" | ||
|
||
from .metrics import MOTMetrics # noqa: F401 | ||
from .tracks import Tracks # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import typing as t | ||
|
||
import numpy as np | ||
from scipy import sparse | ||
|
||
|
||
def create_coo_array( | ||
vals_dict: t.Dict[t.Tuple[int, int], int], shape: t.Tuple[int, int] | ||
) -> sparse.coo_array: | ||
"""Create a sparse COO array. | ||
Args: | ||
vals_dict: A dictionary with values. The key should be a tuple of | ||
``(row_ind, col_ind)``, and the value should be the entry for the cell | ||
at that index. | ||
shape: Shape of the new array: ``(n_rows, n_cols)`` | ||
""" | ||
row_inds = np.array(tuple(x[0] for x in vals_dict.keys())) | ||
col_inds = np.array(tuple(x[1] for x in vals_dict.keys())) | ||
vals = np.array(tuple(vals_dict.values())) | ||
|
||
return sparse.coo_array((vals, (row_inds, col_inds)), shape=shape) |