From 46a0de628c0a381a1a0b65ccea720e55173ac3e8 Mon Sep 17 00:00:00 2001 From: Kai Chen <chenkaidev@gmail.com> Date: Tue, 25 Dec 2018 14:20:40 +0800 Subject: [PATCH] minor bug fix --- mmdet/core/loss/losses.py | 2 ++ tools/test.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mmdet/core/loss/losses.py b/mmdet/core/loss/losses.py index 1e32fca..b208200 100644 --- a/mmdet/core/loss/losses.py +++ b/mmdet/core/loss/losses.py @@ -92,6 +92,8 @@ def accuracy(pred, target, topk=1): if isinstance(topk, int): topk = (topk, ) return_single = True + else: + return_single = False maxk = max(topk) _, pred_label = pred.topk(maxk, 1, True, True) diff --git a/tools/test.py b/tools/test.py index d0537b3..8aa23ea 100644 --- a/tools/test.py +++ b/tools/test.py @@ -23,7 +23,7 @@ def single_test(model, data_loader, show=False): if show: model.module.show_result(data, result, dataset.img_norm_cfg, - dataset.CLASSES) + dataset=dataset.CLASSES) batch_size = data['img'][0].size(0) for _ in range(batch_size): -- GitLab