lib/model/siamese_net/weight_cropping_layer.py
def forward(self, feats, rois):
        '''
        get the weights from the feats.
        :param feats: (N,C,H,W)
        :param rois: (n, 5)
        :return:
        '''
        if cfg.SIAMESE.CROP_TYPE == 'roi_align':
            cropped_feat = self.crop_kernel(feats, rois)
            out = cropped_feat
            #out = self.spatial_shrinkage_layer(cropped_feat)
        elif cfg.SIAMESE.CROP_TYPE == 'center_crop':
            rois_cntr_x = (rois[:,1]+rois[:,3])/2.0
            rois_cntr_y = (rois[:,2]+rois[:,4])/2.0
            rois[:, 1] = rois_cntr_x - (self.hf_sz) * self.stride
            rois[:, 3] = rois_cntr_x + (self.hf_sz) * self.stride + 1
            rois[:, 2] = rois_cntr_y - (self.hf_sz) * self.stride
            rois[:, 4] = rois_cntr_y + (self.hf_sz) * self.stride + 1
            cropped_feat = self.crop_kernel(feats, rois)
            out = cropped_feat
        else:
            raise ValueError('Not implemented.')
        return out

        get the weights from the feats.
        :param feats: (N,C,H,W)
        :param rois: (n, 5)
        :return:
        
get the weights from the feats.
get the weights from the feats .
def forward(self, feats, rois):
        if cfg.SIAMESE.CROP_TYPE == 'roi_align':
            cropped_feat = self.crop_kernel(feats, rois)
            out = cropped_feat
        elif cfg.SIAMESE.CROP_TYPE == 'center_crop':
            rois_cntr_x = (rois[:,1]+rois[:,3])/2.0
            rois_cntr_y = (rois[:,2]+rois[:,4])/2.0
            rois[:, 1] = rois_cntr_x - (self.hf_sz) * self.stride
            rois[:, 3] = rois_cntr_x + (self.hf_sz) * self.stride + 1
            rois[:, 2] = rois_cntr_y - (self.hf_sz) * self.stride
            rois[:, 4] = rois_cntr_y + (self.hf_sz) * self.stride + 1
            cropped_feat = self.crop_kernel(feats, rois)
            out = cropped_feat
        else:
            raise ValueError('Not implemented.')
        return out
def forward ( self , feats , rois ) : if cfg . SIAMESE . CROP_TYPE == 'roi_align' : cropped_feat = self . crop_kernel ( feats , rois ) out = cropped_feat elif cfg . SIAMESE . CROP_TYPE == 'center_crop' : rois_cntr_x = ( rois [ : , 1 ] + rois [ : , 3 ] ) / 2.0 rois_cntr_y = ( rois [ : , 2 ] + rois [ : , 4 ] ) / 2.0 rois [ : , 1 ] = rois_cntr_x - ( self . hf_sz ) * self . stride rois [ : , 3 ] = rois_cntr_x + ( self . hf_sz ) * self . stride + 1 rois [ : , 2 ] = rois_cntr_y - ( self . hf_sz ) * self . stride rois [ : , 4 ] = rois_cntr_y + ( self . hf_sz ) * self . stride + 1 cropped_feat = self . crop_kernel ( feats , rois ) out = cropped_feat else : raise ValueError ( 'Not implemented.' ) return out
get the weights from the feats.
get the weights from the feats .
'''
        get the weights from the feats.
        :param feats: (N,C,H,W)
        :param rois: (n, 5)
        :return:
        ''' #out = self.spatial_shrinkage_layer(cropped_feat)

None
self
feats
None
rois
None