class_docstr: This is the Detection Model training class, which allows you to train object detection models
  on image datasets that are in Pascal VOC annotation format, using the YOLOv3.
code: def _create_training_instances(
      self,
      train_annot_folder,
      train_image_folder,
      train_cache,
      valid_annot_folder,
      valid_image_folder,
      valid_cache,
      labels,
  ):
      # parse annotations of the training set
      train_ints, train_labels = parse_voc_annotation(
          train_annot_folder, train_image_folder, train_cache, labels
      )
  
      # parse annotations of the validation set, if any, otherwise split the training set
  
      if os.path.exists(valid_annot_folder):
          valid_ints, valid_labels = parse_voc_annotation(
              valid_annot_folder,
              valid_image_folder,
              valid_cache,
              labels,
          )
          print(
              "Evaluating over {} samples taken from {}".format(
                  len(valid_ints), os.path.dirname(valid_annot_folder)
              )
          )
      else:
          train_portion = (
              0.8  # use 80% to train and the remaining 20% to evaluate
          )
          train_valid_split = int(
              round(train_portion * len(train_ints))
          )
          np.random.seed(0)
          np.random.shuffle(train_ints)
  
          valid_ints = train_ints[train_valid_split:]
          train_ints = train_ints[:train_valid_split]
          print(
              "Evaluating over {} samples taken as {:5.2f}% of the training set "
              "given at {}".format(
                  len(valid_ints),
                  (1 - train_portion) * 100,
                  os.path.dirname(train_annot_folder),
              )
          )
  
      print(
          "Training over {} samples  given at {}".format(
              len(train_ints), os.path.dirname(train_annot_folder)
          )
      )
  
      # compare the seen labels with the given labels in config.json
      if len(labels) > 0:
          overlap_labels = set(labels).intersection(
              set(train_labels.keys())
          )
  
          # return None, None, None if some given label is not in the dataset
          if len(overlap_labels) < len(labels):
              if self.__training_mode:
                  print(
                      "Some labels have no annotations! Please revise the list of labels in your configuration."
                  )
              return None, None, None, None
      else:
          if self.__training_mode:
              print("No labels are provided. Train on all seen labels.")
              print(train_labels)
  
          labels = train_labels.keys()
  
      max_box_per_image = max(
          [len(inst["object"]) for inst in (train_ints + valid_ints)]
      )
  
      return train_ints, valid_ints, sorted(labels), max_box_per_image
  
imports: import os
  import re
  import numpy
  import json
  from imageai.Detection.Custom.voc import parse_voc_annotation
  from imageai.Detection.YOLO.yolov3 import yolov3_main, yolov3_train, dummy_loss
  from imageai.Detection.Custom.generator import BatchGenerator
  from imageai.Detection.Custom.utils.utils import normalize, evaluate, makedirs
  from tensorflow.keras.callbacks import ReduceLROnPlateau
  from tensorflow.keras.optimizers import Adam
  from imageai.Detection.Custom.callbacks import CustomModelCheckpoint
  from imageai.Detection.Custom.utils.multi_gpu_model import multi_gpu_model
  from imageai.Detection.Custom.gen_anchors import generateAnchors
  import tensorflow
  from tensorflow.keras.models import load_model
  from tensorflow.keras import Input
  from tensorflow.keras.callbacks import TensorBoard
  import tensorflow.keras.backend
  import cv2
label_desc: Use image node_id 8 for calling the DetectionModelTrainer obj's underlying member method code with example usage: obj._create_training_instances(train_annot_folder, train_image_folder, train_cache, valid_annot_folder, valid_image_folder, valid_cache, labels) and returns: train_ints,  valid_ints,  sorted,  max_box_per_image, None,  None,  None,  None