diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index 0956d98fec4a27d8c7c39a80690d19da1f10de14..9b9c6c664158253e4800944a487879b93aaee9a2 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -347,7 +347,6 @@ paddle.fluid.layers.bipartite_match (ArgSpec(args=['dist_matrix', 'match_type', paddle.fluid.layers.target_assign (ArgSpec(args=['input', 'matched_indices', 'negative_indices', 'mismatch_value', 'name'], varargs=None, keywords=None, defaults=(None, None, None)), ('document', 'e9685f32d21bec8c013626c0254502c5')) paddle.fluid.layers.detection_output (ArgSpec(args=['loc', 'scores', 'prior_box', 'prior_box_var', 'background_label', 'nms_threshold', 'nms_top_k', 'keep_top_k', 'score_threshold', 'nms_eta'], varargs=None, keywords=None, defaults=(0, 0.3, 400, 200, 0.01, 1.0)), ('document', 'efae414c1137c7944d6174dd08c5347a')) paddle.fluid.layers.ssd_loss (ArgSpec(args=['location', 'confidence', 'gt_box', 'gt_label', 'prior_box', 'prior_box_var', 'background_label', 'overlap_threshold', 'neg_pos_ratio', 'neg_overlap', 'loc_loss_weight', 'conf_loss_weight', 'match_type', 'mining_type', 'normalize', 'sample_size'], varargs=None, keywords=None, defaults=(None, 0, 0.5, 3.0, 0.5, 1.0, 1.0, 'per_prediction', 'max_negative', True, None)), ('document', '6d5028fd09d01ab82d296adc0ea95aee')) -paddle.fluid.layers.detection_map (ArgSpec(args=['detect_res', 'label', 'class_num', 'background_label', 'overlap_threshold', 'evaluate_difficult', 'has_state', 'input_states', 'out_states', 'ap_version'], varargs=None, keywords=None, defaults=(0, 0.3, True, None, None, None, 'integral')), ('document', '1467d91b50c22cd52103b4aa1ee9d0a1')) paddle.fluid.layers.rpn_target_assign (ArgSpec(args=['bbox_pred', 'cls_logits', 'anchor_box', 'anchor_var', 'gt_boxes', 'is_crowd', 'im_info', 'rpn_batch_size_per_im', 'rpn_straddle_thresh', 'rpn_fg_fraction', 'rpn_positive_overlap', 'rpn_negative_overlap', 'use_random'], varargs=None, keywords=None, defaults=(256, 0.0, 0.5, 0.7, 0.3, True)), ('document', '1e164a56fe9376e18a56d22563d9f801')) paddle.fluid.layers.anchor_generator (ArgSpec(args=['input', 'anchor_sizes', 'aspect_ratios', 'variance', 'stride', 'offset', 'name'], varargs=None, keywords=None, defaults=(None, None, [0.1, 0.1, 0.2, 0.2], None, 0.5, None)), ('document', '82b2aefeeb1b706bc4afec70928a259a')) paddle.fluid.layers.roi_perspective_transform (ArgSpec(args=['input', 'rois', 'transformed_height', 'transformed_width', 'spatial_scale'], varargs=None, keywords=None, defaults=(1.0,)), ('document', 'd1ddc75629fedee46f82e631e22c79dc')) diff --git a/python/paddle/fluid/evaluator.py b/python/paddle/fluid/evaluator.py index c84dd4bc4751df6cb922e13593d8a07e71a9b9d5..bde828a66910b6b7d1ba8580ba8973cd04896f6e 100644 --- a/python/paddle/fluid/evaluator.py +++ b/python/paddle/fluid/evaluator.py @@ -22,6 +22,7 @@ from .framework import Program, Variable, program_guard from . import unique_name from .layer_helper import LayerHelper from .initializer import Constant +from .layers import detection __all__ = [ 'ChunkEvaluator', @@ -374,7 +375,7 @@ class DetectionMAP(Evaluator): label = layers.concat([gt_label, gt_box], axis=1) # calculate mean average precision (mAP) of current mini-batch - map = layers.detection_map( + map = detection.detection_map( input, label, class_num, @@ -396,7 +397,7 @@ class DetectionMAP(Evaluator): self.has_state = var # calculate accumulative mAP - accum_map = layers.detection_map( + accum_map = detection.detection_map( input, label, class_num, diff --git a/python/paddle/fluid/layers/detection.py b/python/paddle/fluid/layers/detection.py index 4d187120227a5acb4729c0d82311606b4fe97650..6ec46c5c90df24d12d6fbdeef2c2a8b522ba0411 100644 --- a/python/paddle/fluid/layers/detection.py +++ b/python/paddle/fluid/layers/detection.py @@ -38,7 +38,6 @@ __all__ = [ 'target_assign', 'detection_output', 'ssd_loss', - 'detection_map', 'rpn_target_assign', 'anchor_generator', 'roi_perspective_transform', @@ -773,6 +772,7 @@ def detection_map(detect_res, Examples: .. code-block:: python + from fluid.layers import detection detect_res = fluid.layers.data( name='detect_res', shape=[10, 6], @@ -784,7 +784,7 @@ def detection_map(detect_res, append_batch_size=False, dtype='float32') - map_out = fluid.layers.detection_map(detect_res, label, 21) + map_out = detection.detection_map(detect_res, label, 21) """ helper = LayerHelper("detection_map", **locals()) diff --git a/python/paddle/fluid/metrics.py b/python/paddle/fluid/metrics.py index 004763203a452c6158d729eadff4ce1dd8eda17c..946c6ff6565745c8c686659f70d191f9757f4ee7 100644 --- a/python/paddle/fluid/metrics.py +++ b/python/paddle/fluid/metrics.py @@ -27,6 +27,7 @@ from .initializer import Constant from . import unique_name from .framework import Program, Variable, program_guard from . import layers +from .layers import detection __all__ = [ 'MetricBase', @@ -784,7 +785,7 @@ class DetectionMAP(object): label = layers.concat([gt_label, gt_box], axis=1) # calculate mean average precision (mAP) of current mini-batch - map = layers.detection_map( + map = detection.detection_map( input, label, class_num, @@ -809,7 +810,7 @@ class DetectionMAP(object): self.has_state = var # calculate accumulative mAP - accum_map = layers.detection_map( + accum_map = detection.detection_map( input, label, class_num, diff --git a/python/paddle/fluid/tests/test_detection.py b/python/paddle/fluid/tests/test_detection.py index 434b69c9680e0b8625f3156b6a0ec338aa211d57..e72a430ff5776dbc35aeba34cd0e0ef998223a87 100644 --- a/python/paddle/fluid/tests/test_detection.py +++ b/python/paddle/fluid/tests/test_detection.py @@ -16,6 +16,7 @@ from __future__ import print_function import paddle.fluid as fluid import paddle.fluid.layers as layers +from paddle.fluid.layers import detection from paddle.fluid.framework import Program, program_guard import unittest @@ -349,7 +350,7 @@ class TestDetectionMAP(unittest.TestCase): append_batch_size=False, dtype='float32') - map_out = layers.detection_map(detect_res, label, 21) + map_out = detection.detection_map(detect_res, label, 21) self.assertIsNotNone(map_out) self.assertEqual(map_out.shape, (1, )) print(str(program))