From 5ee9a605443a1153e282916272373ff8a5d5579e Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Wed, 2 Jun 2021 22:00:42 +0800 Subject: [PATCH] fix empty output in voc (#3255) --- ppdet/metrics/metrics.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ppdet/metrics/metrics.py b/ppdet/metrics/metrics.py index 766b43ec3..e652fe7a7 100644 --- a/ppdet/metrics/metrics.py +++ b/ppdet/metrics/metrics.py @@ -235,9 +235,10 @@ class VOCMetric(Metric): self.detection_map.reset() def update(self, inputs, outputs): - bboxes = outputs['bbox'][:, 2:].numpy() - scores = outputs['bbox'][:, 1].numpy() - labels = outputs['bbox'][:, 0].numpy() + bbox_np = outputs['bbox'].numpy() + bboxes = bbox_np[:, 2:] + scores = bbox_np[:, 1] + labels = bbox_np[:, 0] bbox_lengths = outputs['bbox_num'].numpy() if bboxes.shape == (1, 1) or bboxes is None: -- GitLab