|
|
@ -403,25 +403,6 @@ def ssd_loss(location,
|
|
|
|
|
|
|
|
|
|
|
|
5.3 Compute the overall weighted loss.
|
|
|
|
5.3 Compute the overall weighted loss.
|
|
|
|
|
|
|
|
|
|
|
|
>>> import paddle.fluid.layers as layers
|
|
|
|
|
|
|
|
>>> pb = layers.data(
|
|
|
|
|
|
|
|
>>> name='prior_box',
|
|
|
|
|
|
|
|
>>> shape=[10, 4],
|
|
|
|
|
|
|
|
>>> append_batch_size=False,
|
|
|
|
|
|
|
|
>>> dtype='float32')
|
|
|
|
|
|
|
|
>>> pbv = layers.data(
|
|
|
|
|
|
|
|
>>> name='prior_box_var',
|
|
|
|
|
|
|
|
>>> shape=[10, 4],
|
|
|
|
|
|
|
|
>>> append_batch_size=False,
|
|
|
|
|
|
|
|
>>> dtype='float32')
|
|
|
|
|
|
|
|
>>> loc = layers.data(name='target_box', shape=[10, 4], dtype='float32')
|
|
|
|
|
|
|
|
>>> scores = layers.data(name='scores', shape=[10, 21], dtype='float32')
|
|
|
|
|
|
|
|
>>> gt_box = layers.data(
|
|
|
|
|
|
|
|
>>> name='gt_box', shape=[4], lod_level=1, dtype='float32')
|
|
|
|
|
|
|
|
>>> gt_label = layers.data(
|
|
|
|
|
|
|
|
>>> name='gt_label', shape=[1], lod_level=1, dtype='float32')
|
|
|
|
|
|
|
|
>>> loss = layers.ssd_loss(loc, scores, gt_box, gt_label, pb, pbv)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Args:
|
|
|
|
location (Variable): The location predictions are a 3D Tensor with
|
|
|
|
location (Variable): The location predictions are a 3D Tensor with
|
|
|
|
shape [N, Np, 4], N is the batch size, Np is total number of
|
|
|
|
shape [N, Np, 4], N is the batch size, Np is total number of
|
|
|
@ -465,6 +446,25 @@ def ssd_loss(location,
|
|
|
|
Raises:
|
|
|
|
Raises:
|
|
|
|
ValueError: If mining_type is 'hard_example', now only support mining \
|
|
|
|
ValueError: If mining_type is 'hard_example', now only support mining \
|
|
|
|
type of `max_negative`.
|
|
|
|
type of `max_negative`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
>>> pb = fluid.layers.data(
|
|
|
|
|
|
|
|
>>> name='prior_box',
|
|
|
|
|
|
|
|
>>> shape=[10, 4],
|
|
|
|
|
|
|
|
>>> append_batch_size=False,
|
|
|
|
|
|
|
|
>>> dtype='float32')
|
|
|
|
|
|
|
|
>>> pbv = fluid.layers.data(
|
|
|
|
|
|
|
|
>>> name='prior_box_var',
|
|
|
|
|
|
|
|
>>> shape=[10, 4],
|
|
|
|
|
|
|
|
>>> append_batch_size=False,
|
|
|
|
|
|
|
|
>>> dtype='float32')
|
|
|
|
|
|
|
|
>>> loc = fluid.layers.data(name='target_box', shape=[10, 4], dtype='float32')
|
|
|
|
|
|
|
|
>>> scores = fluid.layers.data(name='scores', shape=[10, 21], dtype='float32')
|
|
|
|
|
|
|
|
>>> gt_box = fluid.layers.data(
|
|
|
|
|
|
|
|
>>> name='gt_box', shape=[4], lod_level=1, dtype='float32')
|
|
|
|
|
|
|
|
>>> gt_label = fluid.layers.data(
|
|
|
|
|
|
|
|
>>> name='gt_label', shape=[1], lod_level=1, dtype='float32')
|
|
|
|
|
|
|
|
>>> loss = fluid.layers.ssd_loss(loc, scores, gt_box, gt_label, pb, pbv)
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
helper = LayerHelper('ssd_loss', **locals())
|
|
|
|
helper = LayerHelper('ssd_loss', **locals())
|
|
|
|