提交 c0076084 编写于 作者: G gaoyuan

Format the python file.

上级 96009326
......@@ -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 {
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册