class_docstr: Computes the precision of the predictions with respect to the labels.
  
  The metric uses true positives and false positives to compute precision by
  dividing the true positives by the sum of true positives and false positives.
  
  If `sample_weight` is `None`, weights default to 1.
  Use `sample_weight` of 0 to mask values.
docstr: Initializes Recall metric.
  
  The metric supports using multiple outputs to form the labels/predictions if
  the user specifies the label/predcition keys to stack. In this case, the
  metric is not expected to work with multi-outputs. The metric only supports
  multi outputs if the output of model is already pre-stacked in the expected
  format, i.e. ['xmin', 'ymin', 'xmax', 'ymax', 'class_id'] for labels and
  ['xmin', 'ymin', 'xmax', 'ymax', 'class_id', 'confidence scores'] for
  predictions.
  
  Args:
    thresholds: (Optional) A float value or a python list/tuple of float
      threshold values in [0, 1]. A threshold is compared with prediction
      values to determine the truth value of predictions (i.e., above the
      threshold is `true`, below is `false`). One metric value is generated
      for each threshold value. The default is to calculate precision with
      `thresholds=0.5`.
    name: (Optional) string name of the metric instance.
    iou_threshold: (Optional) Thresholds for a detection and ground truth pair
      with specific iou to be considered as a match. Default to 0.5
    class_id: (Optional) The class id for calculating metrics.
    class_weight: (Optional) The weight associated with the object class id.
    area_range: (Optional) A tuple (inclusive) representing the area-range for
      objects to be considered for metrics. Default to (0, inf).
    max_num_detections: (Optional) The maximum number of detections for a
      single image. Default to None.
    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) Output names 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) An output name in which to find the number
      of detections to use for evaluation for a given example. It does nothing
      if predictions_to_stack is not set. The value for this output should be
      a scalar value or a single-value tensor. The stacked predicitions will
      be truncated with the specified number of detections.
    allow_missing_key: (Optional) If true, the preprocessor will return empty
      array instead of raising errors.
docstr_tok: ["Initializes","Recall","metric",".","The","metric","supports","using","multiple","outputs","to","form","the","labels\/predictions","if","the","user","specifies","the","label\/predcition","keys","to","stack",".","In","this","case",",","the","metric","is","not","expected","to","work","with","multi-outputs",".","The","metric","only","supports","multi","outputs","if","the","output","of","model","is","already","pre-stacked","in","the","expected","format",",","i.e",".","[","'xmin","'",",","'ymin","'",",","'xmax","'",",","'ymax","'",",","'class_id","'","]","for","labels","and","[","'xmin","'",",","'ymin","'",",","'xmax","'",",","'ymax","'",",","'class_id","'",",","'confidence","scores","'","]","for","predictions",".","Args",":","thresholds",":","(","Optional",")","A","float","value","or","a","python","list\/tuple","of","float","threshold","values","in","[","0",",","1","]",".","A","threshold","is","compared","with","prediction","values","to","determine","the","truth","value","of","predictions","(","i.e.",",","above","the","threshold","is","`","true","`",",","below","is","`","false","`",")",".","One","metric","value","is","generated","for","each","threshold","value",".","The","default","is","to","calculate","precision","with","`","thresholds=0.5","`",".","name",":","(","Optional",")","string","name","of","the","metric","instance",".","iou_threshold",":","(","Optional",")","Thresholds","for","a","detection","and","ground","truth","pair","with","specific","iou","to","be","considered","as","a","match",".","Default","to","0.5","class_id",":","(","Optional",")","The","class","id","for","calculating","metrics",".","class_weight",":","(","Optional",")","The","weight","associated","with","the","object","class","id",".","area_range",":","(","Optional",")","A","tuple","(","inclusive",")","representing","the","area-range","for","objects","to","be","considered","for","metrics",".","Default","to","(","0",",","inf",")",".","max_num_detections",":","(","Optional",")","The","maximum","number","of","detections","for","a","single","image",".","Default","to","None",".","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",")","Output","names","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",")","An","output","name","in","which","to","find","the","number","of","detections","to","use","for","evaluation","for","a","given","example",".","It","does","nothing","if","predictions_to_stack","is","not","set",".","The","value","for","this","output","should","be","a","scalar","value","or","a","single-value","tensor",".","The","stacked","predicitions","will","be","truncated","with","the","specified","number","of","detections",".","allow_missing_key",":","(","Optional",")","If","true",",","the","preprocessor","will","return","empty","array","instead","of","raising","errors","."]
code: def __init__(
      self,
      thresholds: Optional[Union[float, List[float]]] = None,
      name: Optional[str] = None,
      iou_threshold: Optional[float] = None,
      class_id: Optional[int] = None,
      class_weight: Optional[float] = None,
      area_range: Optional[Tuple[float, float]] = None,
      max_num_detections: Optional[int] = 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,
  ):
      """Initializes Recall metric.
  
      The metric supports using multiple outputs to form the labels/predictions if
      the user specifies the label/predcition keys to stack. In this case, the
      metric is not expected to work with multi-outputs. The metric only supports
      multi outputs if the output of model is already pre-stacked in the expected
      format, i.e. ['xmin', 'ymin', 'xmax', 'ymax', 'class_id'] for labels and
      ['xmin', 'ymin', 'xmax', 'ymax', 'class_id', 'confidence scores'] for
      predictions.
  
      Args:
        thresholds: (Optional) A float value or a python list/tuple of float
          threshold values in [0, 1]. A threshold is compared with prediction
          values to determine the truth value of predictions (i.e., above the
          threshold is `true`, below is `false`). One metric value is generated
          for each threshold value. The default is to calculate precision with
          `thresholds=0.5`.
        name: (Optional) string name of the metric instance.
        iou_threshold: (Optional) Thresholds for a detection and ground truth pair
          with specific iou to be considered as a match. Default to 0.5
        class_id: (Optional) The class id for calculating metrics.
        class_weight: (Optional) The weight associated with the object class id.
        area_range: (Optional) A tuple (inclusive) representing the area-range for
          objects to be considered for metrics. Default to (0, inf).
        max_num_detections: (Optional) The maximum number of detections for a
          single image. Default to None.
        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) Output names 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) An output name in which to find the number
          of detections to use for evaluation for a given example. It does nothing
          if predictions_to_stack is not set. The value for this output should be
          a scalar value or a single-value tensor. The stacked predicitions will
          be truncated with the specified number of detections.
        allow_missing_key: (Optional) If true, the preprocessor will return empty
          array instead of raising errors.
      """
      super().__init__(
          thresholds=thresholds,
          name=name,
          class_id=class_id,
          iou_threshold=iou_threshold,
          area_range=area_range,
          max_num_detections=max_num_detections,
          class_weight=class_weight,
          labels_to_stack=labels_to_stack,
          predictions_to_stack=predictions_to_stack,
          num_detections_key=num_detections_key,
          allow_missing_key=allow_missing_key,
      )
  
imports: from typing import List, Optional, Tuple, Union
  from tensorflow_model_analysis.metrics import confusion_matrix_metrics
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import preprocessors
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 1 to create a new ObjectDetectionPrecision object from inherited base classes: confusion_matrix_metrics with example: obj = ObjectDetectionPrecision(thresholds, name, iou_threshold, class_id, class_weight, area_range, max_num_detections, labels_to_stack, predictions_to_stack, num_detections_key, allow_missing_key)