class_docstr: Abstract class to calculate average precision and recall for various vision tasks.
  
  Parameters
  ----------
  max_dets: Union[List[int], Tuple[int]], default: [1, 10, 100]
      Maximum number of detections per class.
  area_range: tuple, default: (32**2, 96**2)
      Slices for small/medium/large buckets.
  return_option: str, default: 'ap'
      ap: ap only, ar: ar only, None: all (not ignite compliant).
  average: str, default: none
      The method for averaging over the classes. If none, returns the result per class.
  iou_range: Tuple[float, float, float], default: (0.5, 0.95, 10)
      The closed range of the iou values (min, max (including), number of points)
class_docstr_tok: ["Abstract","class","to","calculate","average","precision","and","recall","for","various","vision","tasks",".","Parameters","--","--","--","--","--","max_dets",":","Union","[","List","[","int","]",",","Tuple","[","int","]","]",",","default",":","[","1",",","10",",","100","]","Maximum","number","of","detections","per","class",".","area_range",":","tuple",",","default",":","(","32","*","*","2",",","96","*","*","2",")","Slices","for","small\/medium\/large","buckets",".","return_option",":","str",",","default",":","'ap'","ap",":","ap","only",",","ar",":","ar","only",",","None",":","all","(","not","ignite","compliant",")",".","average",":","str",",","default",":","none","The","method","for","averaging","over","the","classes",".","If","none",",","returns","the","result","per","class",".","iou_range",":","Tuple","[","float",",","float",",","float","]",",","default",":","(","0.5",",","0.95",",","10",")","The","closed","range","of","the","iou","values","(","min",",","max","(","including",")",",","number","of","points",")"]
code: def __init__(
      self,
      *args,
      max_dets: Union[List[int], Tuple[int]] = (1, 10, 100),
      area_range: Tuple = (32**2, 96**2),
      return_option: Optional[str] = "ap",
      average: str = "none",
      iou_range: Tuple[float, float, float] = (0.5, 0.95, 10),
      **kwargs,
  ):
      super().__init__(*args, **kwargs)
  
      self.return_option = return_option
      if self.return_option is not None:
          max_dets = [max_dets[-1]]
          self.area_ranges_names = ["all"]
      else:
          self.area_ranges_names = ["small", "medium", "large", "all"]
      self.iou_thresholds = np.linspace(*iou_range, endpoint=True)
      self.max_detections_per_class = max_dets
      self.area_range = area_range
      if average in ["none", "macro", "weighted"]:
          self.average = average
      else:
          raise DeepchecksValueError(
              "average should be one of: 'none', 'macro', 'weighted'"
          )
  
      self.get_mean_value = self.average != "none"
  
imports: import warnings
  from collections import defaultdict
  from typing import List, Optional, Tuple, Union
  import numpy
  from ignite.metrics import Metric
  from ignite.metrics.metric import reinit__is_reduced, sync_all_reduce
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.vision.metrics_utils.metric_mixin import MetricMixin, ObjectDetectionMetricMixin
label_desc: Use image node_id 1 to create a new AveragePrecisionRecall object from inherited base classes: Metric, MetricMixin with example: obj = AveragePrecisionRecall()