(self, rpn_layers, dataloader, inference=False, num_rois=128, pre_nms_N=12000,
                 post_nms_N=2000, nms_thresh=0.7, min_bbox_size=16,
                 fg_fraction=None, fg_thresh=None, bg_thresh_hi=None, bg_thresh_lo=None,
                 deterministic=False, name=None, debug=False)
Arguments:
            rpn_layers (list): References to the RPN layers: [RPN_1x1_obj, RPN_1x1_bbox]
            target_buffers (tuple): Target buffers for training fast-rcnn: (class, bbox regression)
            num_rois (int, optional): Number of ROIs to sample from proposed (default: 128)
            pre_nms_N (int, optional): Number of ROIs to retain before using NMS (default: 12000)
            post_nms_N (int, optional): Number of ROIs to retain after using NMS (default: 2000)
            nms_thresh (float, optional): Threshold for non-maximum supression (default: 0.7)
            min_bbox_size (integer, optional): Minimize bboxes side length (default: 16)
            name (string, optional): Name of layer (default: None)
Arguments:
            rpn_layers (list): References to the RPN layers: [RPN_1x1_obj, RPN_1x1_bbox]
            target_buffers (tuple): Target buffers for training fast-rcnn: (class, bbox regression)
            num_rois (int, optional): Number of ROIs to sample from proposed (default: 128)
            pre_nms_N (int, optional): Number of ROIs to retain before using NMS (default: 12000)
            post_nms_N (int, optional): Number of ROIs to retain after using NMS (default: 2000)
            nms_thresh (float, optional): Threshold for non-maximum supression (default: 0.7)
            min_bbox_size (integer, optional): Minimize bboxes side length (default: 16)
            name (string, optional): Name of layer (default: None)
Arguments : rpn_layers ( list ) : References to the RPN layers : [ RPN_1x1_obj RPN_1x1_bbox ] target_buffers ( tuple ) : Target buffers for training fast - rcnn : ( class bbox regression ) num_rois ( int optional ) : Number of ROIs to sample from proposed ( default : 128 ) pre_nms_N ( int optional ) : Number of ROIs to retain before using NMS ( default : 12000 ) post_nms_N ( int optional ) : Number of ROIs to retain after using NMS ( default : 2000 ) nms_thresh ( float optional ) : Threshold for non - maximum supression ( default : 0 . 7 ) min_bbox_size ( integer optional ) : Minimize bboxes side length ( default : 16 ) name ( string optional ) : Name of layer ( default : None )
def __init__(self, rpn_layers, dataloader, inference=False, num_rois=128, pre_nms_N=12000,
                 post_nms_N=2000, nms_thresh=0.7, min_bbox_size=16,
                 fg_fraction=None, fg_thresh=None, bg_thresh_hi=None, bg_thresh_lo=None,
                 deterministic=False, name=None, debug=False):
        """
        Arguments:
            rpn_layers (list): References to the RPN layers: [RPN_1x1_obj, RPN_1x1_bbox]
            target_buffers (tuple): Target buffers for training fast-rcnn: (class, bbox regression)
            num_rois (int, optional): Number of ROIs to sample from proposed (default: 128)
            pre_nms_N (int, optional): Number of ROIs to retain before using NMS (default: 12000)
            post_nms_N (int, optional): Number of ROIs to retain after using NMS (default: 2000)
            nms_thresh (float, optional): Threshold for non-maximum supression (default: 0.7)
            min_bbox_size (integer, optional): Minimize bboxes side length (default: 16)
            name (string, optional): Name of layer (default: None)
        """
        super(ProposalLayer, self).__init__(name)

        self.rpn_obj, self.rpn_bbox = rpn_layers
        self.num_rois = num_rois
        self.pre_nms_N = pre_nms_N
        self.post_nms_N = post_nms_N
        self.nms_thresh = nms_thresh
        self.min_bbox_size = min_bbox_size
        self.num_classes = dataloader.num_classes
        self.fg_fraction = fg_fraction if fg_fraction else FG_FRACTION
        self.fg_thresh = fg_thresh if fg_thresh else FG_THRESH
        self.bg_thresh_hi = bg_thresh_hi if bg_thresh_hi else BG_THRESH_HI
        self.bg_thresh_lo = bg_thresh_lo if bg_thresh_lo else BG_THRESH_LO
        self.deterministic = deterministic
        self.debug = debug

        # the output shape of this layer depends on whether the network
        # will be used for inference. In inference mode, the output shape is
        # (5, post_nms_N). For training, a smaller set of rois are sampled, yielding
        # an output shape of (5, num_rois)
        self.inference = inference

        # set references to dataset object buffers
        self.dataloader = dataloader
        self._conv_height = dataloader.conv_height
        self._conv_width = dataloader.conv_width
        self._scale = dataloader.conv_scale

        # generate anchors and load onto device
        # self._anchors has shape (KHW, 4)
        self._anchors = generate_all_anchors(self._conv_height, self._conv_width, self._scale)
        self._dev_anchors = self.be.array(self._anchors)
        self._num_anchors = self._anchors.shape[0]
def __init__ ( self , rpn_layers , dataloader , inference = False , num_rois = 128 , pre_nms_N = 12000 , post_nms_N = 2000 , nms_thresh = 0.7 , min_bbox_size = 16 , fg_fraction = None , fg_thresh = None , bg_thresh_hi = None , bg_thresh_lo = None , deterministic = False , name = None , debug = False ) : super ( ProposalLayer , self ) . __init__ ( name ) self . rpn_obj , self . rpn_bbox = rpn_layers self . num_rois = num_rois self . pre_nms_N = pre_nms_N self . post_nms_N = post_nms_N self . nms_thresh = nms_thresh self . min_bbox_size = min_bbox_size self . num_classes = dataloader . num_classes self . fg_fraction = fg_fraction if fg_fraction else FG_FRACTION self . fg_thresh = fg_thresh if fg_thresh else FG_THRESH self . bg_thresh_hi = bg_thresh_hi if bg_thresh_hi else BG_THRESH_HI self . bg_thresh_lo = bg_thresh_lo if bg_thresh_lo else BG_THRESH_LO self . deterministic = deterministic self . debug = debug # the output shape of this layer depends on whether the network # will be used for inference. In inference mode, the output shape is # (5, post_nms_N). For training, a smaller set of rois are sampled, yielding # an output shape of (5, num_rois) self . inference = inference # set references to dataset object buffers self . dataloader = dataloader self . _conv_height = dataloader . conv_height self . _conv_width = dataloader . conv_width self . _scale = dataloader . conv_scale # generate anchors and load onto device # self._anchors has shape (KHW, 4) self . _anchors = generate_all_anchors ( self . _conv_height , self . _conv_width , self . _scale ) self . _dev_anchors = self . be . array ( self . _anchors ) self . _num_anchors = self . _anchors . shape [ 0 ]