class_docstr: Dataset for image detection.
  
  Args:
     transform(callmethod) : The method of preprocess images.
     mode(str): The mode for preparing dataset.
  
  Returns:
      DataSet: An iterable object for data iterating
class_docstr_tok: ["Dataset","for","image","detection",".","Args",":","transform","(","callmethod",")",":","The","method","of","preprocess","images",".","mode","(","str",")",":","The","mode","for","preparing","dataset",".","Returns",":","DataSet",":","An","iterable","object","for","data","iterating"]
code: def __init__(
      self, transform: Callable, size: int = 416, mode: str = "train"
  ):
      self.mode = mode
      self.transform = transform
      self.size = size
  
      if self.mode == "train":
          train_file_list = "annotations/instances_train2017.json"
          train_data_dir = "train2017"
          self.train_file_list = os.path.join(
              DATA_HOME, "voc", train_file_list
          )
          self.train_data_dir = os.path.join(
              DATA_HOME, "voc", train_data_dir
          )
          self.COCO = COCO(self.train_file_list)
          self.img_dir = self.train_data_dir
  
      elif self.mode == "test":
          val_file_list = "annotations/instances_val2017.json"
          val_data_dir = "val2017"
          self.val_file_list = os.path.join(
              DATA_HOME, "voc", val_file_list
          )
          self.val_data_dir = os.path.join(
              DATA_HOME, "voc", val_data_dir
          )
          self.COCO = COCO(self.val_file_list)
          self.img_dir = self.val_data_dir
  
      parse_dataset_catagory = DetectCatagory(self.COCO, self.img_dir)
      (
          self.label_names,
          self.label_ids,
          self.category_to_id_map,
      ) = parse_dataset_catagory()
      parse_images = ParseImages(
          self.COCO, self.img_dir, self.category_to_id_map
      )
      self.data = parse_images()
  
imports: import os
  import copy
  from typing import Callable
  import paddle
  import numpy
  from paddlehub.env import DATA_HOME
  from pycocotools.coco import COCO
label_desc: Use image node_id 1 to create a new DetectionData object from inherited base classes: paddle.io with example: obj = DetectionData(transform, size, mode)