Esempio n. 1
0
    def __init__(self, arg1, arg2, arg3, name='AnchorTargetLayer', param_str=None, deterministic=False):
        super(AnchorTargetLayer, self).__init__([arg1, arg2, arg3], name=name)
        self.param_str_ = param_str if param_str is not None else "'feat_stride': 16\n'scales':\n - 8 \n - 16 \n - 32"

        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self.param_str_)
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self._feat_stride = layer_params['feat_stride']
        self._determininistic_mode = deterministic

        if DEBUG:
            print ('anchors:')
            print (self._anchors)
            print ('anchor shapes:')
            print (np.hstack((
                self._anchors[:, 2::4] - self._anchors[:, 0::4],
                self._anchors[:, 3::4] - self._anchors[:, 1::4],
            )))
            self._counts = cfg.EPS
            self._sums = np.zeros((1, 4))
            self._squared_sums = np.zeros((1, 4))
            self._fg_sum = 0
            self._bg_sum = 0
            self._count = 0

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = False # layer_params.get('allowed_border', 0)
    def setup(self, bottom, top):
        layer_params = yaml.load(self.param_str_)
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self._feat_stride = layer_params['feat_stride']

        if DEBUG:
            print('anchors:')
            print(self._anchors)
            print('anchor shapes:')
            print(np.hstack((
                self._anchors[:, 2::4] - self._anchors[:, 0::4],
                self._anchors[:, 3::4] - self._anchors[:, 1::4],
            )))
            self._counts = cfg.EPS
            self._sums = np.zeros((1, 4))
            self._squared_sums = np.zeros((1, 4))
            self._fg_sum = 0
            self._bg_sum = 0
            self._count = 0

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = layer_params.get('allowed_border', 0)

        height, width = bottom[0].data.shape[-2:]
        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)
Esempio n. 3
0
    def setup(self, bottom, top):
        layer_params = yaml.load(self.param_str_)
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self._feat_stride = layer_params['feat_stride']

        if DEBUG:
            print('anchors:')
            print(self._anchors)
            print('anchor shapes:')
            print(np.hstack((
                self._anchors[:, 2::4] - self._anchors[:, 0::4],
                self._anchors[:, 3::4] - self._anchors[:, 1::4],
            )))
            self._counts = cfg.EPS
            self._sums = np.zeros((1, 4))
            self._squared_sums = np.zeros((1, 4))
            self._fg_sum = 0
            self._bg_sum = 0
            self._count = 0

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = layer_params.get('allowed_border', 0)

        height, width = bottom[0].data.shape[-2:]
        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)
Esempio n. 4
0
    def __init__(self, arg1, arg2, arg3, name='AnchorTargetLayer', param_str=None, cfm_shape=None, deterministic=False):
        super(AnchorTargetLayer, self).__init__([arg1, arg2, arg3], name=name)
        self.param_str_ = param_str if param_str is not None else "'feat_stride': 16\n'scales':\n - 8 \n - 16 \n - 32"

        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self.param_str_)
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self._feat_stride = layer_params['feat_stride']
        self._cfm_shape = cfm_shape
        self._determininistic_mode = deterministic

        if DEBUG:
            print ('anchors:')
            print (self._anchors)
            print ('anchor shapes:')
            print (np.hstack((
                self._anchors[:, 2::4] - self._anchors[:, 0::4],
                self._anchors[:, 3::4] - self._anchors[:, 1::4],
            )))
            self._counts = cfg.EPS
            self._sums = np.zeros((1, 4))
            self._squared_sums = np.zeros((1, 4))
            self._fg_sum = 0
            self._bg_sum = 0
            self._count = 0

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = False # layer_params.get('allowed_border', 0)
    def setup(self, bottom, top):
        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self.param_str_)

        self._feat_stride = layer_params['feat_stride']
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self.phase = "TEST"
Esempio n. 6
0
    def setup(self, bottom, top):
        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self.param_str_)

        self._feat_stride = layer_params['feat_stride']
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self.phase = "TRAIN"
Esempio n. 7
0
    def __init__(self, arg1, arg2, arg3, layer_config, name='ProposalLayer'):
        super(ProposalLayer, self).__init__([arg1, arg2, arg3], attributes=layer_config, name=name)

        self._layer_config = layer_config
        self._feat_stride = 16 if 'feat_stride' not in layer_config else layer_config['feat_stride']
        anchor_scales = [8, 16, 32] if 'scales' not in layer_config else layer_config['scales']

        # parse the layer parameter string, which must be valid YAML
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]

        if DEBUG:
            print ('feat_stride: {}'.format(self._feat_stride))
            print ('anchors:')
            print (self._anchors)
