From bda64b5d7244be5d986b6848b7c116418a8f9c9c Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Sun, 7 Feb 2021 16:12:31 +0800 Subject: [PATCH] fix bs and voc_metrics, test=dygraph (#2195) --- dygraph/ppdet/metrics/metrics.py | 6 +++--- dygraph/ppdet/modeling/proposal_generator/rpn_head.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dygraph/ppdet/metrics/metrics.py b/dygraph/ppdet/metrics/metrics.py index 304495f65..f4eecfb2d 100644 --- a/dygraph/ppdet/metrics/metrics.py +++ b/dygraph/ppdet/metrics/metrics.py @@ -149,9 +149,9 @@ class VOCMetric(Metric): self.detection_map.reset() def update(self, inputs, outputs): - bboxes = outputs['bbox'].numpy() - scores = outputs['score'].numpy() - labels = outputs['label'].numpy() + bboxes = outputs['bbox'][:, 2:].numpy() + scores = outputs['bbox'][:, 1].numpy() + labels = outputs['bbox'][:, 0].numpy() bbox_lengths = outputs['bbox_num'].numpy() if bboxes.shape == (1, 1) or bboxes is None: diff --git a/dygraph/ppdet/modeling/proposal_generator/rpn_head.py b/dygraph/ppdet/modeling/proposal_generator/rpn_head.py index be399be9e..5658e9947 100644 --- a/dygraph/ppdet/modeling/proposal_generator/rpn_head.py +++ b/dygraph/ppdet/modeling/proposal_generator/rpn_head.py @@ -110,7 +110,7 @@ class RPNHead(nn.Layer): # TODO: Fix batch_size > 1 when testing. if self.training: - batch_size = im_shape.shape[0] + batch_size = inputs['im_shape'].shape[0] else: batch_size = 1 -- GitLab