code: def update(self, inputs, outputs):
      bbox_np = (
          outputs["bbox"].numpy()
          if isinstance(outputs["bbox"], paddle.Tensor)
          else outputs["bbox"]
      )
      bboxes = bbox_np[:, 2:]
      scores = bbox_np[:, 1]
      labels = bbox_np[:, 0]
      bbox_lengths = (
          outputs["bbox_num"].numpy()
          if isinstance(outputs["bbox_num"], paddle.Tensor)
          else outputs["bbox_num"]
      )
  
      self.results["bbox"].append(bboxes.tolist())
      self.results["score"].append(scores.tolist())
      self.results["label"].append(labels.tolist())
  
      if bboxes.shape == (1, 1) or bboxes is None:
          return
      if self.save_prediction_only:
          return
  
      gt_boxes = inputs["gt_bbox"]
      gt_labels = inputs["gt_class"]
      difficults = (
          inputs["difficult"] if not self.evaluate_difficult else None
      )
  
      if "scale_factor" in inputs:
          scale_factor = (
              inputs["scale_factor"].numpy()
              if isinstance(inputs["scale_factor"], paddle.Tensor)
              else inputs["scale_factor"]
          )
      else:
          scale_factor = np.ones((gt_boxes.shape[0], 2)).astype(
              "float32"
          )
  
      bbox_idx = 0
      for i in range(len(gt_boxes)):
          gt_box = (
              gt_boxes[i].numpy()
              if isinstance(gt_boxes[i], paddle.Tensor)
              else gt_boxes[i]
          )
          h, w = scale_factor[i]
          gt_box = gt_box / np.array([w, h, w, h])
          gt_label = (
              gt_labels[i].numpy()
              if isinstance(gt_labels[i], paddle.Tensor)
              else gt_labels[i]
          )
          if difficults is not None:
              difficult = (
                  difficults[i].numpy()
                  if isinstance(difficults[i], paddle.Tensor)
                  else difficults[i]
              )
          else:
              difficult = None
          bbox_num = bbox_lengths[i]
          bbox = bboxes[bbox_idx : bbox_idx + bbox_num]
          score = scores[bbox_idx : bbox_idx + bbox_num]
          label = labels[bbox_idx : bbox_idx + bbox_num]
          gt_box, gt_label, difficult = prune_zero_padding(
              gt_box, gt_label, difficult
          )
          self.detection_map.update(
              bbox, score, label, gt_box, gt_label, difficult
          )
          bbox_idx += bbox_num
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import sys
  import json
  import paddle
  import numpy
  import typing
  from collections import defaultdict
  from pathlib import Path
  from .map_utils import prune_zero_padding, DetectionMAP
  from .coco_utils import get_infer_results, cocoapi_eval
  from .widerface_utils import face_eval_run
  from ppdet.data.source.category import get_categories
  from ppdet.modeling.rbox_utils import poly2rbox_np
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 3 for calling the VOCMetric obj's underlying member method code with example usage: obj.update(inputs, outputs) without return types