code: def create_generator(args):
      """Create the data generators.
  
      Args:
          args: parseargs arguments object.
      """
      common_args = {
          "config": args.config,
          "image_min_side": args.image_min_side,
          "image_max_side": args.image_max_side,
          "group_method": args.group_method,
      }
  
      # create random transform generator for augmenting training data
      transform_generator = random_transform_generator(
          min_rotation=-0.1,
          max_rotation=0.1,
          min_translation=(-0.1, -0.1),
          max_translation=(0.1, 0.1),
          min_shear=-0.1,
          max_shear=0.1,
          min_scaling=(0.9, 0.9),
          max_scaling=(1.1, 1.1),
          flip_x_chance=0.5,
          flip_y_chance=0.5,
      )
  
      visual_effect_generator = random_visual_effect_generator(
          contrast_range=(0.9, 1.1),
          brightness_range=(-0.1, 0.1),
          hue_range=(-0.05, 0.05),
          saturation_range=(0.95, 1.05),
      )
  
      if args.dataset_type == "coco":
          # import here to prevent unnecessary dependency on cocoapi
          from ..preprocessing.coco import CocoGenerator
  
          generator = CocoGenerator(
              args.coco_path,
              args.coco_set,
              transform_generator=transform_generator,
              visual_effect_generator=visual_effect_generator,
              **common_args,
          )
      elif args.dataset_type == "pascal":
          generator = PascalVocGenerator(
              args.pascal_path,
              args.pascal_set,
              image_extension=args.image_extension,
              transform_generator=transform_generator,
              visual_effect_generator=visual_effect_generator,
              **common_args,
          )
      elif args.dataset_type == "csv":
          generator = CSVGenerator(
              args.annotations,
              args.classes,
              transform_generator=transform_generator,
              visual_effect_generator=visual_effect_generator,
              **common_args,
          )
      elif args.dataset_type == "oid":
          generator = OpenImagesGenerator(
              args.main_dir,
              subset=args.subset,
              version=args.version,
              labels_filter=args.labels_filter,
              parent_label=args.parent_label,
              annotation_cache_dir=args.annotation_cache_dir,
              transform_generator=transform_generator,
              visual_effect_generator=visual_effect_generator,
              **common_args,
          )
      elif args.dataset_type == "kitti":
          generator = KittiGenerator(
              args.kitti_path,
              subset=args.subset,
              transform_generator=transform_generator,
              visual_effect_generator=visual_effect_generator,
              **common_args,
          )
      else:
          raise ValueError(
              "Invalid data type received: {}".format(args.dataset_type)
          )
  
      return generator
  
file_path: ImageAI/imageai_tf_deprecated/Detection/keras_retinanet/bin/debug.py
imports: import argparse
  import os
  import sys
  import cv2
  from ..preprocessing.pascal_voc import PascalVocGenerator
  from ..preprocessing.csv_generator import CSVGenerator
  from ..preprocessing.kitti import KittiGenerator
  from ..preprocessing.open_images import OpenImagesGenerator
  from ..utils.anchors import anchors_for_shape, compute_gt_annotations
  from ..utils.config import read_config_file, parse_anchor_parameters, parse_pyramid_levels
  from ..utils.image import random_visual_effect_generator
  from ..utils.tf_version import check_tf_version
  from ..utils.transform import random_transform_generator
  from ..utils.visualization import draw_annotations, draw_boxes, draw_caption
label_desc: Use image node_id 1 for calling a global function with example usage: create_generator(args) and returns: generator