def narrow_to(self, featuremap):
        """
        Slice anchors to the spatial size of this featuremap.
        """
        shape2d = tf.shape(featuremap)[2:]  # h,w
        slice3d = tf.concat([shape2d, [-1]], axis=0)
        slice4d = tf.concat([shape2d, [-1, -1]], axis=0)
        boxes = tf.slice(self.boxes, [0, 0, 0, 0], slice4d)
        gt_labels = tf.slice(self.gt_labels, [0, 0, 0], slice3d)
        gt_boxes = tf.slice(self.gt_boxes, [0, 0, 0, 0], slice4d)
        return RPNAnchors(boxes, gt_labels, gt_boxes)
def narrow_to ( self , featuremap ) : shape2d = tf . shape ( featuremap ) [ 2 : ] slice3d = tf . concat ( [ shape2d , [ - 1 ] ] , axis = 0 ) slice4d = tf . concat ( [ shape2d , [ - 1 , - 1 ] ] , axis = 0 ) boxes = tf . slice ( self . boxes , [ 0 , 0 , 0 , 0 ] , slice4d ) gt_labels = tf . slice ( self . gt_labels , [ 0 , 0 , 0 ] , slice3d ) gt_boxes = tf . slice ( self . gt_boxes , [ 0 , 0 , 0 , 0 ] , slice4d ) return RPNAnchors ( boxes , gt_labels , gt_boxes )
Slice anchors to the spatial size of this featuremap.