code: def __init__(
      self, arch="resnet18", pretrained=True, k=10, method="sample"
  ):
      super().__init__()
      if isinstance(arch, type(None)) or isinstance(
          pretrained, type(None)
      ):
          self.model = None
          print("Inference mode")
      else:
          assert arch in models.keys(), "arch {} not supported".format(
              arch
          )
          self.model = models[arch](pretrained)
          del self.model.layer4, self.model.fc, self.model.avgpool
          self.model.eval()
          print(
              f"model {arch}, nParams {sum([w.size for w in self.model.parameters()])}"
          )
          self.arch = arch
          self.method = method
          self.fin = fins[arch]
          self.k = k
          self.projection = None
          self.reset_stats()
  
imports: import numpy
  from tqdm import tqdm
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.vision.models.resnet import resnet18, resnet50, wide_resnet50_2
  from scipy.ndimage import gaussian_filter
  from qinspector.cvlib.workspace import register
  from qinspector.uad.utils.utils import cdist, cholesky_inverse, mahalanobis, mahalanobis_einsum, orthogonal, svd_orthogonal
  from qinspector.uad.utils.k_center_greedy import KCenterGreedy
label_desc: Use image node_id 1 to create a new PaDiMPlus object from inherited base classes: nn with example: obj = PaDiMPlus(arch, pretrained, k, method)