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 __init__(self, root, dataset="train", size=(640, 640)):
      assert dataset in [
          "train",
          "val",
      ], 'dataset must be in ["train", "val"]'
      anno_file = "instances_{}2017.json".format(dataset)
      assert os.path.exists(root), "file '{}' does not exist.".format(
          root
      )
      self.img_root = os.path.join(root, "{}2017".format(dataset))
      assert os.path.exists(
          self.img_root
      ), "path '{}' does not exist.".format(self.img_root)
      self.anno_path = os.path.join(root, "annotations", anno_file)
      assert os.path.exists(
          self.anno_path
      ), "file '{}' does not exist.".format(self.anno_path)
  
      self.mode = dataset
      self.size = size
      self.coco = COCO(self.anno_path)
  
      self.coco91_id2classes = dict(
          [(v["id"], v["name"]) for k, v in self.coco.cats.items()]
      )
      coco90_classes2id = dict(
          [(v["name"], v["id"]) for k, v in self.coco.cats.items()]
      )
  
      self.coco80_classes = coco80_names
      self.coco_id80_to_id91 = dict(
          [
              (i, coco90_classes2id[k])
              for i, k in enumerate(coco80_names)
          ]
      )
  
      ids = list(sorted(self.coco.imgs.keys()))
  
      # 移除没有目标，或者目标面积非常小的数据
      valid_ids = _coco_remove_images_without_annotations(
          self.coco, ids
      )
      self.ids = valid_ids
  
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 1 to create a new MyDataLoader object from inherited base classes: DataLoader with example: obj = MyDataLoader(root, dataset, size)