code: def accumulate(self, preds: Collection[Prediction]):
      for pred in preds:
          target_record = pred.ground_truth
          prediction_record = pred.pred
          self.class_map = target_record.detection.class_map
          # skip if empty ground_truths
          # if not target_record.detection.bboxes:
          #     continue
          # create matches based on iou
          matches = match_records(
              target=target_record,
              prediction=prediction_record,
              iou_threshold=self._iou_threshold,
          )
  
          target_labels, predicted_labels = [], []
          # iterate over multiple targets and preds in a record
          for target_item, prediction_items in matches:
              if self._policy == MatchingPolicy.BEST_SCORE:
                  predicted_item = get_best_score_item(
                      prediction_items=prediction_items,
                  )
              elif self._policy == MatchingPolicy.BEST_IOU:
                  raise NotImplementedError
              else:
                  raise RuntimeError(
                      f"policy must be one of {list(MatchingPolicy)}"
                  )
  
              # using label_id instead of named label to save memory
              target_label = target_item["target_label_id"]
              predicted_label = predicted_item["predicted_label_id"]
              target_labels.append(target_label)
              predicted_labels.append(predicted_label)
  
          # We need to store the entire list of gts/preds to support various CM logging methods
          assert len(predicted_labels) == len(target_labels)
          self.target_labels.extend(target_labels)
          self.predicted_labels.extend(predicted_labels)
  
file_path: icevision/icevision/metrics/confusion_matrix/confusion_matrix.py
imports: from icevision.data.prediction import Prediction
  from icevision.metrics.metric import Metric
  from icevision.imports import *
  from icevision.metrics.confusion_matrix.confusion_matrix_utils import *
  import PIL
label_desc: Use image node_id 3 for calling the SimpleConfusionMatrix obj's underlying member method code with example usage: obj.accumulate(preds) without return types