lib/model/siamese_net/siameseRPN.py
def depth_wise_cross_correlation_box(self, target_feat, template_feat, bias=None):
        '''
        Calculate depth-wise cross correlation.
        :param target_feat: input feature map. It is of size (1,c,H,W)
        :param template_feat: convolution kernel. It is of size (N * out_c, in_c, kH, kW).
                    N is the number of templates.
        :return: correlation map.
        '''
        n_templates = template_feat.size(0)  # N
        out_dim_w = template_feat.size(1)  # K
        in_dim_w = template_feat.size(2)  # C
        kh = template_feat.size(3)
        kw = template_feat.size(4)
        template_feat = template_feat.view(n_templates * out_dim_w * in_dim_w, 1, kh, kw)
        H = target_feat.size(2)
        W = target_feat.size(3)

        out = nn.functional.conv2d(
            target_feat,
            template_feat,
            bias=None,
            stride=1,
            padding=int((template_feat.size(2) - 1) / 2),
            dilation=1,
            groups=in_dim_w)

        out = out.view(n_templates * out_dim_w, in_dim_w, H, W)
        out = self.conv_merge_1x1_box(out)
        out = out.view(n_templates, out_dim_w, H, W)
        if bias is not None:
            out = out + bias
        return out

        Calculate depth-wise cross correlation.
        :param target_feat: input feature map. It is of size (1,c,H,W)
        :param template_feat: convolution kernel. It is of size (N * out_c, in_c, kH, kW).
                    N is the number of templates.
        :return: correlation map.
        
Calculate depth-wise cross correlation.
Calculate depth - wise cross correlation .
def depth_wise_cross_correlation_box(self, target_feat, template_feat, bias=None):
        n_templates = template_feat.size(0)  
        out_dim_w = template_feat.size(1)  
        in_dim_w = template_feat.size(2)  
        kh = template_feat.size(3)
        kw = template_feat.size(4)
        template_feat = template_feat.view(n_templates * out_dim_w * in_dim_w, 1, kh, kw)
        H = target_feat.size(2)
        W = target_feat.size(3)
        out = nn.functional.conv2d(
            target_feat,
            template_feat,
            bias=None,
            stride=1,
            padding=int((template_feat.size(2) - 1) / 2),
            dilation=1,
            groups=in_dim_w)
        out = out.view(n_templates * out_dim_w, in_dim_w, H, W)
        out = self.conv_merge_1x1_box(out)
        out = out.view(n_templates, out_dim_w, H, W)
        if bias is not None:
            out = out + bias
        return out
def depth_wise_cross_correlation_box ( self , target_feat , template_feat , bias = None ) : n_templates = template_feat . size ( 0 ) out_dim_w = template_feat . size ( 1 ) in_dim_w = template_feat . size ( 2 ) kh = template_feat . size ( 3 ) kw = template_feat . size ( 4 ) template_feat = template_feat . view ( n_templates * out_dim_w * in_dim_w , 1 , kh , kw ) H = target_feat . size ( 2 ) W = target_feat . size ( 3 ) out = nn . functional . conv2d ( target_feat , template_feat , bias = None , stride = 1 , padding = int ( ( template_feat . size ( 2 ) - 1 ) / 2 ) , dilation = 1 , groups = in_dim_w ) out = out . view ( n_templates * out_dim_w , in_dim_w , H , W ) out = self . conv_merge_1x1_box ( out ) out = out . view ( n_templates , out_dim_w , H , W ) if bias is not None : out = out + bias return out
Calculate depth-wise cross correlation.
Calculate depth - wise cross correlation .
'''
        Calculate depth-wise cross correlation.
        :param target_feat: input feature map. It is of size (1,c,H,W)
        :param template_feat: convolution kernel. It is of size (N * out_c, in_c, kH, kW).
                    N is the number of templates.
        :return: correlation map.
        ''' # N
 # K
 # C

None
self
target_feat
input feature map. It is of size (1,c,H,W)
input feature map . It is of size ( 1 c H W )
template_feat
convolution kernel. It is of size (N * out_c, in_c, kH, kW).
N is the number of templates.
convolution kernel . It is of size ( N * out_c in_c kH kW ) . N is the number of templates .
bias