code: def cocoeval_torchmetrics(outputs: List):
      """
      Evaluate predictor's output using torchmetrics' mAP implementation: https://github.com/Lightning-AI/metrics
  
      Parameters
      ----------
      outputs
          The predictor's output. It is a list with length equals number of images.
  
      Returns
      -------
      The mAP result.
      """
  
      map_metric = MeanAveragePrecision(
          box_format="xyxy", iou_type="bbox", class_metrics=False
      )
  
      preds = []
      target = []
      for per_img_outputs in outputs:  # TODO: refactor here
          preds.append(
              dict(
                  boxes=per_img_outputs[BBOX]["bboxes"].to("cpu"),
                  scores=per_img_outputs[BBOX]["scores"].to("cpu"),
                  labels=per_img_outputs[BBOX]["labels"].to("cpu"),
              )
          )
  
          target.append(
              dict(
                  boxes=per_img_outputs[LABEL]["bboxes"].to("cpu"),
                  labels=per_img_outputs[LABEL]["labels"].to("cpu"),
              )
          )
  
      map_metric.update(preds, target)
  
      return map_metric.compute()
  
imports: import json
  import logging
  import os
  import warnings
  from pathlib import Path
  from typing import Dict, Iterable, List, Optional, Union
  import defusedxml.ElementTree
  import numpy
  import pandas
  import PIL
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  from ..constants import BBOX, LABEL, MAP, MAP_50, MAP_75, MAP_LARGE, MAP_MEDIUM, MAP_SMALL, MAR_1, MAR_10, MAR_100, MAR_LARGE, MAR_MEDIUM, MAR_SMALL, MEAN_AVERAGE_PRECISION
  from .download import download, is_url
label_desc: Use image node_id 19 for calling a global function with example usage: cocoeval_torchmetrics(outputs) and returns: map_metric