code: def get_dataloader(
      net, train_dataset, data_shape, batch_size, num_workers
  ):
      from gluoncv.data.batchify import Tuple, Stack, Pad
      from gluoncv.data.transforms.presets.ssd import (
          SSDDefaultTrainTransform,
      )
  
      width, height = data_shape, data_shape
      # use fake data to generate fixed anchors for target generation
      with autograd.train_mode():
          _, _, anchors = net(mx.nd.zeros((1, 3, height, width)))
      batchify_fn = Tuple(
          Stack(), Stack(), Stack()
      )  # stack image, cls_targets, box_targets
      train_loader = gluon.data.DataLoader(
          train_dataset.transform(
              SSDDefaultTrainTransform(width, height, anchors)
          ),
          batch_size,
          True,
          batchify_fn=batchify_fn,
          last_batch="rollover",
          num_workers=num_workers,
      )
      return train_loader
  
imports: import time
  from matplotlib import pyplot
  import numpy
  import mxnet
  from mxnet import autograd, gluon
  import gluoncv
  from gluoncv.utils import download, viz
label_desc: Use image node_id 1 for calling a global function with example usage: get_dataloader(net, train_dataset, data_shape, batch_size, num_workers) and returns: train_loader