traccuracy.matchers._compute_overlap
Fast R-CNN via numba
adapted from Fast R-CNN Written by Sergey Karayev Licensed under The MIT License [see LICENSE for details] Copyright (c) 2015 Microsoft
Module Contents
Functions
|
Get bounding boxes and labels for a list of nodes in a graph. |
|
Get all labels IDs in gt_frame and res_frame whose bounding boxes overlap, |
|
Args |
|
Args |
Attributes
- traccuracy.matchers._compute_overlap.graph_bbox_and_labels(graph: networkx.DiGraph, nodes: collections.abc.Iterable[collections.abc.Hashable], label_key: str | None = 'segmentation_id') tuple[numpy.ndarray | None, numpy.ndarray | None][source]
Get bounding boxes and labels for a list of nodes in a graph. If a node is missing the ‘bbox’ or ‘segmentation_id’ attributes, it returns None for both bounding boxes and labels.
- Parameters:
graph (nx.DiGraph) – The graph to get the bounding boxes and labels from.
nodes (list[Hashable]) – The nodes to get the bounding boxes and labels for.
label_key (str, optional) – The key to use for the labels. Defaults to ‘segmentation_id’.
- Returns:
The bounding boxes and labels for the nodes.
- Return type:
tuple[np.ndarray | None, np.ndarray | None]
- traccuracy.matchers._compute_overlap.get_labels_with_overlap(gt_frame: numpy.ndarray, res_frame: numpy.ndarray, gt_boxes: numpy.ndarray | None = None, res_boxes: numpy.ndarray | None = None, gt_labels: numpy.ndarray | None = None, res_labels: numpy.ndarray | None = None, overlap: str = 'iou') list[tuple[int, int, float]][source]
Get all labels IDs in gt_frame and res_frame whose bounding boxes overlap, and a metric of pixel overlap (either
iouoriogt).- Parameters:
gt_frame (np.ndarray) – ground truth segmentation for a single frame
res_frame (np.ndarray) – result segmentation for a given frame
gt_boxes (np.ndarray) – ground truth bounding boxes for a single frame
res_boxes (np.ndarray) – result bounding boxes for a given frame
gt_labels (np.ndarray) – ground truth labels for a single frame
res_labels (np.ndarray) – result labels for a given frame
overlap (str, optional) – Choose between intersection-over-ground-truth (
iogt) or intersection-over-union (iou). Defaults toiou.
- Returns: list[tuple[int, int, float]] A list of tuples of overlapping labels and their
overlap values. Each tuple contains (gt_label, res_label, overlap_value).
- traccuracy.matchers._compute_overlap.compute_overlap(boxes: numpy.ndarray, query_boxes: numpy.ndarray) numpy.ndarray[source]
- Args
boxes: (N, 4) ndarray of float query_boxes: (K, 4) ndarray of float
- Returns
overlaps: (N, K) ndarray of overlap between boxes and query_boxes
- traccuracy.matchers._compute_overlap.compute_overlap_3D(boxes: numpy.ndarray, query_boxes: numpy.ndarray) numpy.ndarray[source]
- Args
boxes: (N, 6) ndarray of float query_boxes: (K, 6) ndarray of float
- Returns
overlaps: (N, K) ndarray of overlap between boxes and query_boxes
- traccuracy.matchers._compute_overlap.signature