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 inference(
      self, img: np.array
  ) -> Tuple[torch.FloatTensor, torch.FloatTensor]:
      im_shape = img.shape
      h, w, _ = im_shape
      im_height, im_width = h, w
  
      # pylint: disable=unsubscriptable-object
      scale = torch.Tensor(
          [img.shape[1], img.shape[0], img.shape[1], img.shape[0]]
      )
      device = img.get_device()
      if device == -1:
          device = torch.device("cpu")
      mean = torch.FloatTensor(self.cfg["mean"]).to(device)
      img = img - mean
      img = img.permute(2, 0, 1)
      img = img.unsqueeze(0)
      img = img.to(device)
  
      scale = scale.to(device)
  
      loc, conf, landms = self.forward(img)
      priorbox = PriorBox(self.cfg, image_size=(im_height, im_width))
      priors = priorbox.forward()
      priors = priors.to(device)
      prior_data = priors.data
      boxes = decode(
          loc.data.squeeze(0), prior_data, self.cfg["variance"]
      )
      boxes = boxes * scale
      boxes = boxes.to(device)
      scores = conf.squeeze(0).data[:, 1]
      landms = decode_landm(
          landms.data.squeeze(0), prior_data, self.cfg["variance"]
      )
  
      scale_replicate = torch.Tensor([img.shape[3], img.shape[2]] * 5)
      scale_replicate = scale_replicate.to(device)
      dets = torch.hstack((boxes, scores.unsqueeze(-1)))
      keep = torchvision.ops.nms(
          dets[:, :4], dets[:, 4], self.cfg["nms_threshold"]
      )
      dets = dets[keep, :]
      landms = landms[keep]
      confident_ids = torch.where(
          dets[:, 4] > self.cfg["confidence_threshold"]
      )
      return dets[confident_ids], landms[confident_ids]
  
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 6 for calling the RetinaFace obj's underlying member method code with example usage: obj.inference(img) and returns: dets,  landms