code: def yolo_boxes_to_yolo_map(
      gt_mxboxes, input_shape, output_shape, num_classes, anchors
  ):
      num_anchors = len(anchors)
  
      # The 5 are: y, x, h, w, class id
      ymap_shape = tuple(output_shape) + (num_anchors, 5 + num_classes)
      ymap = _np.zeros(ymap_shape, dtype=_np.float32)
  
      ymap[..., 5:] = 1 / num_classes
  
      for gt_mxbox, gt_cls in zip(gt_mxboxes[:, 1:], gt_mxboxes[:, 0]):
          gt_cls = int(gt_cls)
          if gt_cls < 0:
              break
  
          x = output_shape[1] * (gt_mxbox[0] + gt_mxbox[2]) / 2
          y = output_shape[0] * (gt_mxbox[1] + gt_mxbox[3]) / 2
          w = output_shape[1] * (gt_mxbox[2] - gt_mxbox[0])
          h = output_shape[0] * (gt_mxbox[3] - gt_mxbox[1])
  
          # Skip boxes with zero area (this usually means that they have been
          # transformed to lie outside the image and then clipped to the edge
          if w * h < 1e-3:
              continue
  
          iy = int(_np.floor(y))
          ix = int(_np.floor(x))
  
          if 0 <= iy < output_shape[0] and 0 <= ix < output_shape[1]:
              # YOLO uses (x, y)/(w, h) order and not (y, x)/(h, w)
              ymap[iy, ix, :, 0] = x - _np.floor(x)
              ymap[iy, ix, :, 1] = y - _np.floor(y)
              ymap[iy, ix, :, 2] = w
              ymap[iy, ix, :, 3] = h
              ymap[iy, ix, :, 4] = 1
              ymap[iy, ix, :, 5:] = 0
              ymap[iy, ix, :, 5 + gt_cls] = 1
  
      return ymap
  
file_path: turicreate/src/python/turicreate/toolkits/object_detector/_detection.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: yolo_boxes_to_yolo_map(gt_mxboxes, input_shape, output_shape, num_classes, anchors) and returns: ymap