class_docstr: Load detection dataset.
  
  Args:
      dataset_dir (str): root directory for dataset.
      image_dir (str): directory for images.
      anno_path (str): annotation file path.
      data_fields (list): key name of data dictionary, at least have 'image'.
      sample_num (int): number of samples to load, -1 means all.
      use_default_label (bool): whether to load default label list.
      repeat (int): repeat times for dataset, use in benchmark.
class_docstr_tok: ["Load","detection","dataset",".","Args",":","dataset_dir","(","str",")",":","root","directory","for","dataset",".","image_dir","(","str",")",":","directory","for","images",".","anno_path","(","str",")",":","annotation","file","path",".","data_fields","(","list",")",":","key","name","of","data","dictionary",",","at","least","have","'image","'",".","sample_num","(","int",")",":","number","of","samples","to","load",",","-1","means","all",".","use_default_label","(","bool",")",":","whether","to","load","default","label","list",".","repeat","(","int",")",":","repeat","times","for","dataset",",","use","in","benchmark","."]
code: def __getitem__(self, idx):
      n = len(self.roidbs)
      if self.repeat > 1:
          idx %= n
      # data batch
      roidb = copy.deepcopy(self.roidbs[idx])
      if self.mixup_epoch == 0 or self._epoch < self.mixup_epoch:
          idx = np.random.randint(n)
          roidb = [roidb, copy.deepcopy(self.roidbs[idx])]
      elif self.cutmix_epoch == 0 or self._epoch < self.cutmix_epoch:
          idx = np.random.randint(n)
          roidb = [roidb, copy.deepcopy(self.roidbs[idx])]
      elif self.mosaic_epoch == 0 or self._epoch < self.mosaic_epoch:
          roidb = [
              roidb,
          ] + [
              copy.deepcopy(self.roidbs[np.random.randint(n)])
              for _ in range(4)
          ]
      elif self.pre_img_epoch == 0 or self._epoch < self.pre_img_epoch:
          # Add previous image as input, only used in CenterTrack
          idx_pre_img = idx - 1
          if idx_pre_img < 0:
              idx_pre_img = idx + 1
          roidb = [
              roidb,
          ] + [copy.deepcopy(self.roidbs[idx_pre_img])]
      if isinstance(roidb, Sequence):
          for r in roidb:
              r["curr_iter"] = self._curr_iter
      else:
          roidb["curr_iter"] = self._curr_iter
      self._curr_iter += 1
  
      return self.transform(roidb)
  
imports: import os
  import copy
  import numpy
  from paddle.io import Dataset
  from ppdet.core.workspace import register, serializable
  from ppdet.utils.download import get_dataset_path
  from ppdet.data import source
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 4 for calling the DetDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: self