@@ -97,7 +97,9 @@ class number, M is number of bounding boxes. For each category
97
97
nms_eta(float): The parameter for adaptive NMS.
98
98
99
99
Returns:
100
- Variable: The detection outputs is a LoDTensor with shape [No, 6].
100
+ Variable:
101
+
102
+ The detection outputs is a LoDTensor with shape [No, 6].
101
103
Each row has six values: [label, confidence, xmin, ymin, xmax, ymax].
102
104
`No` is the total number of detections in this mini-batch. For each
103
105
instance, the offsets in first dimension are called LoD, the offset
@@ -110,15 +112,15 @@ class number, M is number of bounding boxes. For each category
110
112
Examples:
111
113
.. code-block:: python
112
114
113
- pb = layers.data(name='prior_box', shape=[10, 4],
115
+ pb = layers.data(name='prior_box', shape=[10, 4],
114
116
append_batch_size=False, dtype='float32')
115
- pbv = layers.data(name='prior_box_var', shape=[10, 4],
117
+ pbv = layers.data(name='prior_box_var', shape=[10, 4],
116
118
append_batch_size=False, dtype='float32')
117
- loc = layers.data(name='target_box', shape=[2, 21, 4],
119
+ loc = layers.data(name='target_box', shape=[2, 21, 4],
118
120
append_batch_size=False, dtype='float32')
119
- scores = layers.data(name='scores', shape=[2, 21, 10],
121
+ scores = layers.data(name='scores', shape=[2, 21, 10],
120
122
append_batch_size=False, dtype='float32')
121
- nmsed_outs = fluid.layers.detection_output(scores=scores,
123
+ nmsed_outs = fluid.layers.detection_output(scores=scores,
122
124
loc=loc,
123
125
prior_box=pb,
124
126
prior_box_var=pbv)
@@ -296,8 +298,6 @@ def target_assign(input,
296
298
mismatch_value = None ,
297
299
name = None ):
298
300
"""
299
- **Target assigner operator**
300
-
301
301
This operator can be, for given the target bounding boxes or labels,
302
302
to assign classification and regression targets to each prediction as well as
303
303
weights to prediction. The weights is used to specify which prediction would
@@ -311,20 +311,24 @@ def target_assign(input,
311
311
312
312
1. Assigning all outpts based on `match_indices`:
313
313
314
- If id = match_indices[i][j] > 0,
314
+ .. code-block:: text
315
+
316
+ If id = match_indices[i][j] > 0,
315
317
316
- out[i][j][0 : K] = X[lod[i] + id][j % P][0 : K]
317
- out_weight[i][j] = 1.
318
+ out[i][j][0 : K] = X[lod[i] + id][j % P][0 : K]
319
+ out_weight[i][j] = 1.
318
320
319
- Otherwise,
321
+ Otherwise,
320
322
321
- out[j][j][0 : K] = {mismatch_value, mismatch_value, ...}
322
- out_weight[i][j] = 0.
323
+ out[j][j][0 : K] = {mismatch_value, mismatch_value, ...}
324
+ out_weight[i][j] = 0.
323
325
324
326
2. Assigning out_weight based on `neg_indices` if `neg_indices` is provided:
325
327
326
328
Assumed that the row offset for each instance in `neg_indices` is called neg_lod,
327
329
for i-th instance and each `id` of neg_indices in this instance:
330
+
331
+ .. code-block:: text
328
332
329
333
out[i][id][0 : K] = {mismatch_value, mismatch_value, ...}
330
334
out_weight[i][id] = 1.0
@@ -341,10 +345,23 @@ def target_assign(input,
341
345
mismatch_value (float32): Fill this value to the mismatched location.
342
346
343
347
Returns:
344
- out (Variable): The output is a 3D Tensor with shape [N, P, K],
345
- N and P is the same as they are in `neg_indices`, K is the
346
- same as it in input of X. If `match_indices[i][j]`.
347
- out_weight (Variable): The weight for output with the shape of [N, P, 1].
348
+ tuple:
349
+
350
+ A tuple(out, out_weight) is returned. out is a 3D Tensor with
351
+ shape [N, P, K], N and P is the same as they are in
352
+ `neg_indices`, K is the same as it in input of X. If
353
+ `match_indices[i][j]`. out_weight is the weight for output with
354
+ the shape of [N, P, 1].
355
+
356
+ Examples:
357
+
358
+ .. code-block:: python
359
+
360
+ matched_indices, matched_dist = fluid.layers.bipartite_match(iou)
361
+ gt = layers.data(
362
+ name='gt', shape=[1, 1], dtype='int32', lod_level=1)
363
+ trg, trg_weight = layers.target_assign(
364
+ gt, matched_indices, mismatch_value=0)
348
365
"""
349
366
helper = LayerHelper ('target_assign' , ** locals ())
350
367
out = helper .create_tmp_variable (dtype = input .dtype )
0 commit comments