class_docstr: ReitinaFace
  
  RetinaFace: Single-stage Dense Face Localisation in the Wild.
  Described in https://arxiv.org/abs/1905.00641.
  
  Args:
      cfg (`Dict`):
          Network related settings.
      phase (`str`):
          train or test.
class_docstr_tok: ["ReitinaFace","RetinaFace",":","Single-stage","Dense","Face","Localisation","in","the","Wild",".","Described","in","https",":","\/\/arxiv.org\/abs\/1905.00641",".","Args",":","cfg","(","`","Dict","`",")",":","Network","related","settings",".","phase","(","`","str","`",")",":","train","or","test","."]
code: def __init__(self, cfg: Dict = None, phase: str = "train"):
      super().__init__()
      self.phase = phase
      backbone = None
      self.cfg = cfg
      if cfg["name"] == "mobilenet0.25":
          backbone = MobileNetV1()
          # if cfg['pretrain']:
          #    checkpoint = torch.load('./pretrained_weights/mobilenetV1X0.25_pretrain.tar', map_location=torch.device('cpu'))
          #    new_state_dict = OrderedDict()
          #    for k, v in checkpoint['state_dict'].items():
          #        name = k[7:]  # remove module.
          #        new_state_dict[name] = v
          #    # load params
          #    backbone.load_state_dict(new_state_dict)
      elif cfg["name"] == "Resnet50":
          # backbone = models.resnet50(pretrained=cfg['pretrain'])
          backbone = models.resnet50(False)
  
      self.body = IntermediateLayerGetter(
          backbone, cfg["return_layers"]
      )
      in_channels_stage2 = cfg["in_channel"]
      in_channels_list = [
          in_channels_stage2 * 2,
          in_channels_stage2 * 4,
          in_channels_stage2 * 8,
      ]
      out_channels = cfg["out_channel"]
      self.max_size = cfg["max_size"]
      self.target_size = cfg["target_size"]
      self.fpn = RetinaFaceFPN(in_channels_list, out_channels)
      self.ssh1 = SSH(out_channels, out_channels)
      self.ssh2 = SSH(out_channels, out_channels)
      self.ssh3 = SSH(out_channels, out_channels)
  
      self.class_head = self._make_class_head(
          fpn_num=3, inchannels=cfg["out_channel"]
      )
      self.bbox_head = self._make_bbox_head(
          fpn_num=3, inchannels=cfg["out_channel"]
      )
      self.landmark_head = self._make_landmark_head(
          fpn_num=3, inchannels=cfg["out_channel"]
      )
  
imports: from typing import Tuple, Dict
  import numpy
  import torch
  from torch import nn
  import torch.nn.functional
  import torchvision
  from torchvision import models
  from towhee.models.retina_face.ssh import SSH
  from towhee.models.retina_face.mobilenet_v1 import MobileNetV1
  from towhee.models.retina_face.retinaface_fpn import RetinaFaceFPN
  from towhee.models.retina_face.heads import ClassHead, BboxHead, LandmarkHead
  from towhee.models.retina_face.prior_box import PriorBox
  from towhee.models.retina_face.utils import decode, decode_landm, IntermediateLayerGetter
label_desc: Use image node_id 1 to create a new RetinaFace object from inherited base classes: nn with example: obj = RetinaFace(cfg, phase)