code: def get_data(self, data, label, annot):
      if self.vis:
          self.img_num += 1
          # if self.img_num<=self.vis:
          #  filename = './vis/raw_%d.jpg' % (self.img_num)
          #  print('save', filename)
          #  draw = data.copy()
          #  for i in range(label.shape[0]):
          #    cv2.circle(draw, (label[i][1], label[i][0]), 1, (0, 0, 255), 2)
          #  scipy.misc.imsave(filename, draw)
  
      rotate = 0
      # scale = 1.0
      if "scale" in annot:
          scale = annot["scale"]
      else:
          scale = max(data.shape[0], data.shape[1])
      if "center" in annot:
          center = annot["center"]
      else:
          center = np.array((data.shape[1] / 2, data.shape[0] / 2))
      max_retry = 3
      if self.aug_level == 0:  # validation mode
          max_retry = 6
      retry = 0
      found = False
      base_scale = scale
      while retry < max_retry:
          retry += 1
          succ = True
          _scale = base_scale
          if self.aug_level > 0:
              rotate = np.random.randint(-40, 40)
              scale_config = 0.2
              # rotate = 0
              # scale_config = 0.0
              scale_ratio = min(
                  1 + scale_config,
                  max(
                      1 - scale_config,
                      (np.random.randn() * scale_config) + 1,
                  ),
              )
              _scale = int(base_scale * scale_ratio)
              # translate = np.random.randint(-5, 5, size=(2,))
              # center += translate
          data_out, trans = img_helper.transform(
              data, center, self.input_img_size, _scale, rotate
          )
          # data_out = img_helper.crop2(data, center, _scale, (self.input_img_size, self.input_img_size), rot=rotate)
          label_out = np.zeros(self.label_shape, dtype=np.float32)
          # print('out shapes', data_out.shape, label_out.shape)
          for i in range(label.shape[0]):
              pt = label[i].copy()
              # pt = pt[::-1]
              npt = img_helper.transform_pt(pt, trans)
              if (
                  npt[0] >= data_out.shape[1]
                  or npt[1] >= data_out.shape[0]
                  or npt[0] < 0
                  or npt[1] < 0
              ):
                  succ = False
                  # print('err npt', npt)
                  break
              if config.losstype == "heatmap":
                  pt_scale = (
                      float(self.output_label_size)
                      / self.input_img_size
                  )
                  npt *= pt_scale
                  npt = npt.astype(np.int32)
                  img_helper.gaussian(
                      label_out[i], npt, config.gaussian
                  )
              else:
                  label_out[i] = npt / self.input_img_size
              # print('before gaussian', label_out[i].shape, pt.shape)
              # trans = img_helper.transform(pt, center, _scale, (self.output_label_size, self.output_label_size), rot=rotate)
              # print(trans.shape)
              # if not img_helper.gaussian(label_out[i], trans, _g):
              #    succ = False
              #    break
          if not succ:
              if self.aug_level == 0:
                  base_scale += 20
              continue
  
          flip_data_out = None
          flip_label_out = None
          if config.net_coherent:
              flip_data_out, flip_label_out = self.get_flip(
                  data_out, label_out
              )
          elif (
              self.aug_level > 0 and np.random.rand() < 0.5
          ) or self.force_mirror:  # flip aug
              flip_data_out, flip_label_out = self.get_flip(
                  data_out, label_out
              )
              data_out, label_out = flip_data_out, flip_label_out
  
          found = True
          break
  
      # self.stats[0]+=1
      if not found:
          # self.stats[1]+=1
          # print('find aug error', retry)
          # print(self.stats)
          # print('!!!ERR')
          return None
      # print('found with scale', _scale, rotate)
  
      if self.vis > 0 and self.img_num <= self.vis:
          print(
              "crop", data.shape, center, _scale, rotate, data_out.shape
          )
          filename = "./vis/cropped_%d.jpg" % (self.img_num)
          print("save", filename)
          draw = data_out.copy()
          alabel = label_out.copy()
          for i in range(label.shape[0]):
              a = cv2.resize(
                  alabel[i], (self.input_img_size, self.input_img_size)
              )
              ind = np.unravel_index(np.argmax(a, axis=None), a.shape)
              cv2.circle(draw, (ind[1], ind[0]), 1, (0, 0, 255), 2)
          scipy.misc.imsave(filename, draw)
          filename = "./vis/raw_%d.jpg" % (self.img_num)
          scipy.misc.imsave(filename, data)
  
      return data_out, label_out, flip_data_out, flip_label_out
  
imports: import mxnet
  import numpy
  import sys, os
  import random
  import math
  import scipy.misc
  import cv2
  import logging
  import sklearn
  import datetime
  import img_helper
  from mxnet.io import DataIter
  from mxnet import ndarray
  from mxnet import io
  from mxnet import recordio
  from PIL import Image
  from config import config
  from skimage import transform
label_desc: Use image node_id 8 for calling the FaceSegIter obj's underlying member method code with example usage: obj.get_data(data, label, annot) and returns: data_out,  label_out,  flip_data_out,  flip_label_out, None