code: def _generate_coco_inputs(iou_type):
      """Generates inputs for the MAP metric.
  
      The inputs are generated from the official COCO results json files:
      https://github.com/cocodataset/cocoapi/tree/master/results
      and should therefore correspond directly to the result on the webpage
  
      """
      batched_preds, batched_target = MeanAveragePrecision.coco_to_tm(
          _DETECTION_BBOX if iou_type == "bbox" else _DETECTION_SEGM,
          _DETECTION_VAL,
          iou_type,
      )
  
      # create 10 batches of 10 preds/targets each
      batched_preds = [
          batched_preds[10 * i : 10 * (i + 1)] for i in range(10)
      ]
      batched_target = [
          batched_target[10 * i : 10 * (i + 1)] for i in range(10)
      ]
      return batched_preds, batched_target
  
imports: import contextlib
  import io
  import json
  from copy import deepcopy
  from functools import partial
  from itertools import product
  import numpy
  import pytest
  import torch
  from lightning_utilities import apply_to_collection
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from torch import IntTensor, Tensor
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  from torchmetrics.utilities.imports import _FASTER_COCO_EVAL_AVAILABLE, _PYCOCOTOOLS_AVAILABLE, _TORCHVISION_GREATER_EQUAL_0_8
  from unittests.detection import _DETECTION_BBOX, _DETECTION_SEGM, _DETECTION_VAL
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 2 for calling a global function with example usage: _generate_coco_inputs(iou_type) and returns: batched_preds,  batched_target