docstr: Save COCO format result to given save path.
  
  Parameters
  ----------
  ret
      The returned prediction result.
  data
      The input data.
  save_path
      The save path given to store COCO format output.
code: def save_result(self, ret: List, data: pd.DataFrame, save_path: str):
      """
      Save COCO format result to given save path.
  
      Parameters
      ----------
      ret
          The returned prediction result.
      data
          The input data.
      save_path
          The save path given to store COCO format output.
      """
      coco_format_result = []
  
      for i, row in data.reset_index(drop=True).iterrows():
          image_id = self.get_image_id_from_path(row["image"])
  
          pred_result = ret[i]
          N_pred = len(pred_result["bboxes"])
          for bbox_idx in range(N_pred):
              coco_format_result.append(
                  {
                      "image_id": image_id,
                      "category_id": self.category_ids[
                          int(pred_result["labels"][bbox_idx].item())
                      ],
                      "bbox": bbox_xyxy_to_xywh(
                          pred_result["bboxes"][bbox_idx].tolist()
                      ),
                      "score": pred_result["scores"][bbox_idx].item(),
                  }
              )
  
      with open(save_path, "w") as f:
          print(f"saving file at {save_path}")
          json.dump(coco_format_result, f)
  
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 3 for calling the COCODataset obj's underlying member method code with example usage: obj.save_result(ret, data, save_path) without return types