class_docstr: The mapper to preprocess the input data for training.
  
  Since the mapping may run in other processes, we write a new class and
  explicitly pass cfg to it, in the spirit of "explicitly pass resources to subprocess".
class_docstr_tok: ["The","mapper","to","preprocess","the","input","data","for","training",".","Since","the","mapping","may","run","in","other","processes",",","we","write","a","new","class","and","explicitly","pass","cfg","to","it",",","in","the","spirit","of","``","explicitly","pass","resources","to","subprocess","''","."]
code: def __init__(self, cfg):
      self.cfg = cfg
      self.aug = imgaug.AugmentorList(
          [
              CustomResize(
                  cfg.PREPROC.TRAIN_SHORT_EDGE_SIZE,
                  cfg.PREPROC.MAX_SIZE,
              ),
              imgaug.Flip(horiz=True),
          ]
      )
  
imports: import copy
  import itertools
  import numpy
  import cv2
  from tabulate import tabulate
  from termcolor import colored
  from tensorpack.dataflow import DataFromList, MapData, MapDataComponent, MultiProcessMapData, MultiThreadMapData, TestDataSpeed, imgaug
  from tensorpack.utils import logger
  from tensorpack.utils.argtools import log_once
  from modeling.model_rpn import get_all_anchors
  from modeling.model_fpn import get_all_anchors_fpn
  from common import CustomResize, DataFromListOfDict, box_to_point4, filter_boxes_inside_shape, np_iou, point4_to_box, polygons_to_mask
  from config import config
  from dataset import DatasetRegistry, register_coco
  from utils.np_box_ops import area
  from utils.np_box_ops import ioa
label_desc: Use image node_id 1 to create a new TrainingDataPreprocessor object  with example: obj = TrainingDataPreprocessor(cfg)