:orphan: :py:mod:`traccuracy.matchers._compute_overlap` ============================================== .. py:module:: traccuracy.matchers._compute_overlap .. autoapi-nested-parse:: 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 ~~~~~~~~~ .. autoapisummary:: traccuracy.matchers._compute_overlap.graph_bbox_and_labels traccuracy.matchers._compute_overlap.get_labels_with_overlap traccuracy.matchers._compute_overlap.compute_overlap traccuracy.matchers._compute_overlap.compute_overlap_3D Attributes ~~~~~~~~~~ .. autoapisummary:: traccuracy.matchers._compute_overlap.signature .. py:function:: 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] 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. :param graph: The graph to get the bounding boxes and labels from. :type graph: nx.DiGraph :param nodes: The nodes to get the bounding boxes and labels for. :type nodes: list[Hashable] :param label_key: The key to use for the labels. Defaults to 'segmentation_id'. :type label_key: str, optional :returns: The bounding boxes and labels for the nodes. :rtype: tuple[np.ndarray | None, np.ndarray | None] .. py:function:: 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]] Get all labels IDs in gt_frame and res_frame whose bounding boxes overlap, and a metric of pixel overlap (either ``iou`` or ``iogt``). :param gt_frame: ground truth segmentation for a single frame :type gt_frame: np.ndarray :param res_frame: result segmentation for a given frame :type res_frame: np.ndarray :param gt_boxes: ground truth bounding boxes for a single frame :type gt_boxes: np.ndarray :param res_boxes: result bounding boxes for a given frame :type res_boxes: np.ndarray :param gt_labels: ground truth labels for a single frame :type gt_labels: np.ndarray :param res_labels: result labels for a given frame :type res_labels: np.ndarray :param overlap: Choose between intersection-over-ground-truth (``iogt``) or intersection-over-union (``iou``). Defaults to ``iou``. :type overlap: str, optional 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). .. py:function:: compute_overlap(boxes: numpy.ndarray, query_boxes: numpy.ndarray) -> numpy.ndarray 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 .. py:function:: compute_overlap_3D(boxes: numpy.ndarray, query_boxes: numpy.ndarray) -> numpy.ndarray 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 .. py:data:: signature