code: def convert_prediction_to_coco_bbox(file_name, prediction):
      coco_results = []
      try:
          original_id = file_name_to_id[file_name]
          if len(prediction) == 0:
              return coco_results
  
          image_width = id_to_width[original_id]
          image_height = id_to_height[original_id]
          prediction = prediction.resize((image_width, image_height))
          prediction = prediction.convert("xywh")
  
          boxes = prediction.bbox.numpy().tolist()
          scores = prediction.get_field("scores").numpy().tolist()
          labels = prediction.get_field("labels").numpy().tolist()
  
          mapped_labels = [
              contiguous_category_id_to_json_id[int(i)] for i in labels
          ]
  
          coco_results.extend(
              [
                  {
                      "image_id": original_id,
                      "category_id": mapped_labels[k],
                      "bbox": box,
                      "score": scores[k],
                  }
                  for k, box in enumerate(boxes)
              ]
          )
      except Exception as e:
          print(file_name, e)
      return coco_results
  
imports: import json
  import pathlib
  import zipfile
  import numpy
  from tinygrad.helpers import fetch
  import pycocotools._mask
  from examples.mask_rcnn import Masker
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
label_desc: Use image node_id 6 for calling a global function with example usage: convert_prediction_to_coco_bbox(file_name, prediction) and returns: coco_results, coco_results