code: def __init__(self, cfg):
      super(OneNetwork, self).__init__()
      self.num_verts = cfg.num_verts
      self.input_size = cfg.input_size
      self.use_eyes = cfg.eyes is not None
      kwargs = {}
      num_classes = self.num_verts * 5
      if cfg.task == 1:
          num_classes = self.num_verts * 3
      elif cfg.task == 2:
          num_classes = 6
      elif cfg.task == 3:
          num_classes = self.num_verts * 2
      eye_num_classes = 481 * 2 * 5
      # if use_eyes:
      #    num_classes += 481*2*5
      if cfg.network.startswith("resnet"):
          kwargs["base_width"] = int(64 * cfg.width_mult)
      p_num_classes = num_classes
      if cfg.no_gap:
          p_num_classes = 0
          kwargs["global_pool"] = None
      elif cfg.use_arcface:
          p_num_classes = 0
          kwargs["global_pool"] = None
      elif self.use_eyes:
          p_num_classes = 0
          # kwargs['global_pool'] = None
      if cfg.network == "resnet_jmlr":
          from .resnet import resnet_jmlr
  
          self.net = resnet_jmlr(num_classes=p_num_classes, **kwargs)
          if self.use_eyes:
              input_dim = 512  # resnet34d
              self.nete = resnet_jmlr(
                  num_classes=p_num_classes, **kwargs
              )
              self.fc = nn.Linear(
                  input_dim * 2, num_classes + eye_num_classes
              )
      else:
          self.net = timm.create_model(
              cfg.network, num_classes=p_num_classes, **kwargs
          )
  
      if cfg.no_gap:
          in_channel = self.net.num_features
          feat_hw = (self.input_size // 32) ** 2
          mid_channel = 128
          self.no_gap_output = nn.Sequential(
              *[
                  nn.BatchNorm2d(in_channel),
                  nn.Conv2d(
                      in_channel,
                      mid_channel,
                      1,
                      stride=1,
                      padding=0,
                      bias=False,
                  ),
                  nn.ReLU(),
                  nn.Flatten(1),
                  nn.Linear(mid_channel * feat_hw, num_classes),
              ]
          )
  
      self.no_gap = cfg.no_gap
      self.use_arcface = cfg.use_arcface
      if self.use_arcface:
          self.neta = arcface_get_model(
              cfg.arcface_model, input_size=cfg.arcface_input_size
          )
          self.neta.load_state_dict(
              torch.load(
                  cfg.arcface_ckpt, map_location=torch.device("cpu")
              )
          )
          self.neta.eval()
          self.neta.requires_grad_(False)
          input_dim = 512  # resnet34d
          z_dim = 512  # arcface_dim
          hidden_dim = 256
          self.pool = nn.AdaptiveAvgPool2d(1)
          self.flatten = nn.Flatten(1)
          mlp_act = nn.LeakyReLU
  
          self.mlp = nn.Sequential(
              *[
                  nn.Linear(z_dim, hidden_dim),
                  mlp_act(),
                  nn.Linear(hidden_dim, hidden_dim),
                  mlp_act(),
                  nn.Linear(hidden_dim, hidden_dim),
                  mlp_act(),
                  nn.Linear(hidden_dim, hidden_dim),
                  mlp_act(),
                  nn.Linear(hidden_dim, hidden_dim),
                  mlp_act(),
                  nn.Linear(hidden_dim, hidden_dim),
                  mlp_act(),
                  nn.Linear(hidden_dim, input_dim),
              ]
          )
          style_blocks = []
          for i in range(3):
              style_blocks += [
                  ResnetBlock_Adain(input_dim, latent_size=z_dim)
              ]
          self.style_blocks = nn.Sequential(*style_blocks)
          self.branch2d = nn.Sequential(
              *[
                  nn.Conv2d(
                      input_dim,
                      input_dim,
                      3,
                      stride=1,
                      padding=1,
                      bias=False,
                  ),
                  nn.BatchNorm2d(input_dim),
                  nn.ReLU(),
              ]
          )
          self.fc = nn.Linear(input_dim * 2, num_classes)
  
imports: import os
  import time
  import timm
  import glob
  import numpy
  import os.path
  import torch
  import torch.distributed
  from torch import nn
  import torch.nn.functional
  from .iresnet import get_model
label_desc: Use image node_id 1 to create a new OneNetwork object from inherited base classes: nn with example: obj = OneNetwork(cfg)