code: def __init__(self):
      super().__init__()
  
      # Create a ResNet backbone and remove the classification head.
      resnet = torchvision.models.resnet18()
      self.backbone = nn.Sequential(
          *list(resnet.children())[:-1],
      )
  
      # The backbone has output dimension 512 which also defines the size of
      # the hidden dimension. We select 128 for the output dimension.
      self.projection_head = MoCoProjectionHead(512, 512, 128)
  
      # Add the momentum network.
      self.backbone_momentum = copy.deepcopy(self.backbone)
      self.projection_head_momentum = copy.deepcopy(
          self.projection_head
      )
      deactivate_requires_grad(self.backbone_momentum)
      deactivate_requires_grad(self.projection_head_momentum)
  
      # Create the loss function with memory bank.
      self.criterion = NTXentLoss(
          temperature=0.1, memory_bank_size=(4096, 128)
      )
  
imports: import copy
  import os
  import matplotlib.pyplot
  import numpy
  import pandas
  import pytorch_lightning
  import torch
  import torch.nn
  import torchvision
  from PIL import Image
  from sklearn.neighbors import NearestNeighbors
  from sklearn.preprocessing import normalize
  from lightly.data import LightlyDataset
  from lightly.loss import NTXentLoss
  from lightly.models.modules.heads import MoCoProjectionHead
  from lightly.models.utils import batch_shuffle, batch_unshuffle, deactivate_requires_grad, update_momentum
  from lightly.transforms.multi_view_transform import MultiViewTransform
label_desc: Use image node_id 1 to create a new MoCoModel object from inherited base classes: pl with example: obj = MoCoModel()