parameters: (self, score_size)
return_statement: return anchor
docstring: Args:
              im:         bgr based input image frame
              pos:        position of the center of the frame
              model_sz:   exemplar / target image size
              s_z:        original / search image size
              avg_chans:  channel average
          Return:
              anchor:     anchors for pre-determined values of stride, ratio, and scale
docstring_summary: Args:
              im:         bgr based input image frame
              pos:        position of the center of the frame
              model_sz:   exemplar / target image size
              s_z:        original / search image size
              avg_chans:  channel average
          Return:
              anchor:     anchors for pre-determined values of stride, ratio, and scale
docstring_tokens: Args : im : bgr based input image frame pos : position of the center of the frame model_sz : exemplar / target image size s_z : original / search image size avg_chans : channel average Return : anchor : anchors for pre - determined values of stride ratio and scale
function: def generate_anchor(self, score_size):
          """
          Args:
              im:         bgr based input image frame
              pos:        position of the center of the frame
              model_sz:   exemplar / target image size
              s_z:        original / search image size
              avg_chans:  channel average
          Return:
              anchor:     anchors for pre-determined values of stride, ratio, and scale
          """
          anchors = Anchors(self.anchor_stride, self.anchor_ratios, self.anchor_scales)
          anchor = anchors.anchors
          x1, y1, x2, y2 = anchor[:, 0], anchor[:, 1], anchor[:, 2], anchor[:, 3]
          anchor = np.stack([(x1 + x2) * 0.5, (y1 + y2) * 0.5, x2 - x1, y2 - y1], 1)
          total_stride = anchors.stride
          anchor_num = anchors.anchor_num
          anchor = np.tile(anchor, score_size * score_size).reshape((-1, 4))
          ori = - (score_size // 2) * total_stride
          xx, yy = np.meshgrid([ori + total_stride * dx for dx in range(score_size)],
                               [ori + total_stride * dy for dy in range(score_size)])
          xx, yy = np.tile(xx.flatten(), (anchor_num, 1)).flatten(), \
                   np.tile(yy.flatten(), (anchor_num, 1)).flatten()
          anchor[:, 0], anchor[:, 1] = xx.astype(np.float32), yy.astype(np.float32)
          return anchor
function_tokens: def generate_anchor ( self , score_size ) : anchors = Anchors ( self . anchor_stride , self . anchor_ratios , self . anchor_scales ) anchor = anchors . anchors x1 , y1 , x2 , y2 = anchor [ : , 0 ] , anchor [ : , 1 ] , anchor [ : , 2 ] , anchor [ : , 3 ] anchor = np . stack ( [ ( x1 + x2 ) * 0.5 , ( y1 + y2 ) * 0.5 , x2 - x1 , y2 - y1 ] , 1 ) total_stride = anchors . stride anchor_num = anchors . anchor_num anchor = np . tile ( anchor , score_size * score_size ) . reshape ( ( - 1 , 4 ) ) ori = - ( score_size // 2 ) * total_stride xx , yy = np . meshgrid ( [ ori + total_stride * dx for dx in range ( score_size ) ] , [ ori + total_stride * dy for dy in range ( score_size ) ] ) xx , yy = np . tile ( xx . flatten ( ) , ( anchor_num , 1 ) ) . flatten ( ) , np . tile ( yy . flatten ( ) , ( anchor_num , 1 ) ) . flatten ( ) anchor [ : , 0 ] , anchor [ : , 1 ] = xx . astype ( np . float32 ) , yy . astype ( np . float32 ) return anchor