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.
docstr: 'setTrainConfig()' function allows you to set the properties for the training instances. It accepts the following values:
  
  - object_names_array , this is an array of the names of the different objects in your dataset
  - batch_size (optional),  this is the batch size for the training instance
  - num_experiments (optional),   also known as epochs, it is the number of times the network will train on all the training dataset
  - train_from_pretrained_model (optional), this is used to perform transfer learning by specifying the path to a pre-trained YOLOv3 model
  
  :param object_names_array:
  :param batch_size:
  :param num_experiments:
  :param train_from_pretrained_model:
  :return:
docstr_tok: ["'setTrainConfig","(",")","'","function","allows","you","to","set","the","properties","for","the","training","instances",".","It","accepts","the","following","values",":","-","object_names_array",",","this","is","an","array","of","the","names","of","the","different","objects","in","your","dataset","-","batch_size","(","optional",")",",","this","is","the","batch","size","for","the","training","instance","-","num_experiments","(","optional",")",",","also","known","as","epochs",",","it","is","the","number","of","times","the","network","will","train","on","all","the","training","dataset","-","train_from_pretrained_model","(","optional",")",",","this","is","used","to","perform","transfer","learning","by","specifying","the","path","to","a","pre-trained","YOLOv3","model",":","param","object_names_array",":",":","param","batch_size",":",":","param","num_experiments",":",":","param","train_from_pretrained_model",":",":","return",":"]
code: def setTrainConfig(
      self,
      object_names_array,
      batch_size=4,
      num_experiments=100,
      train_from_pretrained_model="",
  ):
      """
  
      'setTrainConfig()' function allows you to set the properties for the training instances. It accepts the following values:
  
      - object_names_array , this is an array of the names of the different objects in your dataset
      - batch_size (optional),  this is the batch size for the training instance
      - num_experiments (optional),   also known as epochs, it is the number of times the network will train on all the training dataset
      - train_from_pretrained_model (optional), this is used to perform transfer learning by specifying the path to a pre-trained YOLOv3 model
  
      :param object_names_array:
      :param batch_size:
      :param num_experiments:
      :param train_from_pretrained_model:
      :return:
      """
  
      # Remove cache files
      if os.path.isfile(self.__train_cache_file) == True:
          os.remove(self.__train_cache_file)
  
      if os.path.isfile(self.__validation_cache_file) == True:
          os.remove(self.__validation_cache_file)
  
      self.__model_anchors, self.__inference_anchors = generateAnchors(
          self.__train_annotations_folder,
          self.__train_images_folder,
          self.__train_cache_file,
          self.__model_labels,
      )
  
      self.__model_labels = sorted(object_names_array)
      self.__num_objects = len(object_names_array)
  
      self.__train_batch_size = batch_size
      self.__train_epochs = num_experiments
      self.__pre_trained_model = train_from_pretrained_model
  
      json_data = dict()
      json_data["labels"] = self.__model_labels
      json_data["anchors"] = self.__inference_anchors
  
      with open(
          os.path.join(self.__json_directory, "detection_config.json"),
          "w+",
      ) as json_file:
          json.dump(
              json_data,
              json_file,
              indent=4,
              separators=(",", " : "),
              ensure_ascii=True,
          )
  
      print(
          "Detection configuration saved in ",
          os.path.join(self.__json_directory, "detection_config.json"),
      )
  
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 5 for calling the DetectionModelTrainer obj's underlying member method code with example usage: obj.setTrainConfig(object_names_array, batch_size, num_experiments, train_from_pretrained_model) without return types