class_docstr: An implementation that allows for easy classification of images
  using the state of the art MobileNet computer vision model.
class_docstr_tok: ["An","implementation","that","allows","for","easy","classification","of","images","using","the","state","of","the","art","MobileNet","computer","vision","model","."]
docstr: Loads the mobilenet vison weight into the model architecture.
docstr_tok: ["Loads","the","mobilenet","vison","weight","into","the","model","architecture","."]
code: def load_model(self) -> None:
      """
      Loads the mobilenet vison weight into the model architecture.
      """
      if not self.__has_loaded_weights:
          try:
              import re
  
              state_dict = torch.load(
                  self.__model_path, map_location=self.__device
              )
              # '.'s are no longer allowed in module names, but previous densenet layers
              # as provided by the pytorch organization has names that uses '.'s.
              pattern = re.compile(
                  r"^(.*denselayer\d+\.(?:norm|relu|conv))\.((?:[12])\."
                  "(?:weight|bias|running_mean|running_var))$"
              )
              for key in list(state_dict.keys()):
                  res = pattern.match(key)
                  if res:
                      new_key = res.group(1) + res.group(2)
                      state_dict[new_key] = state_dict[key]
                      del state_dict[key]
              self.__model.load_state_dict(state_dict)
              self.__has_loaded_weights = True
              self.__model.eval()
          except Exception:
              print(
                  "Weight loading failed.\nEnsure the model path is"
                  " set and the weight file is in the specified model path."
              )
  
file_path: ImageAI/imageai/densenet121/__init__.py
imports: import os, warnings
  from pathlib import Path
  from typing import List, Tuple
  import torch, torchvision
  import torch.nn.functional
  from torchvision import transforms
  from PIL import Image
label_desc: Use image node_id 5 for calling the DenseNet121Pretrained obj's underlying member method code with example usage: obj.load_model() without return types