code: def test(dataset, tracker, opt, ctx):
      """SiamRPN test."""
      cv2 = try_import_cv2()
      for v_idx, video in enumerate(dataset):
          if opt.video != "":
              if video.name != opt.video:
                  continue
          toc = 0
          pred_bboxes = []
          scores = []
          track_times = []
          for idx, (img, gt_bbox) in enumerate(video):
              tic = cv2.getTickCount()
              if idx == 0:
                  x_max, y_max, gt_w, gt_t = get_axis_aligned_bbox(
                      np.array(gt_bbox)
                  )
                  gt_bbox_ = [
                      x_max - (gt_w - 1) / 2,
                      y_max - (gt_t - 1) / 2,
                      gt_w,
                      gt_t,
                  ]
                  tracker.init(img, gt_bbox_, ctx)
                  pred_bbox = gt_bbox_
                  scores.append(None)
                  pred_bboxes.append(pred_bbox)
              else:
                  outputs = tracker.track(img, ctx)
                  pred_bbox = outputs["bbox"]
                  pred_bboxes.append(pred_bbox)
                  scores.append(outputs["best_score"])
              toc += cv2.getTickCount() - tic
              track_times.append(
                  (cv2.getTickCount() - tic) / cv2.getTickFrequency()
              )
              if idx == 0:
                  cv2.destroyAllWindows()
              if opt.vis and idx > 0:
                  gt_bbox = list(map(int, gt_bbox))
                  pred_bbox = list(map(int, pred_bbox))
                  cv2.rectangle(
                      img,
                      (gt_bbox[0], gt_bbox[1]),
                      (
                          gt_bbox[0] + gt_bbox[2],
                          gt_bbox[1] + gt_bbox[3],
                      ),
                      (0, 255, 0),
                      3,
                  )
                  cv2.rectangle(
                      img,
                      (pred_bbox[0], pred_bbox[1]),
                      (
                          pred_bbox[0] + pred_bbox[2],
                          pred_bbox[1] + pred_bbox[3],
                      ),
                      (0, 255, 255),
                      3,
                  )
                  cv2.putText(
                      img,
                      str(idx),
                      (40, 40),
                      cv2.FONT_HERSHEY_SIMPLEX,
                      1,
                      (0, 255, 255),
                      2,
                  )
                  cv2.imshow(video.name, img)
                  cv2.waitKey(1)
          toc /= cv2.getTickFrequency()
          model_path = os.path.join(
              opt.results_path,
              opt.dataset,
              opt.model_path.split("/")[-1].split(".")[0],
          )
          if not os.path.isdir(model_path):
              os.makedirs(model_path)
          with open(
              os.path.join(model_path, "{}.txt".format(video.name)), "w"
          ) as f_w:
              for per_pbbox in pred_bboxes:
                  f_w.write(
                      ",".join([str(i) for i in per_pbbox]) + "\n"
                  )
          print(
              "({:3d}) Video: {:12s} Time: {:5.1f}s Speed: {:3.1f}fps".format(
                  v_idx + 1, video.name, toc, len(video) / toc
              )
          )
  
file_path: gluon-cv/scripts/tracking/siamrpn/test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import argparse
  import os
  import numpy
  import mxnet
  from gluoncv.model_zoo.siamrpn.siamrpn_tracker import SiamRPNTracker
  from gluoncv.data.otb.tracking import OTBTracking
  from gluoncv.model_zoo.siamrpn.siamrpn_tracker import get_axis_aligned_bbox
  from gluoncv.model_zoo import get_model
  from gluoncv.utils.filesystem import try_import_cv2
label_desc: Use image node_id 3 for calling a global function with example usage: test(dataset, tracker, opt, ctx) without return types