docstr: Convert network output and labels to the format that torchmetrics' MAP
  implementation expects, and call `metric.update()`.
  
  :param output: model output
  :param target: annotations for model output
code: def update(self, output, target):
      """
      Convert network output and labels to the format that torchmetrics' MAP
      implementation expects, and call `metric.update()`.
  
      :param output: model output
      :param target: annotations for model output
      """
      targetboxes = []
      targetlabels = []
      predboxes = []
      predlabels = []
      scores = []
  
      for single_target in target[0]:
          txmin, tymin, txmax, tymax = single_target["bbox"]
          category = single_target["category_id"]
  
          targetbox = [
              round(txmin),
              round(tymin),
              round(txmax),
              round(tymax),
          ]
          targetboxes.append(targetbox)
          targetlabels.append(category)
  
      output = torch.Tensor(output[0]).float()
      output = non_max_suppression(
          output,
          conf_thres=self.conf_thres,
          iou_thres=self.iou_thres,
          multi_label=True,
      )
      for single_output in output:
          for pred in single_output.numpy():
              xmin, ymin, xmax, ymax, conf, label = pred
  
              predbox = [
                  round(xmin),
                  round(ymin),
                  round(xmax),
                  round(ymax),
              ]
              predboxes.append(predbox)
              predlabels.append(label)
              scores.append(conf)
  
      preds = [
          dict(
              boxes=torch.Tensor(predboxes).float(),
              labels=torch.Tensor(predlabels).short(),
              scores=torch.Tensor(scores),
          )
      ]
      targets = [
          dict(
              boxes=torch.Tensor(targetboxes).float(),
              labels=torch.Tensor(targetlabels).short(),
          )
      ]
      self.metric.update(preds, targets)
  
imports: import os
  import time
  import json
  import copy
  import cv2
  import numpy
  import torch
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  import torchvision
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from compression.api import DataLoader, Metric
label_desc: Use image node_id 4 for calling the MAPMetric obj's underlying member method code with example usage: obj.update(output, target) without return types