未验证 提交 e81756f1 编写于 作者: Q qingqing01 提交者: GitHub

Hidden paddle.fluid.layers.detection_map. (#18033)

* Remove layers.detection_map API
* Since uers can use fluid.metrics.DetectionMAP to calculate mAP of current-batch and cumulative-batch. layers.detection_map only can calculate cur-batch mAP.
上级 660c1a65
......@@ -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'))
......
......@@ -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,
......
......@@ -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())
......
......@@ -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,
......
......@@ -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))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册