class_docstr: 对YOLO的输出进行处理
class_docstr_tok: ["\u5bf9YOLO\u7684\u8f93\u51fa\u8fdb\u884c\u5904\u7406"]
code: def __init__(self, anchors, nc, img_size, stride):
      super(YOLOLayer, self).__init__()
      self.anchors = torch.Tensor(anchors)
      self.stride = stride  # layer stride 特征图上一步对应原图上的步距 [32, 16, 8]
      self.na = len(anchors)  # number of anchors (3)
      self.nc = nc  # number of classes (80)
      self.no = (
          nc + 5
      )  # number of outputs (85: x, y, w, h, obj, cls1, ...)
      self.nx, self.ny, self.ng = (
          0,
          0,
          (0, 0),
      )  # initialize number of x, y gridpoints
      # 将anchors大小缩放到grid尺度
      self.anchor_vec = self.anchors / self.stride
      # batch_size, na, grid_h, grid_w, wh,
      # 值为1的维度对应的值不是固定值，后续操作可根据broadcast广播机制自动扩充
      self.anchor_wh = self.anchor_vec.view(1, self.na, 1, 1, 2)
      self.grid = None
  
      if ONNX_EXPORT:
          self.training = False
          self.create_grids(
              (img_size[1] // stride, img_size[0] // stride)
          )
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/yolov3_spp/models.py
imports: from build_utils.layers import *
  from build_utils.parse_config import *
label_desc: Use image node_id 1 to create a new YOLOLayer object from inherited base classes: nn with example: obj = YOLOLayer(anchors, nc, img_size, stride)