class_docstr: Inspired by https://github.com/kuangliu/pytorch-src
  Transform between (bboxes, lables) <-> SSD output
  
  dboxes: default boxes in size 8732 x 4,
      encoder: input ltrb format, output xywh format
      decoder: input xywh format, output ltrb format
  
  encode:
      input  : bboxes_in (Tensor nboxes x 4), labels_in (Tensor nboxes)
      output : bboxes_out (Tensor 8732 x 4), labels_out (Tensor 8732)
      criteria : IoU threshold of bboexes
  
  decode:
      input  : bboxes_in (Tensor 8732 x 4), scores_in (Tensor 8732 x nitems)
      output : bboxes_out (Tensor nboxes x 4), labels_out (Tensor nboxes)
      criteria : IoU threshold of bboexes
      max_output : maximum number of output bboxes
docstr: decode:
      input  : bboxes_in (Tensor 8732 x 4), scores_in (Tensor 8732 x nitems)
      output : bboxes_out (Tensor nboxes x 4), labels_out (Tensor nboxes)
      criteria : IoU threshold of bboexes
      max_output : maximum number of output bboxes
docstr_tok: ["decode",":","input",":","bboxes_in","(","Tensor","8732","x","4",")",",","scores_in","(","Tensor","8732","x","nitems",")","output",":","bboxes_out","(","Tensor","nboxes","x","4",")",",","labels_out","(","Tensor","nboxes",")","criteria",":","IoU","threshold","of","bboexes","max_output",":","maximum","number","of","output","bboxes"]
code: def decode_single_new(
      self, bboxes_in, scores_in, criteria, num_output=200
  ):
      """
      decode:
          input  : bboxes_in (Tensor 8732 x 4), scores_in (Tensor 8732 x nitems)
          output : bboxes_out (Tensor nboxes x 4), labels_out (Tensor nboxes)
          criteria : IoU threshold of bboexes
          max_output : maximum number of output bboxes
      """
      device = bboxes_in.device
      num_classes = scores_in.shape[-1]
  
      # 对越界的bbox进行裁剪
      bboxes_in = bboxes_in.clamp(min=0, max=1)
  
      # [8732, 4] -> [8732, 21, 4]
      bboxes_in = bboxes_in.repeat(1, num_classes).reshape(
          scores_in.shape[0], -1, 4
      )
  
      # create labels for each prediction
      labels = torch.arange(num_classes, device=device)
      labels = labels.view(1, -1).expand_as(scores_in)
  
      # remove prediction with the background label
      # 移除归为背景类别的概率信息
      bboxes_in = bboxes_in[:, 1:, :]
      scores_in = scores_in[:, 1:]
      labels = labels[:, 1:]
  
      # batch everything, by making every class prediction be a separate instance
      bboxes_in = bboxes_in.reshape(-1, 4)
      scores_in = scores_in.reshape(-1)
      labels = labels.reshape(-1)
  
      # remove low scoring boxes
      # 移除低概率目标，self.scores_thresh=0.05
      inds = torch.nonzero(scores_in > 0.05, as_tuple=False).squeeze(1)
      bboxes_in, scores_in, labels = (
          bboxes_in[inds],
          scores_in[inds],
          labels[inds],
      )
  
      # remove empty boxes
      ws, hs = (
          bboxes_in[:, 2] - bboxes_in[:, 0],
          bboxes_in[:, 3] - bboxes_in[:, 1],
      )
      keep = (ws >= 0.1 / 300) & (hs >= 0.1 / 300)
      keep = keep.nonzero(as_tuple=False).squeeze(1)
      bboxes_in, scores_in, labels = (
          bboxes_in[keep],
          scores_in[keep],
          labels[keep],
      )
  
      # non-maximum suppression
      keep = batched_nms(
          bboxes_in, scores_in, labels, iou_threshold=criteria
      )
  
      # keep only topk scoring predictions
      keep = keep[:num_output]
      bboxes_out = bboxes_in[keep, :]
      scores_out = scores_in[keep]
      labels_out = labels[keep]
  
      return bboxes_out, labels_out, scores_out
  
imports: from math import sqrt
  import itertools
  import torch
  import torch.nn.functional
  from torch.jit.annotations import Tuple, List
  from torch import nn, Tensor
  import numpy
label_desc: Use image node_id 5 for calling the Encoder obj's underlying member method code with example usage: obj.decode_single_new(bboxes_in, scores_in, criteria, num_output) and returns: bboxes_out,  labels_out,  scores_out