class_docstr: Data loader for detection dataset.
  
  .. deprecated:: 0.2.0
      :py:class:`DetectionDataLoader` is deprecated,
      please use :py:class:`mxnet.gluon.data.DataLoader` with
      batchify functions listed in `gluoncv.data.batchify` directly.
  
  It loads data batches from a dataset and then apply data
  transformations. It's a subclass of :py:class:`mxnet.gluon.data.DataLoader`,
  and therefore has very similar APIs.
  
  The main purpose of the DataLoader is to pad variable length of labels from
  each image, because they have different amount of objects.
  
  Parameters
  ----------
  dataset : mxnet.gluon.data.Dataset or numpy.ndarray or mxnet.ndarray.NDArray
      The source dataset.
  batch_size : int
      The size of mini-batch.
  shuffle : bool, default False
      If or not randomly shuffle the samples. Often use True for training
      dataset and False for validation/test datasets
  sampler : mxnet.gluon.data.Sampler, default None
      The sampler to use. We should either specify a sampler or enable
      shuffle, not both, because random shuffling is a sampling method.
  last_batch : {'keep', 'discard', 'rollover'}, default is keep
      How to handle the last batch if the batch size does not evenly divide by
      the number of examples in the dataset. There are three options to deal
      with the last batch if its size is smaller than the specified batch
      size.
  
      - keep: keep it
      - discard: throw it away
      - rollover: insert the examples to the beginning of the next batch
  batch_sampler : mxnet.gluon.data.BatchSampler
      A sampler that returns mini-batches. Do not specify batch_size,
      shuffle, sampler, and last_batch if batch_sampler is specified.
  batchify_fn : callable
      Callback function to allow users to specify how to merge samples
      into a batch.
      Defaults to :py:meth:`gluoncv.data.dataloader.default_pad_batchify_fn`::
          def default_pad_batchify_fn(data):
              if isinstance(data[0], nd.NDArray):
                  return nd.stack(*data)
              elif isinstance(data[0], tuple):
                  data = zip(*data)
                  return [pad_batchify(i) for i in data]
              else:
                  data = np.asarray(data)
                  pad = max([l.shape[0] for l in data])
                  buf = np.full((len(data), pad, data[0].shape[-1]),
                                -1, dtype=data[0].dtype)
                  for i, l in enumerate(data):
                      buf[i][:l.shape[0], :] = l
                  return nd.array(buf, dtype=data[0].dtype)
  num_workers : int, default 0
      The number of multiprocessing workers to use for data preprocessing.
      If ``num_workers`` = 0, multiprocessing is disabled.
      Otherwise ``num_workers`` multiprocessing worker is used to process data.
class_docstr_tok: ["Data","loader","for","detection","dataset",".","..","deprecated",":",":","0.2.0",":","py",":","class",":","`","DetectionDataLoader","`","is","deprecated",",","please","use",":","py",":","class",":","`","mxnet.gluon.data.DataLoader","`","with","batchify","functions","listed","in","`","gluoncv.data.batchify","`","directly",".","It","loads","data","batches","from","a","dataset","and","then","apply","data","transformations",".","It","'s","a","subclass","of",":","py",":","class",":","`","mxnet.gluon.data.DataLoader","`",",","and","therefore","has","very","similar","APIs",".","The","main","purpose","of","the","DataLoader","is","to","pad","variable","length","of","labels","from","each","image",",","because","they","have","different","amount","of","objects",".","Parameters","--","--","--","--","--","dataset",":","mxnet.gluon.data.Dataset","or","numpy.ndarray","or","mxnet.ndarray.NDArray","The","source","dataset",".","batch_size",":","int","The","size","of","mini-batch",".","shuffle",":","bool",",","default","False","If","or","not","randomly","shuffle","the","samples",".","Often","use","True","for","training","dataset","and","False","for","validation\/test","datasets","sampler",":","mxnet.gluon.data.Sampler",",","default","None","The","sampler","to","use",".","We","should","either","specify","a","sampler","or","enable","shuffle",",","not","both",",","because","random","shuffling","is","a","sampling","method",".","last_batch",":","{","'keep","'",",","'discard","'",",","'rollover","'","}",",","default","is","keep","How","to","handle","the","last","batch","if","the","batch","size","does","not","evenly","divide","by","the","number","of","examples","in","the","dataset",".","There","are","three","options","to","deal","with","the","last","batch","if","its","size","is","smaller","than","the","specified","batch","size",".","-","keep",":","keep","it","-","discard",":","throw","it","away","-","rollover",":","insert","the","examples","to","the","beginning","of","the","next","batch","batch_sampler",":","mxnet.gluon.data.BatchSampler","A","sampler","that","returns","mini-batches",".","Do","not","specify","batch_size",",","shuffle",",","sampler",",","and","last_batch","if","batch_sampler","is","specified",".","batchify_fn",":","callable","Callback","function","to","allow","users","to","specify","how","to","merge","samples","into","a","batch",".","Defaults","to",":","py",":","meth",":","`","gluoncv.data.dataloader.default_pad_batchify_fn","`",":",":","def","default_pad_batchify_fn","(","data",")",":","if","isinstance","(","data","[","0","]",",","nd.NDArray",")",":","return","nd.stack","(","*","data",")","elif","isinstance","(","data","[","0","]",",","tuple",")",":","data","=","zip","(","*","data",")","return","[","pad_batchify","(","i",")","for","i","in","data","]","else",":","data","=","np.asarray","(","data",")","pad","=","max","(","[","l.shape","[","0","]","for","l","in","data","]",")","buf","=","np.full","(","(","len","(","data",")",",","pad",",","data","[","0","]",".shape","[","-1","]",")",",","-1",",","dtype=data","[","0","]",".dtype",")","for","i",",","l","in","enumerate","(","data",")",":","buf","[","i","]","[",":","l.shape","[","0","]",",",":","]","=","l","return","nd.array","(","buf",",","dtype=data","[","0","]",".dtype",")","num_workers",":","int",",","default","0","The","number","of","multiprocessing","workers","to","use","for","data","preprocessing",".","If","``","num_workers","``","=","0",",","multiprocessing","is","disabled",".","Otherwise","``","num_workers","``","multiprocessing","worker","is","used","to","process","data","."]
code: def __init__(
      self,
      dataset,
      batch_size=None,
      shuffle=False,
      sampler=None,
      last_batch=None,
      batch_sampler=None,
      batchify_fn=None,
      num_workers=0,
  ):
      import warnings
  
      warnings.warn(
          "DetectionDataLoader is deprecated. "
          + "Please use mxnet.gluon.data.DataLoader "
          "with batchify functions directly."
      )
      if batchify_fn is None:
          if num_workers > 0:
              batchify_fn = default_mp_pad_batchify_fn
          else:
              batchify_fn = default_pad_batchify_fn
      super(DetectionDataLoader, self).__init__(
          dataset,
          batch_size,
          shuffle,
          sampler,
          last_batch,
          batch_sampler,
          batchify_fn,
          num_workers,
      )
  
imports: import io
  import pickle
  import multiprocessing
  from multiprocessing.reduction import ForkingPickler
  import numpy
  from mxnet import nd
  from mxnet import context
  from mxnet.gluon.data.dataloader import DataLoader, _MultiWorkerIter
  from mxnet.gluon.data.dataloader import default_mp_batchify_fn, default_batchify_fn
label_desc: Use image node_id 1 to create a new DetectionDataLoader object from inherited base classes: DataLoader with example: obj = DetectionDataLoader(dataset, batch_size, shuffle, sampler, last_batch, batch_sampler, batchify_fn, num_workers)