code: def update(self, sample_dict, pp_out_dict):
      sem_label = sample_dict["sem_label"].squeeze().numpy()
      preds = self.convert_pred_map(
          pp_out_dict["sem_prob"].squeeze(0).numpy(),
          pp_out_dict["pan_pred"].squeeze().numpy(),
      )
      gts = self.convert_gt_map(
          sem_label, sample_dict["ins_label"].squeeze().numpy()
      )
      ignore_mask = sem_label == self.ignore_index
      pred_instances, gt_instances = self.get_instances(
          preds, gts, ignore_mask=ignore_mask
      )
  
      for i in range(self.num_classes):
          if i not in self.thing_ids:
              continue
          for oi, oth in enumerate(self.overlaps):
              cur_true = np.ones((len(gt_instances[i])))
              cur_score = np.ones(len(gt_instances[i])) * (
                  -float("inf")
              )
              cur_match = np.zeros(len(gt_instances[i]), dtype=bool)
              for gti, gt_instance in enumerate(gt_instances[i]):
                  found_match = False
                  for pred_instance in gt_instance["matched_pred"]:
                      overlap = float(pred_instance["intersection"]) / (
                          gt_instance["pixel_count"]
                          + pred_instance["pixel_count"]
                          - pred_instance["intersection"]
                      )
                      if overlap > oth:
                          confidence = pred_instance["confidence"]
  
                          # If we already have a prediction for this groundtruth
                          # the prediction with the lower score is automatically a false positive
                          if cur_match[gti]:
                              max_score = max(
                                  cur_score[gti], confidence
                              )
                              min_score = min(
                                  cur_score[gti], confidence
                              )
                              cur_score = max_score
                              # append false positive
                              cur_true = np.append(cur_true, 0)
                              cur_score = np.append(
                                  cur_score, min_score
                              )
                              cur_match = np.append(cur_match, True)
                          # otherwise set score
                          else:
                              found_match = True
                              cur_match[gti] = True
                              cur_score[gti] = confidence
  
                  if not found_match:
                      self.hard_fns[i][oi] += 1
              # Remove not-matched ground truth instances
              cur_true = cur_true[cur_match == True]
              cur_score = cur_score[cur_match == True]
  
              # Collect not-matched predictions as false positive
              for pred_instance in pred_instances[i]:
                  found_gt = False
                  for gt_instance in pred_instance["matched_gt"]:
                      overlap = float(gt_instance["intersection"]) / (
                          gt_instance["pixel_count"]
                          + pred_instance["pixel_count"]
                          - gt_instance["intersection"]
                      )
                      if overlap > oth:
                          found_gt = True
                          break
                  if not found_gt:
                      proportion_ignore = 0
                      if ignore_mask is not None:
                          nb_ignore_pixels = pred_instance[
                              "void_intersection"
                          ]
                          proportion_ignore = (
                              float(nb_ignore_pixels)
                              / pred_instance["pixel_count"]
                          )
                      if proportion_ignore <= oth:
                          cur_true = np.append(cur_true, 0)
                          cur_score = np.append(
                              cur_score, pred_instance["confidence"]
                          )
              self.y_true[i][oi] = np.append(
                  self.y_true[i][oi], cur_true
              )
              self.y_score[i][oi] = np.append(
                  self.y_score[i][oi], cur_score
              )
  
file_path: PaddleSeg/contrib/PanopticSeg/paddlepanseg/utils/evaluation/ins_seg_evaluator.py
imports: from collections import defaultdict
  import numpy
  from paddlepanseg.cvlibs import build_info_dict
  from paddlepanseg.utils import decode_pan_id, is_crowd
  from .evaluator import Evaluator
label_desc: Use image node_id 2 for calling the InsSegEvaluator obj's underlying member method code with example usage: obj.update(sample_dict, pp_out_dict) without return types