class_docstr: `MS Coco Detection <https://cocodataset.org/>`_ Dataset.
  
  Args:
      root (string): Root directory where images are downloaded to.
      dataset (string): "train" or "val.
      size (tuple): (h, w)
code: def parse_targets(
      self,
      coco_targets: list,
      w: int = None,
      h: int = None,
      ratio: tuple = None,
      pad: tuple = None,
  ):
      assert w > 0
      assert h > 0
  
      # 只筛选出单个对象的情况
      anno = [obj for obj in coco_targets if obj["iscrowd"] == 0]
  
      boxes = [obj["bbox"] for obj in anno]
  
      # guard against no boxes via resizing
      boxes = np.array(boxes, dtype=np.float32).reshape(-1, 4)
      # [xmin, ymin, w, h] -> [xmin, ymin, xmax, ymax]
      boxes[:, 2:] += boxes[:, :2]
      boxes[:, 0::2] = np.clip(boxes[:, 0::2], a_min=0, a_max=w)
      boxes[:, 1::2] = np.clip(boxes[:, 1::2], a_min=0, a_max=h)
  
      classes = [
          self.coco80_classes.index(
              self.coco91_id2classes[obj["category_id"]]
          )
          for obj in anno
      ]
      classes = np.array(classes, dtype=int)
  
      # 筛选出合法的目标，即x_max>x_min且y_max>y_min
      keep = (boxes[:, 3] > boxes[:, 1]) & (boxes[:, 2] > boxes[:, 0])
      boxes = boxes[keep]
      classes = classes[keep]
  
      if ratio is not None:
          # width, height ratios
          boxes[:, 0::2] *= ratio[0]
          boxes[:, 1::2] *= ratio[1]
  
      if pad is not None:
          # dw, dh padding
          dw, dh = pad
          boxes[:, 0::2] += dw
          boxes[:, 1::2] += dh
  
      target_annotations = []
      for i in range(boxes.shape[0]):
          target_annotation = {
              "category_id": int(classes[i]),
              "bbox": boxes[i].tolist(),
          }
          target_annotations.append(target_annotation)
  
      return target_annotations
  
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 2 for calling the MyDataLoader obj's underlying member method code with example usage: obj.parse_targets(coco_targets, w, h, ratio, pad) and returns: target_annotations