From b8581b74a0291269a3cc762d47506f2adb1351f8 Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Sat, 19 Jun 2021 23:51:44 +0800 Subject: [PATCH] [cherry-pick] fix empty output in voc (#3431) --- 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