class_docstr: This is the image classification class in the ImageAI library. It allows you to classify objects into all the 1000 different classes in the ImageNet dataset [ https://www.kaggle.com/c/imagenet-object-localization-challenge/overview/description ].
  
  The class provides 4 different classification models which are ResNet50, DensesNet121, InceptionV3 and MobileNetV2.
  
  The following functions are required to be called before a classification can be made
  
  * At least of of the following and it must correspond to the model set in the setModelPath()
  [setModelTypeAsMobileNetV2(), setModelTypeAsResNet(), setModelTypeAsDenseNet, setModelTypeAsInceptionV3]
  
  * setModelPath: This is used to specify the absolute path to a pretrained model file. Download any of the files in this release -> https://github.com/OlafenwaMoses/ImageAI/releases/tag/3.0.0-pretrained
  
  * useCPU (Optional): If you will like to force the image classification to be performed on CPU, call this function.
  
  * loadModel: Used to load the pretrained model weights
  
  * classifyImage(): Used for classifying an image.
docstr: 'classifyImage()' function is used to classify a given image by receiving the following arguments:
      * image_input: file path, numpy array or PIL image of the input image.
      * result_count (optional) , the number of classifications to be sent which must be whole numbers between
          1 and 1000. The default is 5.
  
  This function returns 2 arrays namely 'classification_results' and 'classification_probabilities'. The 'classification_results'
  contains possible objects classes arranged in descending of their percentage probabilities. The 'classification_probabilities'
  contains the percentage probability of each object class. The position of each object class in the 'classification_results'
  array corresponds with the positions of the percentage probability in the 'classification_probabilities' array.
  
  :param image_input:
  :param result_count:
  :return classification_results, classification_probabilities:
docstr_tok: ["'classifyImage","(",")","'","function","is","used","to","classify","a","given","image","by","receiving","the","following","arguments",":","*","image_input",":","file","path",",","numpy","array","or","PIL","image","of","the","input","image",".","*","result_count","(","optional",")",",","the","number","of","classifications","to","be","sent","which","must","be","whole","numbers","between","1","and","1000",".","The","default","is","5",".","This","function","returns","2","arrays","namely","'classification_results","'","and","'classification_probabilities","'",".","The","'classification_results'","contains","possible","objects","classes","arranged","in","descending","of","their","percentage","probabilities",".","The","'classification_probabilities'","contains","the","percentage","probability","of","each","object","class",".","The","position","of","each","object","class","in","the","'classification_results'","array","corresponds","with","the","positions","of","the","percentage","probability","in","the","'classification_probabilities","'","array",".",":","param","image_input",":",":","param","result_count",":",":","return","classification_results",",","classification_probabilities",":"]
code: def classifyImage(
      self,
      image_input: Union[str, np.ndarray, Image.Image],
      result_count: int = 5,
  ) -> Tuple[List[str], List[float]]:
      """
      'classifyImage()' function is used to classify a given image by receiving the following arguments:
          * image_input: file path, numpy array or PIL image of the input image.
          * result_count (optional) , the number of classifications to be sent which must be whole numbers between
              1 and 1000. The default is 5.
  
      This function returns 2 arrays namely 'classification_results' and 'classification_probabilities'. The 'classification_results'
      contains possible objects classes arranged in descending of their percentage probabilities. The 'classification_probabilities'
      contains the percentage probability of each object class. The position of each object class in the 'classification_results'
      array corresponds with the positions of the percentage probability in the 'classification_probabilities' array.
  
      :param image_input:
      :param result_count:
      :return classification_results, classification_probabilities:
      """
  
      if not self.__model_loaded:
          raise RuntimeError(
              "Model not yet loaded. You need to call '.loadModel()' before performing image classification"
          )
  
      images = self.__load_image(image_input)
      images = images.to(self.__device)
  
      with torch.no_grad():
          output = self.__model(images)
      probabilities = torch.softmax(output, dim=1)
      topN_prob, topN_catid = torch.topk(probabilities, result_count)
  
      predictions = [
          [
              (
                  self.__classes[topN_catid[i][j]],
                  topN_prob[i][j].item() * 100,
              )
              for j in range(topN_prob.shape[1])
          ]
          for i in range(topN_prob.shape[0])
      ]
  
      labels_pred = []
      probabilities_pred = []
  
      for idx, pred in enumerate(predictions):
          for label, score in pred:
              labels_pred.append(label)
              probabilities_pred.append(round(score, 4))
  
      return labels_pred, probabilities_pred
  
imports: import os, re
  from typing import Union
  from typing import List, Tuple
  import numpy
  import torch
  from torchvision.models import resnet50, densenet121, mobilenet_v2, inception_v3
  import torch.nn.functional
  from torchvision import transforms
  from PIL import Image
  import traceback
  from ..backend_check.model_extension import extension_check
label_desc: Use image node_id 11 for calling the ImageClassification obj's underlying member method code with example usage: obj.classifyImage(image_input, result_count) and returns: labels_pred,  probabilities_pred