class_docstr: build SiamRPNTracker.predicted tracking result.and according to
  tracking result, product window penalty and smooth bbox
  
  Parameters
  ----------
      PENALTY_K : float
          Scale penalty
      WINDOW_INFLUENCE :float
          Window influence
      LR : float
          Interpolation learning rate
      EXEMPLAR_SIZE : int
          EXEMPLAR_SIZE
      INSTANCE_SIZE : int
          INSTANCE_SIZE
      BASE_SIZE : int
          Base size
      CONTEXT_AMOUNT : float
          Context amount
      STRIDE : int
          Anchor stride
      RATIOS : tuple
          Anchor ratios
      SCALES : tuple
          Anchor scales
class_docstr_tok: ["build","SiamRPNTracker.predicted","tracking","result.and","according","to","tracking","result",",","product","window","penalty","and","smooth","bbox","Parameters","--","--","--","--","--","PENALTY_K",":","float","Scale","penalty","WINDOW_INFLUENCE",":","float","Window","influence","LR",":","float","Interpolation","learning","rate","EXEMPLAR_SIZE",":","int","EXEMPLAR_SIZE","INSTANCE_SIZE",":","int","INSTANCE_SIZE","BASE_SIZE",":","int","Base","size","CONTEXT_AMOUNT",":","float","Context","amount","STRIDE",":","int","Anchor","stride","RATIOS",":","tuple","Anchor","ratios","SCALES",":","tuple","Anchor","scales"]
docstr: Adjust the position of the frame to prevent the boundary from being exceeded.
  If the boundary is exceeded,
  the average value of each channel of the image is used to replace the exceeded value.
  
  Parameters
  ----------
  im : np.ndarray
      BGR based image
  pos : list
      center position
  model_sz : array
      exemplar size, x is 127, z is 287 in ours
  original_sz: array
      original size
  avg_chans : array
      channel average
  ctx : mxnet.Context
      Context such as mx.cpu(), mx.gpu(0).
  
  Returns
  -------
      rejust window though avg channel
docstr_tok: ["Adjust","the","position","of","the","frame","to","prevent","the","boundary","from","being","exceeded",".","If","the","boundary","is","exceeded",",","the","average","value","of","each","channel","of","the","image","is","used","to","replace","the","exceeded","value",".","Parameters","--","--","--","--","--","im",":","np.ndarray","BGR","based","image","pos",":","list","center","position","model_sz",":","array","exemplar","size",",","x","is","127",",","z","is","287","in","ours","original_sz",":","array","original","size","avg_chans",":","array","channel","average","ctx",":","mxnet.Context","Context","such","as","mx.cpu","(",")",",","mx.gpu","(","0",")",".","Returns","--","--","--","-","rejust","window","though","avg","channel"]
code: def get_subwindow(
      self, img, pos, model_sz, original_sz, avg_chans, ctx
  ):
      """
      Adjust the position of the frame to prevent the boundary from being exceeded.
      If the boundary is exceeded,
      the average value of each channel of the image is used to replace the exceeded value.
  
      Parameters
      ----------
      im : np.ndarray
          BGR based image
      pos : list
          center position
      model_sz : array
          exemplar size, x is 127, z is 287 in ours
      original_sz: array
          original size
      avg_chans : array
          channel average
      ctx : mxnet.Context
          Context such as mx.cpu(), mx.gpu(0).
  
      Returns
      -------
          rejust window though avg channel
      """
      cv2 = try_import_cv2()
      if isinstance(pos, float):
          pos = [pos, pos]
      im_sz = img.shape
      original_c = (original_sz + 1) / 2
      context_xmin = np.floor(pos[0] - original_c + 0.5)
      context_xmax = context_xmin + original_sz - 1
      context_ymin = np.floor(pos[1] - original_c + 0.5)
      context_ymax = context_ymin + original_sz - 1
      left_pad = int(max(0.0, -context_xmin))
      top_pad = int(max(0.0, -context_ymin))
      right_pad = int(max(0.0, context_xmax - im_sz[1] + 1))
      bottom_pad = int(max(0.0, context_ymax - im_sz[0] + 1))
  
      context_xmin = context_xmin + left_pad
      context_xmax = context_xmax + left_pad
      context_ymin = context_ymin + top_pad
      context_ymax = context_ymax + top_pad
      im_h, im_w, im_c = img.shape
  
      if any([top_pad, bottom_pad, left_pad, right_pad]):
          # If there is a pad, use the average channels to complete
          size = (
              im_h + top_pad + bottom_pad,
              im_w + left_pad + right_pad,
              im_c,
          )
          te_im = np.zeros(size, np.uint8)
          te_im[
              top_pad : top_pad + im_h, left_pad : left_pad + im_w, :
          ] = img
          if top_pad:
              te_im[
                  0:top_pad, left_pad : left_pad + im_w, :
              ] = avg_chans
          if bottom_pad:
              te_im[
                  im_h + top_pad :, left_pad : left_pad + im_w, :
              ] = avg_chans
          if left_pad:
              te_im[:, 0:left_pad, :] = avg_chans
          if right_pad:
              te_im[:, im_w + left_pad :, :] = avg_chans
          im_patch = te_im[
              int(context_ymin) : int(context_ymax + 1),
              int(context_xmin) : int(context_xmax + 1),
              :,
          ]
      else:
          # If there is no pad, crop Directly
          im_patch = img[
              int(context_ymin) : int(context_ymax + 1),
              int(context_xmin) : int(context_xmax + 1),
              :,
          ]
      if not np.array_equal(model_sz, original_sz):
          im_patch = cv2.resize(im_patch, (model_sz, model_sz))
      im_patch = im_patch.transpose(2, 0, 1)
      im_patch = im_patch[np.newaxis, :, :, :]
      im_patch = im_patch.astype(np.float32)
      im_patch = mx.nd.array(im_patch, ctx)
      return im_patch
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import math
  from collections import namedtuple
  import numpy
  import mxnet
  from mxnet import nd
  from gluoncv.utils.filesystem import try_import_cv2
label_desc: Use image node_id 6 for calling the SiamRPNTracker obj's underlying member method code with example usage: obj.get_subwindow(img, pos, model_sz, original_sz, avg_chans, ctx) and returns: im_patch