spine.utils.match
Functions to find the best overlaps between point sets.
Functions
|
Compute the size of the intersection of two sorted unique arrays. |
|
Computes a set overlap matrix by Chamfer distance. |
|
Computes a set overlap matrix by overlap count. |
|
Computes a set overlap matrix by Dice coefficient. |
|
Computes a set overlap matrix by IoU. |
|
Computes a set overlap matrix by Dice coefficient, weighted by the set sizes. |
|
Computes a set overlap matrix by IoU, weighted by the set sizes. |
- spine.utils.match.overlap_count(index_x: List(array(int64, 1d, A), False), index_y: List(array(int64, 1d, A), False)) -> Array(int64, 2, 'A', False, aligned=True)[source]
Computes a set overlap matrix by overlap count.
- Parameters:
index_x (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to match
index_y (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to be matched to
- Returns:
(M, N) Overlap count matrix
- Return type:
np.ndarray
- spine.utils.match.overlap_iou(index_x: List(array(int64, 1d, A), False), index_y: List(array(int64, 1d, A), False)) -> Array(float32, 2, 'A', False, aligned=True)[source]
Computes a set overlap matrix by IoU.
IoU stands for Intersection-over-Union.
- Parameters:
index_x (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to match
index_y (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to be matched to
- Returns:
(M, N) Overlap IoU matrix
- Return type:
np.ndarray
- spine.utils.match.overlap_weighted_iou(index_x: List(array(int64, 1d, A), False), index_y: List(array(int64, 1d, A), False)) -> Array(float32, 2, 'A', False, aligned=True)[source]
Computes a set overlap matrix by IoU, weighted by the set sizes.
IoU stands for Intersection-over-Union. The weighting scheme is as follows: w = abs(size_x + size_y) / (abs(size_x - size_y) + 1).
- Parameters:
index_x (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to match
index_y (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to be matched to
- Returns:
(M, N) Overlap weighted IoU matrix
- Return type:
np.ndarray
- spine.utils.match.overlap_dice(index_x: List(array(int64, 1d, A), False), index_y: List(array(int64, 1d, A), False)) -> Array(float32, 2, 'A', False, aligned=True)[source]
Computes a set overlap matrix by Dice coefficient.
The Dice coefficient corresponds to the 2 times the intersection of two sets over the sum of set sizes.
- Parameters:
index_x (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to match
index_y (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to be matched to
- Returns:
(M, N) Overlap weighted IoU matrix
- Return type:
np.ndarray
- spine.utils.match.overlap_weighted_dice(index_x: List(array(int64, 1d, A), False), index_y: List(array(int64, 1d, A), False)) -> Array(float32, 2, 'A', False, aligned=True)[source]
Computes a set overlap matrix by Dice coefficient, weighted by the set sizes.
The Dice coefficient corresponds to the 2 times the intersection of two sets over the sum of set sizes. The weighting scheme is as follows: w = abs(size_x + size_y) / (abs(size_x - size_y) + 1).
- Parameters:
index_x (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to match
index_y (nb.types.List[np.ndarray]) –
nb.types.List of tensor index, one per object to be matched to
- Returns:
(M, N) Overlap weighted IoU matrix
- Return type:
np.ndarray
- spine.utils.match.overlap_chamfer(points_x: List(array(int64, 1d, A), False), points_y: List(array(int64, 1d, A), False)) -> Array(float32, 2, 'A', False, aligned=True)[source]
Computes a set overlap matrix by Chamfer distance.
This function can match two arbitrary points clouds, hence there is no need for the two particle lists to share the same underlying voxel sets.
- Parameters:
points_x (nb.types.List[np.ndarray]) – (N, 3) nb.types.List of coordinates, one per object to match
points_y (nb.types.List[np.ndarray]) – (M, 3) nb.types.List of coordinates, one per object to be matched to
- Returns:
(M, N) Chamfer distance matrix
- Return type:
np.ndarray
Notes
Unlike the overlap metrics, this metric should be minimized.