|
|
@ -603,7 +603,7 @@ def prior_box(input,
|
|
|
|
offset=0.5,
|
|
|
|
offset=0.5,
|
|
|
|
name=None):
|
|
|
|
name=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
**Prior box operator**
|
|
|
|
**Prior Box Operator**
|
|
|
|
|
|
|
|
|
|
|
|
Generate prior boxes for SSD(Single Shot MultiBox Detector) algorithm.
|
|
|
|
Generate prior boxes for SSD(Single Shot MultiBox Detector) algorithm.
|
|
|
|
Each position of the input produce N prior boxes, N is determined by
|
|
|
|
Each position of the input produce N prior boxes, N is determined by
|
|
|
@ -632,26 +632,30 @@ def prior_box(input,
|
|
|
|
name(str): Name of the prior box op. Default: None.
|
|
|
|
name(str): Name of the prior box op. Default: None.
|
|
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Returns:
|
|
|
|
boxes(Variable): the output prior boxes of PriorBox.
|
|
|
|
tuple: A tuple with two Variable (boxes, variances)
|
|
|
|
The layout is [H, W, num_priors, 4].
|
|
|
|
|
|
|
|
H is the height of input, W is the width of input,
|
|
|
|
boxes: the output prior boxes of PriorBox.
|
|
|
|
num_priors is the total
|
|
|
|
The layout is [H, W, num_priors, 4].
|
|
|
|
box count of each position of input.
|
|
|
|
H is the height of input, W is the width of input,
|
|
|
|
Variances(Variable): the expanded variances of PriorBox.
|
|
|
|
num_priors is the total
|
|
|
|
The layout is [H, W, num_priors, 4].
|
|
|
|
box count of each position of input.
|
|
|
|
H is the height of input, W is the width of input
|
|
|
|
|
|
|
|
num_priors is the total
|
|
|
|
variances: the expanded variances of PriorBox.
|
|
|
|
box count of each position of input
|
|
|
|
The layout is [H, W, num_priors, 4].
|
|
|
|
|
|
|
|
H is the height of input, W is the width of input
|
|
|
|
|
|
|
|
num_priors is the total
|
|
|
|
|
|
|
|
box count of each position of input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
Examples:
|
|
|
|
.. code-block:: python
|
|
|
|
.. code-block:: python
|
|
|
|
box, var = prior_box(
|
|
|
|
|
|
|
|
input=conv1,
|
|
|
|
box, var = fluid.layers.prior_box(
|
|
|
|
image=images,
|
|
|
|
input=conv1,
|
|
|
|
min_sizes=[100.],
|
|
|
|
image=images,
|
|
|
|
flip=True,
|
|
|
|
min_sizes=[100.],
|
|
|
|
clip=True)
|
|
|
|
flip=True,
|
|
|
|
|
|
|
|
clip=True)
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
helper = LayerHelper("prior_box", **locals())
|
|
|
|
helper = LayerHelper("prior_box", **locals())
|
|
|
|
dtype = helper.input_dtype()
|
|
|
|
dtype = helper.input_dtype()
|
|
|
@ -721,11 +725,9 @@ def multi_box_head(inputs,
|
|
|
|
stride=1,
|
|
|
|
stride=1,
|
|
|
|
name=None):
|
|
|
|
name=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
**Prior_boxes**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Generate prior boxes for SSD(Single Shot MultiBox Detector)
|
|
|
|
Generate prior boxes for SSD(Single Shot MultiBox Detector)
|
|
|
|
algorithm. The details of this algorithm, please refer the
|
|
|
|
algorithm. The details of this algorithm, please refer the
|
|
|
|
section 2.2 of SSD paper (SSD: Single Shot MultiBox Detector)
|
|
|
|
section 2.2 of SSD paper `SSD: Single Shot MultiBox Detector
|
|
|
|
<https://arxiv.org/abs/1512.02325>`_ .
|
|
|
|
<https://arxiv.org/abs/1512.02325>`_ .
|
|
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Args:
|
|
|
@ -766,24 +768,27 @@ def multi_box_head(inputs,
|
|
|
|
name(str): Name of the prior box layer. Default: None.
|
|
|
|
name(str): Name of the prior box layer. Default: None.
|
|
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Returns:
|
|
|
|
mbox_loc(Variable): The predicted boxes' location of the inputs.
|
|
|
|
tuple: A tuple with four Variables. (mbox_loc, mbox_conf, boxes, variances)
|
|
|
|
The layout is [N, H*W*Priors, 4]. where Priors
|
|
|
|
|
|
|
|
is the number of predicted boxes each position of each input.
|
|
|
|
mbox_loc: The predicted boxes' location of the inputs. The layout
|
|
|
|
mbox_conf(Variable): The predicted boxes' confidence of the inputs.
|
|
|
|
is [N, H*W*Priors, 4]. where Priors is the number of predicted
|
|
|
|
The layout is [N, H*W*Priors, C]. where Priors
|
|
|
|
boxes each position of each input.
|
|
|
|
is the number of predicted boxes each position of each input
|
|
|
|
|
|
|
|
and C is the number of Classes.
|
|
|
|
mbox_conf: The predicted boxes' confidence of the inputs. The layout
|
|
|
|
boxes(Variable): the output prior boxes of PriorBox.
|
|
|
|
is [N, H*W*Priors, C]. where Priors is the number of predicted boxes
|
|
|
|
The layout is [num_priors, 4]. num_priors is the total
|
|
|
|
each position of each input and C is the number of Classes.
|
|
|
|
box count of each position of inputs.
|
|
|
|
|
|
|
|
Variances(Variable): the expanded variances of PriorBox.
|
|
|
|
boxes: the output prior boxes of PriorBox. The layout is [num_priors, 4].
|
|
|
|
The layout is [num_priors, 4]. num_priors is the total
|
|
|
|
num_priors is the total box count of each position of inputs.
|
|
|
|
box count of each position of inputs
|
|
|
|
|
|
|
|
|
|
|
|
variances: the expanded variances of PriorBox. The layout is
|
|
|
|
|
|
|
|
[num_priors, 4]. num_priors is the total box count of each position of inputs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
Examples:
|
|
|
|
.. code-block:: python
|
|
|
|
.. code-block:: python
|
|
|
|
mbox_locs, mbox_confs, box, var = layers.multi_box_head(
|
|
|
|
|
|
|
|
|
|
|
|
mbox_locs, mbox_confs, box, var = fluid.layers.multi_box_head(
|
|
|
|
inputs=[conv1, conv2, conv3, conv4, conv5, conv5],
|
|
|
|
inputs=[conv1, conv2, conv3, conv4, conv5, conv5],
|
|
|
|
image=images,
|
|
|
|
image=images,
|
|
|
|
num_classes=21,
|
|
|
|
num_classes=21,
|
|
|
|