class_docstr: Computes label and prediction pairs for object detection.
class_docstr_tok: ["Computes","label","and","prediction","pairs","for","object","detection","."]
docstr: Initialize the preprocessor for bounding box match.
  
  Args:
    class_id: Used for object detection, the class id for calculating metrics.
      It must be provided if use_object_detection is True.
    iou_threshold: (Optional) Used for object detection, threholds for a
      detection and ground truth pair with specific iou to be considered as a
      match.
    area_range: (Optional) Used for object detection, the area-range for
      objects to be considered for metrics.
    max_num_detections: (Optional) Used for object detection, the maximum
      number of detections for a single image.
    class_weight: (Optional) Used for object detection, the weight associated
      with the object class id.
    name: (Optional) name for the preprocessor.
    labels_to_stack: (Optional) Keys for columns to be stacked as a single
      numpy array as the labels. It is searched under the key labels, features
      and transformed features. The desired format is [left bounadary, top
      boudnary, right boundary, bottom boundary, class id]. e.g. ['xmin',
      'ymin', 'xmax', 'ymax', 'class_id']
    predictions_to_stack: (Optional) Keys for columns to be stacked as a
      single numpy array as the prediction. It should be the model's output
      names. The desired format is [left bounadary, top boudnary, right
      boundary, bottom boundary, class id, confidence score]. e.g. ['xmin',
      'ymin', 'xmax', 'ymax', 'class_id', 'scores']
    num_detections_key: (Optional) Number of detections in each column except
      the paddings.
    allow_missing_key: (Optional) If true, the preprocessor will return empty
      array instead of raising errors.
    model_name: Optional model name (if multi-model evaluation).
docstr_tok: ["Initialize","the","preprocessor","for","bounding","box","match",".","Args",":","class_id",":","Used","for","object","detection",",","the","class","id","for","calculating","metrics",".","It","must","be","provided","if","use_object_detection","is","True",".","iou_threshold",":","(","Optional",")","Used","for","object","detection",",","threholds","for","a","detection","and","ground","truth","pair","with","specific","iou","to","be","considered","as","a","match",".","area_range",":","(","Optional",")","Used","for","object","detection",",","the","area-range","for","objects","to","be","considered","for","metrics",".","max_num_detections",":","(","Optional",")","Used","for","object","detection",",","the","maximum","number","of","detections","for","a","single","image",".","class_weight",":","(","Optional",")","Used","for","object","detection",",","the","weight","associated","with","the","object","class","id",".","name",":","(","Optional",")","name","for","the","preprocessor",".","labels_to_stack",":","(","Optional",")","Keys","for","columns","to","be","stacked","as","a","single","numpy","array","as","the","labels",".","It","is","searched","under","the","key","labels",",","features","and","transformed","features",".","The","desired","format","is","[","left","bounadary",",","top","boudnary",",","right","boundary",",","bottom","boundary",",","class","id","]",".","e.g",".","[","'xmin","'",",","'ymin","'",",","'xmax","'",",","'ymax","'",",","'class_id","'","]","predictions_to_stack",":","(","Optional",")","Keys","for","columns","to","be","stacked","as","a","single","numpy","array","as","the","prediction",".","It","should","be","the","model","'s","output","names",".","The","desired","format","is","[","left","bounadary",",","top","boudnary",",","right","boundary",",","bottom","boundary",",","class","id",",","confidence","score","]",".","e.g",".","[","'xmin","'",",","'ymin","'",",","'xmax","'",",","'ymax","'",",","'class_id","'",",","'scores","'","]","num_detections_key",":","(","Optional",")","Number","of","detections","in","each","column","except","the","paddings",".","allow_missing_key",":","(","Optional",")","If","true",",","the","preprocessor","will","return","empty","array","instead","of","raising","errors",".","model_name",":","Optional","model","name","(","if","multi-model","evaluation",")","."]
code: def __init__(
      self,
      class_id: int,
      iou_threshold: Optional[float] = 0.5,
      area_range: Tuple[float, float] = (0, float("inf")),
      max_num_detections: Optional[int] = None,
      class_weight: Optional[float] = None,
      name: Optional[str] = None,
      labels_to_stack: Optional[List[str]] = None,
      predictions_to_stack: Optional[List[str]] = None,
      num_detections_key: Optional[str] = None,
      allow_missing_key: bool = False,
      model_name: str = "",
  ):
      """Initialize the preprocessor for bounding box match.
  
      Args:
        class_id: Used for object detection, the class id for calculating metrics.
          It must be provided if use_object_detection is True.
        iou_threshold: (Optional) Used for object detection, threholds for a
          detection and ground truth pair with specific iou to be considered as a
          match.
        area_range: (Optional) Used for object detection, the area-range for
          objects to be considered for metrics.
        max_num_detections: (Optional) Used for object detection, the maximum
          number of detections for a single image.
        class_weight: (Optional) Used for object detection, the weight associated
          with the object class id.
        name: (Optional) name for the preprocessor.
        labels_to_stack: (Optional) Keys for columns to be stacked as a single
          numpy array as the labels. It is searched under the key labels, features
          and transformed features. The desired format is [left bounadary, top
          boudnary, right boundary, bottom boundary, class id]. e.g. ['xmin',
          'ymin', 'xmax', 'ymax', 'class_id']
        predictions_to_stack: (Optional) Keys for columns to be stacked as a
          single numpy array as the prediction. It should be the model's output
          names. The desired format is [left bounadary, top boudnary, right
          boundary, bottom boundary, class id, confidence score]. e.g. ['xmin',
          'ymin', 'xmax', 'ymax', 'class_id', 'scores']
        num_detections_key: (Optional) Number of detections in each column except
          the paddings.
        allow_missing_key: (Optional) If true, the preprocessor will return empty
          array instead of raising errors.
        model_name: Optional model name (if multi-model evaluation).
      """
      if not name:
          name = metric_util.generate_private_name_from_arguments(
              _DEFAULT_BOUNDING_BOX_MATCH_PREPROCESSOR_NAME,
              class_id=class_id,
              iou_threshold=iou_threshold,
              area_range=area_range,
              max_num_detections=max_num_detections,
              class_weight=class_weight,
          )
      if not area_range:
          area_range = _DEFAULT_AREA_RANGE
      if iou_threshold is None:
          iou_threshold = _DEFAULT_IOU_THRESHOLD
      super().__init__(name=name)
      self._threshold = iou_threshold
      self._class_id = class_id
      self._area_range = area_range
      self._max_num_detections = max_num_detections
      self._class_weight = class_weight
      self._labels_to_stack = labels_to_stack
      self._predictions_to_stack = predictions_to_stack
      self._num_detections_key = num_detections_key
      self._allow_missing_key = allow_missing_key
      self._model_name = model_name
  
file_path: model-analysis/tensorflow_model_analysis/metrics/preprocessors/object_detection_preprocessors.py
imports: from typing import Iterator, List, Optional, Tuple
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics.preprocessors.utils import bounding_box
  from tensorflow_model_analysis.metrics.preprocessors.utils import box_match
  from tensorflow_model_analysis.metrics.preprocessors.utils import object_detection_format
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 1 to create a new BoundingBoxMatchPreprocessor object from inherited base classes: metric_types with example: obj = BoundingBoxMatchPreprocessor(class_id, iou_threshold, area_range, max_num_detections, class_weight, name, labels_to_stack, predictions_to_stack, num_detections_key, allow_missing_key, model_name)