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.
code: def __load_image(
      self, image_input: Union[str, np.ndarray, Image.Image]
  ) -> torch.Tensor:
      images = []
      preprocess = transforms.Compose(
          [
              transforms.Resize(256),
              transforms.CenterCrop(224),
              transforms.ToTensor(),
              transforms.Normalize(
                  mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
              ),
          ]
      )
      if type(image_input) == str:
          if os.path.isfile(image_input):
              img = Image.open(image_input).convert("RGB")
              images.append(preprocess(img))
          else:
              raise ValueError(
                  f"image path '{image_input}' is not found or a valid file"
              )
      elif type(image_input) == np.ndarray:
          img = Image.fromarray(image_input).convert("RGB")
          images.append(preprocess(img))
      elif "PIL" in str(type(image_input)):
          img = image_input.convert("RGB")
          images.append(preprocess(img))
      else:
          raise ValueError(f"Invalid image input format")
  
      return torch.stack(images)
  
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 4 for calling the ImageClassification obj's underlying member method code with example usage: obj.__load_image(image_input) and returns: torch