class_docstr: Abstract class to calculate the TP, FP, FN and runs an evaluating function on the result.
  
  Parameters
  ----------
  iou_thres: float, default: 0.5
      IoU below this threshold will be ignored.
  confidence_thres: float, default: 0.5
      Confidence below this threshold will be ignored.
  evaluating_function: Union[Callable, str], default: "recall"
      will run on each class result i.e `func(tp, fp, fn)`
  averaging_method : str, default: 'per_class'
      Determines which averaging method to apply, possible values are:
      'per_class': Return a np array with the scores for each class (sorted by class name).
      'binary': Returns the score for the positive class. Should be used only in binary classification cases.
      'micro': Returns the micro-averaged score.
      'macro': Returns the mean of scores per class.
      'weighted': Returns a weighted mean of scores based of the class size in y_true.
class_docstr_tok: ["Abstract","class","to","calculate","the","TP",",","FP",",","FN","and","runs","an","evaluating","function","on","the","result",".","Parameters","--","--","--","--","--","iou_thres",":","float",",","default",":","0.5","IoU","below","this","threshold","will","be","ignored",".","confidence_thres",":","float",",","default",":","0.5","Confidence","below","this","threshold","will","be","ignored",".","evaluating_function",":","Union","[","Callable",",","str","]",",","default",":","``","recall","''","will","run","on","each","class","result","i.e","`","func","(","tp",",","fp",",","fn",")","`","averaging_method",":","str",",","default",":","'per_class'","Determines","which","averaging","method","to","apply",",","possible","values","are",":","'per_class","'",":","Return","a","np","array","with","the","scores","for","each","class","(","sorted","by","class","name",")",".","'binary","'",":","Returns","the","score","for","the","positive","class",".","Should","be","used","only","in","binary","classification","cases",".","'micro","'",":","Returns","the","micro-averaged","score",".","'macro","'",":","Returns","the","mean","of","scores","per","class",".","'weighted","'",":","Returns","a","weighted","mean","of","scores","based","of","the","class","size","in","y_true","."]
docstr: Group gts and dts on a imageXclass basis.
docstr_tok: ["Group","gts","and","dts","on","a","imageXclass","basis","."]
code: def _group_detections(self, detected, ground_truth):
      """Group gts and dts on a imageXclass basis."""
      # Calculating pairwise IoUs on classes
      bb_info = self.group_class_detection_label(detected, ground_truth)
      ious = {
          k: self.calc_pairwise_ious(v["detected"], v["ground_truth"])
          for k, v in bb_info.items()
      }
  
      for class_id in ious.keys():
          tp, fp, fn = self._evaluate_image(
              np.array(
                  self.get_confidences(bb_info[class_id]["detected"])
              ),
              bb_info[class_id]["ground_truth"],
              ious[class_id],
          )
  
          acc = self._evals[class_id]
          acc["tp"] += tp
          acc["fp"] += fp
          acc["fn"] += fn
  
imports: import typing
  from collections import defaultdict
  import numpy
  from ignite.metrics import Metric
  from ignite.metrics.metric import reinit__is_reduced, sync_all_reduce
  from deepchecks.utils.metrics import averaging_mechanism
  from deepchecks.vision.metrics_utils.confusion_matrix_counts_metrics import AVAILABLE_EVALUATING_FUNCTIONS
  from deepchecks.vision.metrics_utils.metric_mixin import MetricMixin, ObjectDetectionMetricMixin
  from deepchecks.vision.vision_data.utils import is_torch_object
label_desc: Use image node_id 5 for calling the TpFpFn obj's underlying member method code with example usage: obj._group_detections(detected, ground_truth) without return types