code: def create_generator(args, preprocess_image):
      """Create generators for evaluation."""
      common_args = {
          "config": args.config,
          "image_min_side": args.image_min_side,
          "image_max_side": args.image_max_side,
          "no_resize": args.no_resize,
          "preprocess_image": preprocess_image,
          "group_method": args.group_method,
      }
  
      if args.dataset_type == "coco":
          # import here to prevent unnecessary dependency on cocoapi
          from ..preprocessing.coco import CocoGenerator
  
          validation_generator = CocoGenerator(
              args.coco_path,
              "val2017",
              shuffle_groups=False,
              **common_args,
          )
      elif args.dataset_type == "pascal":
          validation_generator = PascalVocGenerator(
              args.pascal_path,
              "test",
              image_extension=args.image_extension,
              shuffle_groups=False,
              **common_args,
          )
      elif args.dataset_type == "csv":
          validation_generator = CSVGenerator(
              args.annotations,
              args.classes,
              shuffle_groups=False,
              **common_args,
          )
      else:
          raise ValueError(
              "Invalid data type received: {}".format(args.dataset_type)
          )
  
      return validation_generator
  
file_path: ImageAI/imageai_tf_deprecated/Detection/keras_retinanet/bin/evaluate.py
imports: import argparse
  import os
  import sys
  from ..None import models
  from ..preprocessing.csv_generator import CSVGenerator
  from ..preprocessing.pascal_voc import PascalVocGenerator
  from ..utils.anchors import make_shapes_callback
  from ..utils.config import read_config_file, parse_anchor_parameters, parse_pyramid_levels
  from ..utils.eval import evaluate
  from ..utils.gpu import setup_gpu
  from ..utils.tf_version import check_tf_version
label_desc: Use image node_id 1 for calling a global function with example usage: create_generator(args, preprocess_image) and returns: validation_generator