code: def __init__(
      self,
      backbone,
      additional_layers_to_train,
      num_classes,
      input_shape,
      optimizer_name,
      loss_name,
      label_col,
      image_col,
      dropout_aux=0.7,
  ):
      super(LitDeepVisionModel, self).__init__()
  
      self.backbone = backbone
      self.additional_layers_to_train = additional_layers_to_train
      self.num_classes = num_classes
      self.input_shape = input_shape
      self.optimizer_name = optimizer_name
      self.loss_name = loss_name
      self.label_col = label_col
      self.image_col = image_col
      self.dropout_aux = dropout_aux
  
      self._check_params()
  
      # Freeze those weights
      for p in self.model.parameters():
          p.requires_grad = False
  
      # Tune certain layers including num_classes
      if backbone.startswith("alexnet"):
          num_ftrs = self.model.classifier[6].in_features
          self.model.classifier[6] = nn.Linear(num_ftrs, num_classes)
      elif backbone.startswith("densenet"):
          self.model.classifier = nn.Linear(
              self.model.classifier.in_features, num_classes
          )
      elif backbone.startswith("efficientnet"):
          num_ftrs = self.model.classifier[-1].in_features
          self.model.classifier = nn.Linear(num_ftrs, num_classes)
      elif backbone.startswith("googlenet"):
          if self.model.aux_logits:
              self.model.aux1 = models.googlenet.InceptionAux(
                  512, num_classes, dropout=self.dropout_aux
              )
              self.model.aux2 = models.googlenet.InceptionAux(
                  528, num_classes, dropout=self.dropout_aux
              )
          self.model.fc = nn.Linear(
              self.model.fc.in_features, num_classes
          )
      elif backbone.startswith("inception"):
          """Inception v3
          Be careful, expects (299,299) sized images and has auxiliary output
          """
          # Handle the auxilary net
          self.model.AuxLogits.fc = nn.Linear(
              self.model.AuxLogits.fc.in_features, num_classes
          )
          # Handle the primary net
          self.model.fc = nn.Linear(
              self.model.fc.in_features, num_classes
          )
      elif backbone.startswith("mnasnet"):
          num_ftrs = self.model.classifier[-1].in_features
          self.model.classifier[-1] = nn.Linear(num_ftrs, num_classes)
      elif backbone.startswith("mobilenet"):
          num_ftrs = self.model.classifier[-1].in_features
          self.model.classifier[-1] = nn.Linear(num_ftrs, num_classes)
      elif backbone.startswith("regnet"):
          self.model.fc = nn.Linear(
              self.model.fc.in_features, num_classes
          )
      elif (
          backbone.startswith("resnet")
          or backbone.startswith("resnext")
          or backbone.startswith("wide_resnet")
      ):
          self.model.fc = nn.Linear(
              self.model.fc.in_features, num_classes
          )
      elif backbone.startswith("shufflenet"):
          self.model.fc = nn.Linear(
              self.model.fc.in_features, num_classes
          )
      elif backbone.startswith("squeezenet"):
          self.model.classifier[1] = nn.Conv2d(
              512, num_classes, kernel_size=(1, 1), stride=(1, 1)
          )
      elif backbone.startswith("vgg"):
          num_ftrs = self.model.classifier[6].in_features
          self.model.classifier[6] = nn.Linear(num_ftrs, num_classes)
      elif backbone.startswith("vit"):
          num_ftrs = self.model.heads.head.in_features
          self.model.heads.head = nn.Linear(num_ftrs, num_classes)
      elif backbone.startswith("convnext"):
          num_ftrs = self.model.classifier[-1].in_features
          self.model.classifier[-1] = nn.Linear(num_ftrs, num_classes)
  
      # The Lightning checkpoint also saves the arguments passed into the LightningModule init
      # under the "hyper_parameters" key in the checkpoint.
      self.save_hyperparameters(
          "backbone",
          "additional_layers_to_train",
          "num_classes",
          "input_shape",
          "optimizer_name",
          "loss_name",
          "label_col",
          "image_col",
          "dropout_aux",
      )
  
imports: import inspect
  import pytorch_lightning
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from pytorch_lightning.utilities import _module_available
  from urllib.error import URLError
  import time
label_desc: Use image node_id 1 to create a new LitDeepVisionModel object from inherited base classes: pl with example: obj = LitDeepVisionModel(backbone, additional_layers_to_train, num_classes, input_shape, optimizer_name, loss_name, label_col, image_col, dropout_aux)