code: def get_batch(self):
      # slice roidb
      cur_from = self.cur
      cur_to = min(cur_from + self.batch_size, self.size)
      assert cur_to == cur_from + self.batch_size
      roidb = [
          self.roidb[self.index[i]] for i in range(cur_from, cur_to)
      ]
  
      # decide multi device slice
      work_load_list = self.work_load_list
      ctx = self.ctx
      if work_load_list is None:
          work_load_list = [1] * len(ctx)
      assert isinstance(work_load_list, list) and len(
          work_load_list
      ) == len(ctx), "Invalid settings for work load. "
      slices = _split_input_slice(self.batch_size, work_load_list)
  
      # get testing data for multigpu
      data_list = []
      label_list = []
      for islice in slices:
          iroidb = [roidb[i] for i in range(islice.start, islice.stop)]
          data, label = get_crop_batch(iroidb)
          data_list += data
          label_list += label
          # data_list.append(data)
          # label_list.append(label)
  
      # pad data first and then assign anchor (read label)
      # data_tensor = tensor_vstack([batch['data'] for batch in data_list])
      # for i_card in range(len(data_list)):
      #    data_list[i_card]['data'] = data_tensor[
      #                                i_card * config.TRAIN.BATCH_IMAGES:(1 + i_card) * config.TRAIN.BATCH_IMAGES]
  
      # iiddxx = 0
      select_stride = 0
      if config.RANDOM_FEAT_STRIDE:
          select_stride = random.choice(config.RPN_FEAT_STRIDE)
  
      for data, label in zip(data_list, label_list):
          data_shape = {k: v.shape for k, v in data.items()}
          del data_shape["im_info"]
          feat_shape_list = []
          for s in range(len(self.feat_stride)):
              _, feat_shape, _ = self.feat_sym[s].infer_shape(
                  **data_shape
              )
              feat_shape = [int(i) for i in feat_shape[0]]
              feat_shape_list.append(feat_shape)
          im_info = data["im_info"]
          gt_boxes = label["gt_boxes"]
          gt_label = {"gt_boxes": gt_boxes}
          if config.USE_BLUR:
              gt_blur = label["gt_blur"]
              gt_label["gt_blur"] = gt_blur
          if self._debug:
              img = (
                  data["data"]
                  .copy()[0]
                  .transpose((1, 2, 0))[:, :, ::-1]
                  .copy()
              )
              print(
                  "DEBUG SHAPE",
                  data["data"].shape,
                  label["gt_boxes"].shape,
              )
  
              box = label["gt_boxes"].copy()[0][0:4].astype(np.int)
              cv2.rectangle(
                  img,
                  (box[0], box[1]),
                  (box[2], box[3]),
                  (0, 255, 0),
                  2,
              )
              filename = "./debugout/%d.png" % (self._debug_id)
              print("debug write", filename)
              cv2.imwrite(filename, img)
              self._debug_id += 1
              # print('DEBUG', img.shape, bbox.shape)
          label_dict = {}
          if config.HEAD_BOX:
              head_label_dict = self.aa.assign_anchor_fpn(
                  gt_label,
                  im_info,
                  False,
                  prefix="head",
                  select_stride=select_stride,
              )
              label_dict.update(head_label_dict)
          if config.FACE_LANDMARK:
              gt_landmarks = label["gt_landmarks"]
              gt_label["gt_landmarks"] = gt_landmarks
          # ta = datetime.datetime.now()
          # face_label_dict = assign_anchor_fpn(feat_shape_list, gt_label, im_info, config.FACE_LANDMARK, prefix='face', select_stride = select_stride)
          face_label_dict = self.aa.assign_anchor_fpn(
              gt_label,
              im_info,
              config.FACE_LANDMARK,
              prefix="face",
              select_stride=select_stride,
          )
          # tb = datetime.datetime.now()
          # self._times[0] += (tb-ta).total_seconds()
          label_dict.update(face_label_dict)
          # for k in label_dict:
          #  print(k, label_dict[k].shape)
  
          if config.CASCADE > 0:
              pad_gt_boxes = np.empty(
                  (1, config.TRAIN.MAX_BBOX_PER_IMAGE, 5),
                  dtype=np.float32,
              )
              pad_gt_boxes.fill(-1)
              pad_gt_boxes[0, 0 : gt_boxes.shape[0], :] = gt_boxes
              label_dict["gt_boxes"] = pad_gt_boxes
          # print('im_info', im_info.shape)
          # print(gt_boxes.shape)
          for k in self.label_name:
              label[k] = label_dict[k]
  
      all_data = dict()
      for key in self.data_name:
          all_data[key] = tensor_vstack(
              [batch[key] for batch in data_list]
          )
  
      all_label = dict()
      for key in self.label_name:
          pad = 0 if key.startswith("bbox_") else -1
          # print('label vstack', key, pad, len(label_list), file=sys.stderr)
          all_label[key] = tensor_vstack(
              [batch[key] for batch in label_list], pad=pad
          )
  
      self.data = [mx.nd.array(all_data[key]) for key in self.data_name]
      self.label = [
          mx.nd.array(all_label[key]) for key in self.label_name
      ]
  
imports: from __future__ import print_function
  import sys
  import mxnet
  import numpy
  import random
  import datetime
  import multiprocessing
  import cv2
  from mxnet.executor_manager import _split_input_slice
  from rcnn.config import config
  from rcnn.io.image import tensor_vstack
  from rcnn.io.rpn import get_rpn_testbatch, get_rpn_batch, assign_anchor_fpn, get_crop_batch, AA
label_desc: Use image node_id 10 for calling the CropLoader obj's underlying member method code with example usage: obj.get_batch() without return types