class_docstr: Detect faces in a given image using a CNN.
  
  By default, it uses the method described in :cite:`facedetect-yu`.
  
  Args:
      top_k: the maximum number of detections to return before the nms.
      confidence_threshold: the threshold used to discard detections.
      nms_threshold: the threshold used by the nms for iou.
      keep_top_k: the maximum number of detections to return after the nms.
  
  Return:
      A list of B tensors with shape :math:`(N,15)` to be used with :py:class:`kornia.contrib.FaceDetectorResult`.
  
  Example:
      >>> img = torch.rand(1, 3, 320, 320)
      >>> detect = FaceDetector()
      >>> res = detect(img)
class_docstr_tok: ["Detect","faces","in","a","given","image","using","a","CNN",".","By","default",",","it","uses","the","method","described","in",":","cite",":","`","facedetect-yu","`",".","Args",":","top_k",":","the","maximum","number","of","detections","to","return","before","the","nms",".","confidence_threshold",":","the","threshold","used","to","discard","detections",".","nms_threshold",":","the","threshold","used","by","the","nms","for","iou",".","keep_top_k",":","the","maximum","number","of","detections","to","return","after","the","nms",".","Return",":","A","list","of","B","tensors","with","shape",":","math",":","`","(","N,15",")","`","to","be","used","with",":","py",":","class",":","`","kornia.contrib.FaceDetectorResult","`",".","Example",":",">",">",">","img","=","torch.rand","(","1",",","3",",","320",",","320",")",">",">",">","detect","=","FaceDetector","(",")",">",">",">","res","=","detect","(","img",")"]
code: def postprocess(
      self, data: Dict[str, torch.Tensor], height: int, width: int
  ) -> List[torch.Tensor]:
      loc, conf, iou = data["loc"], data["conf"], data["iou"]
  
      scale = torch.tensor(
          [
              width,
              height,
              width,
              height,
              width,
              height,
              width,
              height,
              width,
              height,
              width,
              height,
              width,
              height,
          ],
          device=loc.device,
          dtype=loc.dtype,
      )  # 14
  
      priors = _PriorBox(
          self.min_sizes,
          self.steps,
          self.clip,
          image_size=(height, width),
      )
      priors = priors.to(loc.device, loc.dtype)
  
      batched_dets: List[torch.Tensor] = []
      for batch_elem in range(loc.shape[0]):
          boxes = _decode(
              loc[batch_elem], priors(), self.variance
          )  # Nx14
          boxes = boxes * scale
  
          # clamp here for the compatibility for ONNX
          cls_scores, iou_scores = (
              conf[batch_elem, :, 1],
              iou[batch_elem, :, 0],
          )
          scores = (cls_scores * iou_scores.clamp(0.0, 1.0)).sqrt()
  
          # ignore low scores
          inds = scores > self.confidence_threshold
          boxes, scores = boxes[inds], scores[inds]
  
          # keep top-K before NMS
          order = scores.sort(descending=True)[1][: self.top_k]
          boxes, scores = boxes[order], scores[order]
  
          # performd NMS
          # NOTE: nms need to be revise since does not export well to onnx
          dets = torch.cat((boxes, scores[:, None]), dim=-1)  # Nx15
          keep = self.nms(boxes[:, :4], scores, self.nms_threshold)
          if len(keep) > 0:
              dets = dets[keep, :]
  
          # keep top-K faster NMS
          batched_dets.append(dets[: self.keep_top_k])
      return batched_dets
  
imports: import math
  from enum import Enum
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn.functional
  from torch import nn
  from kornia.geometry.bbox import nms
  from kornia.utils.helpers import map_location_to_cpu
label_desc: Use image node_id 3 for calling the FaceDetector obj's underlying member method code with example usage: obj.postprocess(data, height, width) and returns: batched_dets