Esempio n. 8
0
    def __init__(self, arg1, arg2, arg3, name='ProposalLayer', param_str=None):
        super(ProposalLayer, self).__init__([arg1, arg2, arg3], name=name)
        self.param_str_ = param_str if param_str is not None else "'feat_stride': 16\n'scales':\n - 8 \n - 16 \n - 32"

        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self.param_str_)
        self._feat_stride = layer_params['feat_stride']
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]

        if DEBUG:
            print ('feat_stride: {}'.format(self._feat_stride))
            print ('anchors:')
            print (self._anchors)
    def __init__(self, arg1, arg2, arg3, name='ProposalLayer', param_str=None):
        super(ProposalLayer, self).__init__([arg1, arg2, arg3], name=name)
        self.param_str_ = param_str if param_str is not None else "'feat_stride': 16\n'scales':\n - 8 \n - 16 \n - 32"

        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self.param_str_)
        self._feat_stride = layer_params['feat_stride']
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]

        if DEBUG:
            print('feat_stride: {}'.format(self._feat_stride))
            print('anchors:')
            print(self._anchors)
Esempio n. 10
0
    def __init__(self, arg1, arg2, arg3, layer_config, name='ProposalLayer'):
        super(ProposalLayer, self).__init__([arg1, arg2, arg3], layer_config, name=name)

        self._layer_config = layer_config
        self._feat_stride = 16 if 'feat_stride' not in layer_config else layer_config['feat_stride']
        anchor_scales = [8, 16, 32] if 'scales' not in layer_config else layer_config['scales']

        # parse the layer parameter string, which must be valid YAML
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]

        if DEBUG:
            print ('feat_stride: {}'.format(self._feat_stride))
            print ('anchors:')
            print (self._anchors)
Esempio n. 11
0
    def __init__(self,
                 arg1,
                 arg2,
                 arg3,
                 rpn_batch_size=256,
                 rpn_fg_fraction=0.5,
                 clobber_positives=False,
                 positive_overlap=0.7,
                 negative_overlap=0.3,
                 param_str=None,
                 name='AnchorTargetLayer',
                 cfm_shape=None,
                 deterministic=False):
        super(AnchorTargetLayer, self).__init__([arg1, arg2, arg3], name=name)
        self._rpn_batch_size = rpn_batch_size
        self._rpn_fg_fraction = rpn_fg_fraction
        self._clobber_positives = clobber_positives
        self._positive_overlap = positive_overlap
        self._negative_overlap = negative_overlap
        self._param_str = param_str if param_str is not None else "'feat_stride': 16\n'scales':\n - 8 \n - 16 \n - 32"

        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self._param_str)
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self._feat_stride = layer_params['feat_stride']
        self._cfm_shape = cfm_shape
        self._determininistic_mode = deterministic

        if DEBUG:
            print('anchors:')
            print(self._anchors)
            print('anchor shapes:')
            print(
                np.hstack((
                    self._anchors[:, 2::4] - self._anchors[:, 0::4],
                    self._anchors[:, 3::4] - self._anchors[:, 1::4],
                )))
            self._counts = 1e-14  # avoid division by zero
            self._sums = np.zeros((1, 4))
            self._squared_sums = np.zeros((1, 4))
            self._fg_sum = 0
            self._bg_sum = 0
            self._count = 0

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = False  # layer_params.get('allowed_border', 0)
Esempio n. 12
0
    def __init__(self, arg1, arg2, arg3,
                 rpn_batch_size=256,
                 rpn_fg_fraction=0.5,
                 clobber_positives=False,
                 positive_overlap=0.7,
                 negative_overlap=0.3,
                 param_str=None,
                 name='AnchorTargetLayer', cfm_shape=None, deterministic=False):
        super(AnchorTargetLayer, self).__init__([arg1, arg2, arg3], name=name)
        self._rpn_batch_size = rpn_batch_size
        self._rpn_fg_fraction = rpn_fg_fraction
        self._clobber_positives = clobber_positives
        self._positive_overlap = positive_overlap
        self._negative_overlap = negative_overlap
        self._param_str = param_str if param_str is not None else "'feat_stride': 16\n'scales':\n - 8 \n - 16 \n - 32"

        # parse the layer parameter string, which must be valid YAML
        layer_params = yaml.load(self._param_str)
        anchor_scales = layer_params.get('scales', (8, 16, 32))
        self._anchors = generate_anchors(scales=np.array(anchor_scales))
        self._num_anchors = self._anchors.shape[0]
        self._feat_stride = layer_params['feat_stride']
        self._cfm_shape = cfm_shape
        self._determininistic_mode = deterministic

        if DEBUG:
            print ('anchors:')
            print (self._anchors)
            print ('anchor shapes:')
            print (np.hstack((
                self._anchors[:, 2::4] - self._anchors[:, 0::4],
                self._anchors[:, 3::4] - self._anchors[:, 1::4],
            )))
            self._counts = 1e-14 # avoid division by zero
            self._sums = np.zeros((1, 4))
            self._squared_sums = np.zeros((1, 4))
            self._fg_sum = 0
            self._bg_sum = 0
            self._count = 0

        # allow boxes to sit over the edge by a small amount
        self._allowed_border = False # layer_params.get('allowed_border', 0)