class_docstr: This is the image classification class for custom models trained with the 'ClassificationModelTrainer' class. It provides support for 4 different models which are:
  ResNet50, MobileNetV2, DenseNet121 and Inception V3. After instantiating this class, you can set it's properties and
  make image classification using it's pre-defined functions.
  
  The following functions are required to be called before a classification can be made
  * setModelPath() , path to your custom model
  * setJsonPath , , path to your custom model's corresponding JSON file
  * At least of of the following and it must correspond to the model set in the setModelPath()
  [setModelTypeAsMobileNetV2(), setModelTypeAsResNet50(), setModelTypeAsDenseNet121, setModelTypeAsInceptionV3]
  * loadModel() [This must be called once only before making a classification]
  
  Once the above functions have been called, you can call the classifyImage() function of the classification instance
  object at anytime to predict an image.
class_docstr_tok: ["This","is","the","image","classification","class","for","custom","models","trained","with","the","'ClassificationModelTrainer","'","class",".","It","provides","support","for","4","different","models","which","are",":","ResNet50",",","MobileNetV2",",","DenseNet121","and","Inception","V3",".","After","instantiating","this","class",",","you","can","set","it","'s","properties","and","make","image","classification","using","it","'s","pre-defined","functions",".","The","following","functions","are","required","to","be","called","before","a","classification","can","be","made","*","setModelPath","(",")",",","path","to","your","custom","model","*","setJsonPath",",",",","path","to","your","custom","model","'s","corresponding","JSON","file","*","At","least","of","of","the","following","and","it","must","correspond","to","the","model","set","in","the","setModelPath","(",")","[","setModelTypeAsMobileNetV2","(",")",",","setModelTypeAsResNet50","(",")",",","setModelTypeAsDenseNet121",",","setModelTypeAsInceptionV3","]","*","loadModel","(",")","[","This","must","be","called","once","only","before","making","a","classification","]","Once","the","above","functions","have","been","called",",","you","can","call","the","classifyImage","(",")","function","of","the","classification","instance","object","at","anytime","to","predict","an","image","."]
docstr: 'loadModel()' function is used to load the model structure into the program from the file path defined
  in the setModelPath() function. This function receives an optional value which is "classification_speed".
  The value is used to reduce the time it takes to classify an image, down to about 50% of the normal time,
  with just slight changes or drop in classification accuracy, depending on the nature of the image.
  * classification_speed (optional); Acceptable values are "normal", "fast", "faster" and "fastest"
  
  :param classification_speed :
  :return:
docstr_tok: ["'loadModel","(",")","'","function","is","used","to","load","the","model","structure","into","the","program","from","the","file","path","defined","in","the","setModelPath","(",")","function",".","This","function","receives","an","optional","value","which","is","``","classification_speed","''",".","The","value","is","used","to","reduce","the","time","it","takes","to","classify","an","image",",","down","to","about","50","%","of","the","normal","time",",","with","just","slight","changes","or","drop","in","classification","accuracy",",","depending","on","the","nature","of","the","image",".","*","classification_speed","(","optional",")",";","Acceptable","values","are","``","normal","''",",","``","fast","''",",","``","faster","''","and","``","fastest","''",":","param","classification_speed",":",":","return",":"]
code: def loadModel(self, classification_speed="normal", num_objects=10):
      """
      'loadModel()' function is used to load the model structure into the program from the file path defined
      in the setModelPath() function. This function receives an optional value which is "classification_speed".
      The value is used to reduce the time it takes to classify an image, down to about 50% of the normal time,
      with just slight changes or drop in classification accuracy, depending on the nature of the image.
      * classification_speed (optional); Acceptable values are "normal", "fast", "faster" and "fastest"
  
      :param classification_speed :
      :return:
      """
  
      self.__model_classes = json.load(open(self.jsonPath))
  
      if classification_speed == "normal":
          self.__input_image_size = 224
      elif classification_speed == "fast":
          self.__input_image_size = 160
      elif classification_speed == "faster":
          self.__input_image_size = 120
      elif classification_speed == "fastest":
          self.__input_image_size = 100
  
      if self.__modelLoaded == False:
          image_input = tf.keras.layers.Input(
              shape=(
                  self.__input_image_size,
                  self.__input_image_size,
                  3,
              )
          )
  
          if self.__modelType == "":
              raise ValueError(
                  "You must set a valid model type before loading the model."
              )
  
          elif self.__modelType == "mobilenetv2":
              model = tf.keras.applications.MobileNetV2(
                  input_shape=(
                      self.__input_image_size,
                      self.__input_image_size,
                      3,
                  ),
                  weights=self.modelPath,
                  classes=num_objects,
              )
              self.__model_collection.append(model)
              self.__modelLoaded = True
              try:
                  None
              except:
                  raise ValueError(
                      "An error occured. Ensure your model file is a MobileNetV2 Model and is located in the path {}".format(
                          self.modelPath
                      )
                  )
  
          elif self.__modelType == "resnet50":
              try:
                  model = tf.keras.applications.ResNet50(
                      input_shape=(
                          self.__input_image_size,
                          self.__input_image_size,
                          3,
                      ),
                      weights=None,
                      classes=num_objects,
                  )
                  model.load_weights(self.modelPath)
                  self.__model_collection.append(model)
                  self.__modelLoaded = True
              except:
                  raise ValueError(
                      "An error occured. Ensure your model file is a ResNet50 Model and is located in the path {}".format(
                          self.modelPath
                      )
                  )
  
          elif self.__modelType == "densenet121":
              try:
                  model = tf.keras.applications.DenseNet121(
                      input_shape=(
                          self.__input_image_size,
                          self.__input_image_size,
                          3,
                      ),
                      weights=self.modelPath,
                      classes=num_objects,
                  )
                  self.__model_collection.append(model)
                  self.__modelLoaded = True
              except:
                  raise ValueError(
                      "An error occured. Ensure your model file is a DenseNet121 Model and is located in the path {}".format(
                          self.modelPath
                      )
                  )
  
          elif self.__modelType == "inceptionv3":
              try:
                  model = tf.keras.applications.InceptionV3(
                      input_shape=(
                          self.__input_image_size,
                          self.__input_image_size,
                          3,
                      ),
                      weights=self.modelPath,
                      classes=num_objects,
                  )
                  self.__model_collection.append(model)
                  self.__modelLoaded = True
              except:
                  raise ValueError(
                      "An error occured. Ensure your model file is in {}".format(
                          self.modelPath
                      )
                  )
  
imports: import tensorflow
  from PIL import Image
  import time
  import numpy
  import os
  import warnings
  from matplotlib.cbook import deprecated
  import json
label_desc: Use image node_id 8 for calling the CustomImageClassification obj's underlying member method code with example usage: obj.loadModel(classification_speed, num_objects) without return types