Skip to content

Commit f5c6dd6

Browse files
authored
test=develop (#24522)
1 parent a9520db commit f5c6dd6

33 files changed

+566
-5
lines changed

python/paddle/fluid/layers/detection.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ def rpn_target_assign(bbox_pred,
454454

455455
def sigmoid_focal_loss(x, label, fg_num, gamma=2.0, alpha=0.25):
456456
"""
457+
:alias_main: paddle.nn.functional.sigmoid_focal_loss
458+
:alias: paddle.nn.functional.sigmoid_focal_loss,paddle.nn.functional.loss.sigmoid_focal_loss
459+
:old_api: paddle.fluid.layers.sigmoid_focal_loss
460+
457461
**Sigmoid Focal Loss Operator.**
458462
459463
`Focal Loss <https://arxiv.org/abs/1708.02002>`_ is used to address the foreground-background
@@ -550,6 +554,10 @@ def detection_output(loc,
550554
nms_eta=1.0,
551555
return_index=False):
552556
"""
557+
:alias_main: paddle.nn.functional.detection_output
558+
:alias: paddle.nn.functional.detection_output,paddle.nn.functional.vision.detection_output
559+
:old_api: paddle.fluid.layers.detection_output
560+
553561
Given the regression locations, classification confidences and prior boxes,
554562
calculate the detection outputs by performing following steps:
555563
@@ -679,6 +687,10 @@ class number, M is number of bounding boxes.
679687
@templatedoc()
680688
def iou_similarity(x, y, box_normalized=True, name=None):
681689
"""
690+
:alias_main: paddle.nn.functional.iou_similarity
691+
:alias: paddle.nn.functional.iou_similarity,paddle.nn.functional.loss.iou_similarity
692+
:old_api: paddle.fluid.layers.iou_similarity
693+
682694
${comment}
683695
684696
Args:
@@ -735,6 +747,10 @@ def box_coder(prior_box,
735747
name=None,
736748
axis=0):
737749
"""
750+
:alias_main: paddle.nn.functional.box_coder
751+
:alias: paddle.nn.functional.box_coder,paddle.nn.functional.vision.box_coder
752+
:old_api: paddle.fluid.layers.box_coder
753+
738754
**Box Coder Layer**
739755
740756
Encode/Decode the target bounding box with the priorbox information.
@@ -922,6 +938,10 @@ def yolov3_loss(x,
922938
name=None,
923939
scale_x_y=1.):
924940
"""
941+
:alias_main: paddle.nn.functional.yolov3_loss
942+
:alias: paddle.nn.functional.yolov3_loss,paddle.nn.functional.vision.yolov3_loss
943+
:old_api: paddle.fluid.layers.yolov3_loss
944+
925945
${comment}
926946
927947
Args:
@@ -1045,6 +1065,10 @@ def yolo_box(x,
10451065
name=None,
10461066
scale_x_y=1.):
10471067
"""
1068+
:alias_main: paddle.nn.functional.yolo_box
1069+
:alias: paddle.nn.functional.yolo_box,paddle.nn.functional.vision.yolo_box
1070+
:old_api: paddle.fluid.layers.yolo_box
1071+
10481072
${comment}
10491073
10501074
Args:
@@ -1220,6 +1244,10 @@ def bipartite_match(dist_matrix,
12201244
dist_threshold=None,
12211245
name=None):
12221246
"""
1247+
:alias_main: paddle.nn.functional.bipartite_match
1248+
:alias: paddle.nn.functional.bipartite_match,paddle.nn.functional.vision.bipartite_match
1249+
:old_api: paddle.fluid.layers.bipartite_match
1250+
12231251
This operator implements a greedy bipartite matching algorithm, which is
12241252
used to obtain the matching with the maximum distance based on the input
12251253
distance matrix. For input 2D matrix, the bipartite matching algorithm can
@@ -1310,6 +1338,10 @@ def target_assign(input,
13101338
mismatch_value=None,
13111339
name=None):
13121340
"""
1341+
:alias_main: paddle.nn.functional.target_assign
1342+
:alias: paddle.nn.functional.target_assign,paddle.nn.functional.extension.target_assign
1343+
:old_api: paddle.fluid.layers.target_assign
1344+
13131345
This operator can be, for given the target bounding boxes or labels,
13141346
to assign classification and regression targets to each prediction as well as
13151347
weights to prediction. The weights is used to specify which prediction would
@@ -1424,6 +1456,10 @@ def ssd_loss(location,
14241456
normalize=True,
14251457
sample_size=None):
14261458
"""
1459+
:alias_main: paddle.nn.functional.ssd_loss
1460+
:alias: paddle.nn.functional.ssd_loss,paddle.nn.functional.loss.ssd_loss
1461+
:old_api: paddle.fluid.layers.ssd_loss
1462+
14271463
**Multi-box loss layer for object detection algorithm of SSD**
14281464
14291465
This layer is to compute detection loss for SSD given the location offset
@@ -1667,6 +1703,10 @@ def prior_box(input,
16671703
name=None,
16681704
min_max_aspect_ratios_order=False):
16691705
"""
1706+
:alias_main: paddle.nn.functional.prior_box
1707+
:alias: paddle.nn.functional.prior_box,paddle.nn.functional.vision.prior_box
1708+
:old_api: paddle.fluid.layers.prior_box
1709+
16701710
This op generates prior boxes for SSD(Single Shot MultiBox Detector) algorithm.
16711711
Each position of the input produce N prior boxes, N is determined by
16721712
the count of min_sizes, max_sizes and aspect_ratios, The size of the
@@ -1824,6 +1864,10 @@ def density_prior_box(input,
18241864
flatten_to_2d=False,
18251865
name=None):
18261866
"""
1867+
:alias_main: paddle.nn.functional.density_prior_box
1868+
:alias: paddle.nn.functional.density_prior_box,paddle.nn.functional.vision.density_prior_box
1869+
:old_api: paddle.fluid.layers.density_prior_box
1870+
18271871
18281872
This op generates density prior boxes for SSD(Single Shot MultiBox Detector)
18291873
algorithm. Each position of the input produce N prior boxes, N is
@@ -2012,6 +2056,8 @@ def multi_box_head(inputs,
20122056
name=None,
20132057
min_max_aspect_ratios_order=False):
20142058
"""
2059+
:api_attr: Static Graph
2060+
20152061
Base on SSD ((Single Shot MultiBox Detector) algorithm, generate prior boxes,
20162062
regression location and classification confidence on multiple input feature
20172063
maps, then output the concatenate results. The details of this algorithm,
@@ -2287,6 +2333,10 @@ def anchor_generator(input,
22872333
offset=0.5,
22882334
name=None):
22892335
"""
2336+
:alias_main: paddle.nn.functional.anchor_generator
2337+
:alias: paddle.nn.functional.anchor_generator,paddle.nn.functional.vision.anchor_generator
2338+
:old_api: paddle.fluid.layers.anchor_generator
2339+
22902340
**Anchor generator operator**
22912341
22922342
Generate anchors for Faster RCNN algorithm.
@@ -2488,6 +2538,10 @@ def generate_proposal_labels(rpn_rois,
24882538
is_cls_agnostic=False,
24892539
is_cascade_rcnn=False):
24902540
"""
2541+
:alias_main: paddle.nn.functional.generate_proposal_labels
2542+
:alias: paddle.nn.functional.generate_proposal_labels,paddle.nn.functional.vision.generate_proposal_labels
2543+
:old_api: paddle.fluid.layers.generate_proposal_labels
2544+
24912545
**Generate Proposal Labels of Faster-RCNN**
24922546
24932547
This operator can be, for given the GenerateProposalOp output bounding boxes and groundtruth,
@@ -2602,6 +2656,10 @@ def generate_proposal_labels(rpn_rois,
26022656
def generate_mask_labels(im_info, gt_classes, is_crowd, gt_segms, rois,
26032657
labels_int32, num_classes, resolution):
26042658
"""
2659+
:alias_main: paddle.nn.functional.generate_mask_labels
2660+
:alias: paddle.nn.functional.generate_mask_labels,paddle.nn.functional.vision.generate_mask_labels
2661+
:old_api: paddle.fluid.layers.generate_mask_labels
2662+
26052663
**Generate Mask Labels for Mask-RCNN**
26062664
26072665
This operator can be, for given the RoIs and corresponding labels,
@@ -2757,6 +2815,10 @@ def generate_proposals(scores,
27572815
name=None,
27582816
return_rois_num=False):
27592817
"""
2818+
:alias_main: paddle.nn.functional.generate_proposals
2819+
:alias: paddle.nn.functional.generate_proposals,paddle.nn.functional.vision.generate_proposals
2820+
:old_api: paddle.fluid.layers.generate_proposals
2821+
27602822
**Generate proposal Faster-RCNN**
27612823
27622824
This operation proposes RoIs according to each box with their
@@ -2867,6 +2929,10 @@ def generate_proposals(scores,
28672929

28682930
def box_clip(input, im_info, name=None):
28692931
"""
2932+
:alias_main: paddle.nn.functional.box_clip
2933+
:alias: paddle.nn.functional.box_clip,paddle.nn.functional.vision.box_clip
2934+
:old_api: paddle.fluid.layers.box_clip
2935+
28702936
Clip the box into the size given by im_info
28712937
For each input box, The formula is given as follows:
28722938
@@ -3092,6 +3158,10 @@ def multiclass_nms(bboxes,
30923158
background_label=0,
30933159
name=None):
30943160
"""
3161+
:alias_main: paddle.nn.functional.multiclass_nms
3162+
:alias: paddle.nn.functional.multiclass_nms,paddle.nn.functional.extension.multiclass_nms
3163+
:old_api: paddle.fluid.layers.multiclass_nms
3164+
30953165
**Multiclass NMS**
30963166
30973167
This operator is to do multi-class non maximum suppression (NMS) on
@@ -3369,6 +3439,10 @@ def distribute_fpn_proposals(fpn_rois,
33693439
refer_scale,
33703440
name=None):
33713441
"""
3442+
:alias_main: paddle.nn.functional.distribute_fpn_proposals
3443+
:alias: paddle.nn.functional.distribute_fpn_proposals,paddle.nn.functional.vision.distribute_fpn_proposals
3444+
:old_api: paddle.fluid.layers.distribute_fpn_proposals
3445+
33723446
**This op only takes LoDTensor as input.** In Feature Pyramid Networks
33733447
(FPN) models, it is needed to distribute all proposals into different FPN
33743448
level, with respect to scale of the proposals, the referring scale and the
@@ -3454,6 +3528,10 @@ def box_decoder_and_assign(prior_box,
34543528
box_clip,
34553529
name=None):
34563530
"""
3531+
:alias_main: paddle.nn.functional.box_decoder_and_assign
3532+
:alias: paddle.nn.functional.box_decoder_and_assign,paddle.nn.functional.vision.box_decoder_and_assign
3533+
:old_api: paddle.fluid.layers.box_decoder_and_assign
3534+
34573535
${comment}
34583536
Args:
34593537
prior_box(${prior_box_type}): ${prior_box_comment}
@@ -3525,6 +3603,10 @@ def collect_fpn_proposals(multi_rois,
35253603
post_nms_top_n,
35263604
name=None):
35273605
"""
3606+
:alias_main: paddle.nn.functional.collect_fpn_proposals
3607+
:alias: paddle.nn.functional.collect_fpn_proposals,paddle.nn.functional.vision.collect_fpn_proposals
3608+
:old_api: paddle.fluid.layers.collect_fpn_proposals
3609+
35283610
**This OP only supports LoDTensor as input**. Concat multi-level RoIs
35293611
(Region of Interest) and select N RoIs with respect to multi_scores.
35303612
This operation performs the following steps:

python/paddle/fluid/layers/io.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,8 @@ def py_reader(capacity,
557557
name=None,
558558
use_double_buffer=True):
559559
"""
560+
:api_attr: Static Graph
561+
560562
Create a Python reader for data feeding in Python
561563
562564
This operator returns a Reader Variable.
@@ -724,6 +726,8 @@ def create_py_reader_by_data(capacity,
724726
name=None,
725727
use_double_buffer=True):
726728
"""
729+
:api_attr: Static Graph
730+
727731
The OP creates a Python reader for data feeding in Python, it is similar
728732
to :ref:`api_fluid_layers_py_reader` except that it can read data from
729733
the list of feed variables.
@@ -861,6 +865,8 @@ def double_buffer(reader, place=None, name=None):
861865

862866
def read_file(reader):
863867
"""
868+
:api_attr: Static Graph
869+
864870
Execute the given reader and get data via it.
865871
866872
A reader is also a Variable. It can be a raw reader generated by

python/paddle/fluid/layers/learning_rate_scheduler.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def _decay_step_counter(begin=0):
5252

5353
def noam_decay(d_model, warmup_steps, learning_rate=1.0):
5454
"""
55+
:alias_main: paddle.nn.functional.noam_decay
56+
:alias: paddle.nn.functional.noam_decay,paddle.nn.functional.learning_rate.noam_decay
57+
:old_api: paddle.fluid.layers.noam_decay
58+
5559
Noam decay method. The numpy implementation of noam decay as follows.
5660
5761
.. code-block:: python
@@ -111,6 +115,10 @@ def noam_decay(d_model, warmup_steps, learning_rate=1.0):
111115

112116
def exponential_decay(learning_rate, decay_steps, decay_rate, staircase=False):
113117
"""
118+
:alias_main: paddle.nn.functional.exponential_decay
119+
:alias: paddle.nn.functional.exponential_decay,paddle.nn.functional.learning_rate.exponential_decay
120+
:old_api: paddle.fluid.layers.exponential_decay
121+
114122
Applies exponential decay to the learning rate.
115123
116124
When training a model, it is often recommended to lower the learning rate as the
@@ -167,7 +175,12 @@ def exponential_decay(learning_rate, decay_steps, decay_rate, staircase=False):
167175

168176

169177
def natural_exp_decay(learning_rate, decay_steps, decay_rate, staircase=False):
170-
"""Applies natural exponential decay to the initial learning rate.
178+
"""
179+
:alias_main: paddle.nn.functional.natural_exp_decay
180+
:alias: paddle.nn.functional.natural_exp_decay,paddle.nn.functional.learning_rate.natural_exp_decay
181+
:old_api: paddle.fluid.layers.natural_exp_decay
182+
183+
Applies natural exponential decay to the initial learning rate.
171184
172185
When training a model, it is often recommended to lower the learning rate as the
173186
training progresses. By using this function, the learning rate will be decayed by
@@ -224,6 +237,10 @@ def natural_exp_decay(learning_rate, decay_steps, decay_rate, staircase=False):
224237

225238
def inverse_time_decay(learning_rate, decay_steps, decay_rate, staircase=False):
226239
"""
240+
:alias_main: paddle.nn.functional.inverse_time_decay
241+
:alias: paddle.nn.functional.inverse_time_decay,paddle.nn.functional.learning_rate.inverse_time_decay
242+
:old_api: paddle.fluid.layers.inverse_time_decay
243+
227244
Applies inverse time decay to the initial learning rate.
228245
229246
When training a model, it is often recommended to lower the learning rate as the
@@ -285,6 +302,10 @@ def polynomial_decay(learning_rate,
285302
power=1.0,
286303
cycle=False):
287304
"""
305+
:alias_main: paddle.nn.functional.polynomial_decay
306+
:alias: paddle.nn.functional.polynomial_decay,paddle.nn.functional.learning_rate.polynomial_decay
307+
:old_api: paddle.fluid.layers.polynomial_decay
308+
2
288309
Applies polynomial decay to the initial learning rate.
289310
290311
.. code-block:: text
@@ -349,7 +370,12 @@ def polynomial_decay(learning_rate,
349370

350371

351372
def piecewise_decay(boundaries, values):
352-
"""Applies piecewise decay to the initial learning rate.
373+
"""
374+
:alias_main: paddle.nn.functional.piecewise_decay
375+
:alias: paddle.nn.functional.piecewise_decay,paddle.nn.functional.learning_rate.piecewise_decay
376+
:old_api: paddle.fluid.layers.piecewise_decay
377+
378+
Applies piecewise decay to the initial learning rate.
353379
354380
The algorithm can be described as the code below.
355381
@@ -424,6 +450,10 @@ def piecewise_decay(boundaries, values):
424450

425451
def cosine_decay(learning_rate, step_each_epoch, epochs):
426452
"""
453+
:alias_main: paddle.nn.functional.cosine_decay
454+
:alias: paddle.nn.functional.cosine_decay,paddle.nn.functional.learning_rate.cosine_decay
455+
:old_api: paddle.fluid.layers.cosine_decay
456+
427457
Applies cosine decay to the learning rate.
428458
429459
when training a model, it is often recommended to lower the learning rate as the
@@ -469,6 +499,10 @@ def cosine_decay(learning_rate, step_each_epoch, epochs):
469499

470500
def linear_lr_warmup(learning_rate, warmup_steps, start_lr, end_lr):
471501
"""
502+
:alias_main: paddle.nn.functional.linear_lr_warmup
503+
:alias: paddle.nn.functional.linear_lr_warmup,paddle.nn.functional.learning_rate.linear_lr_warmup
504+
:old_api: paddle.fluid.layers.linear_lr_warmup
505+
472506
This operator use the linear learning rate warm up strategy to adjust the learning rate preliminarily before the normal learning rate scheduling.
473507
For more information, please refer to `Bag of Tricks for Image Classification with Convolutional Neural Networks <https://arxiv.org/abs/1812.01187>`_
474508

0 commit comments

Comments
 (0)