class_docstr: Implementation of the SMOT tracker
  The steps to use the tracker is:
  0. Set anchors from the SSD
  1. First call tracker.predict(new_frame)
  2. Then get the tracking anchor information
  3. Run the detractor with the tracking anchor information
  4. Run tracker.update(new_detection, track_info).
class_docstr_tok: ["Implementation","of","the","SMOT","tracker","The","steps","to","use","the","tracker","is",":","0",".","Set","anchors","from","the","SSD","1",".","First","call","tracker.predict","(","new_frame",")","2",".","Then","get","the","tracking","anchor","information","3",".","Run","the","detractor","with","the","tracking","anchor","information","4",".","Run","tracker.update","(","new_detection",",","track_info",")","."]
docstr: The actual implementation of the assignment step.
  GPU acceleration is used because the number of anchors is huge
  Parameters
  ----------
  boxes: must have >1 boxes
  anchors
  
  Returns
  -------
docstr_tok: ["The","actual","implementation","of","the","assignment","step",".","GPU","acceleration","is","used","because","the","number","of","anchors","is","huge","Parameters","--","--","--","--","--","boxes",":","must","have",">","1","boxes","anchors","Returns","--","--","--","-"]
code: def _assign_box_to_anchors(
      self,
      boxes: np.ndarray,
      method: str = "avg",
      min_anchor_iou: float = 0.1,
  ):
      """
      The actual implementation of the assignment step.
      GPU acceleration is used because the number of anchors is huge
      Parameters
      ----------
      boxes: must have >1 boxes
      anchors
  
      Returns
      -------
  
      """
      t_start = time.time()
  
      t_iou = time.time()
      gpu_boxes = mx.nd.array(boxes, ctx=self.mx_ctx)
      anchor_track_iou = gpu_iou(self.anchor_tensor, gpu_boxes)
      elapsed_iou = time.time() - t_iou
      logging.info(
          "iou computation runtime: {:.05f}".format(elapsed_iou)
      )
  
      # get the top-k closest anchors instead of 1
      if method == "max":
          tracking_anchor_ious, tracking_anchor_indices = mx.nd.topk(
              anchor_track_iou,
              axis=0,
              k=1,
              ret_typ="both",
              dtype="int32",
          )
          tracking_anchor_ious = tracking_anchor_ious.T.asnumpy()
          tracking_anchor_indices = tracking_anchor_indices.T.asnumpy()
          tracking_anchor_weights = np.ones_like(
              tracking_anchor_indices
          )
      elif method == "avg":
          tracking_anchor_ious, tracking_anchor_indices = mx.nd.topk(
              anchor_track_iou,
              axis=0,
              k=self.k,
              ret_typ="both",
              dtype="int32",
          )
          tracking_anchor_ious = tracking_anchor_ious.T.asnumpy()
          tracking_anchor_indices = tracking_anchor_indices.T.asnumpy()
          tracking_anchor_weights = (
              np.ones_like(tracking_anchor_indices) / self.k
          )
      elif method == "iou":
          t_sort = time.time()
  
          tracking_anchor_ious, tracking_anchor_indices = mx.nd.topk(
              anchor_track_iou,
              axis=0,
              k=self.k,
              ret_typ="both",
              dtype="int32",
          )
          tracking_anchor_ious = tracking_anchor_ious.T.asnumpy()
          tracking_anchor_indices = tracking_anchor_indices.T.asnumpy()
  
          e_sort = time.time() - t_sort
          logging.info("sorting time: {:.05f}".format(e_sort))
          tracking_anchor_weights = (
              tracking_anchor_ious
              / tracking_anchor_ious.sum(axis=1)[..., None]
          )
      else:
          raise ValueError("unknown anchor assignment method")
  
      max_track_anchor_ious = tracking_anchor_ious.max(axis=1)
      tracking_anchor_validity = max_track_anchor_ious >= min_anchor_iou
  
      elapsed_assign = time.time() - t_start
      logging.info("assigment runtime: {}".format(elapsed_assign))
      return (
          tracking_anchor_indices,
          tracking_anchor_weights,
          tracking_anchor_validity,
      )
  
imports: from __future__ import absolute_import
  import logging
  import time
  import numpy
  import mxnet
  from gluoncv.utils.bbox import bbox_iou
  from gluoncv.data import COCODetection
  from .utils import timeit, Track
  from .motion_estimation import FarneBeckFlowMotionEstimator
  from .motion_estimation import DummyMotionEstimator
label_desc: Use image node_id 8 for calling the SMOTTracker obj's underlying member method code with example usage: obj._assign_box_to_anchors(boxes, method, min_anchor_iou) and returns: tracking_anchor_indices,  tracking_anchor_weights,  tracking_anchor_validity