diff --git a/proto/ModelConfig.proto b/proto/ModelConfig.proto index 460a39275fbe486eae3a0339223e39ea7eb17b21..f28f69641b6e46349badcdf43b234f427536bdc4 100644 --- a/proto/ModelConfig.proto +++ b/proto/ModelConfig.proto @@ -253,8 +253,6 @@ message PriorBoxConfig { repeated uint32 max_size = 2; repeated float aspect_ratio = 3; repeated float variance = 4; - optional bool flip = 5 [default = true]; - optional bool clip = 6 [default = true]; } message LayerInputConfig { diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index 5de524e507bdf96d70f3af3751a275079fd09bcb..8a82e5d667aa38799e9fa74f9a25e2adbd06ee05 100644 --- a/python/paddle/trainer/config_parser.py +++ b/python/paddle/trainer/config_parser.py @@ -1577,9 +1577,11 @@ class PrintLayer(LayerBase): def __init__(self, name, inputs): super(PrintLayer, self).__init__(name, 'print', 0, inputs) + @config_layer('priorbox') class PriorBoxLayer(LayerBase): - def __init__(self, name, inputs, size, min_size, max_size, aspect_ratio, variance): + def __init__(self, name, inputs, size, min_size, max_size, aspect_ratio, + variance): super(PriorBoxLayer, self).__init__(name, 'priorbox', 0, inputs) config_assert(len(inputs) == 2, 'PriorBoxLayer must have 2 input') self.config.inputs[0].priorbox_conf.min_size.extend(min_size) diff --git a/python/paddle/trainer_config_helpers/layers.py b/python/paddle/trainer_config_helpers/layers.py index f04b5646aab03d4f79c097da67a9090322e69a3d..80c421aa2ec3b9356f1ef9c378f117ea25aca9c0 100644 --- a/python/paddle/trainer_config_helpers/layers.py +++ b/python/paddle/trainer_config_helpers/layers.py @@ -935,8 +935,15 @@ def print_layer(input, name=None): inputs=[l.name for l in input], ) # this layer don't return anything, can not be input of other layer. + @wrap_name_default("priorbox") -def priorbox_layer(input, img_shape, aspect_ratio, variance, min_size, max_size=[], name=None): +def priorbox_layer(input, + img_shape, + aspect_ratio, + variance, + min_size, + max_size=[], + name=None): """ Compute the priorbox and set the variance. This layer is necessary for ssd. @@ -957,7 +964,7 @@ def priorbox_layer(input, img_shape, aspect_ratio, variance, min_size, max_size= """ # plus one for ratio 1. num_filters = (len(aspect_ratio) * 2 + 1 + len(max_size)) * 4 - size=(input.size / input.num_filters) * num_filters * 2 + size = (input.size / input.num_filters) * num_filters * 2 Layer( name=name, type=LayerType.PRIORBOX_LAYER, @@ -968,7 +975,12 @@ def priorbox_layer(input, img_shape, aspect_ratio, variance, min_size, max_size= aspect_ratio=aspect_ratio, variance=variance) return LayerOutput( - name, LayerType.PRIORBOX_LAYER, parents=[input, img_shape], num_filters=num_filters, size=size) + name, + LayerType.PRIORBOX_LAYER, + parents=[input, img_shape], + num_filters=num_filters, + size=size) + @wrap_name_default("seq_pooling") @wrap_bias_attr_default(has_bias=False)