Merge pull request #817 from Intsigstephon/develop_reg

fix eval bug
pull/818/head^2
Bin Lu 2021-06-10 10:51:28 +08:00 committed by GitHub
commit cc003dbacf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -138,4 +138,4 @@ Metric:
topk: [1, 5]
Eval:
- Recallk:
topk: 1
topk: [1]

View File

@ -69,7 +69,7 @@ class mINP(nn.Layer):
class Recallk(nn.Layer):
def __init__(self, topk=(1, 5)):
super().__init__()
assert isinstance(topk, (int, list))
assert isinstance(topk, (int, list, tuple))
if isinstance(topk, int):
topk = [topk]
self.topk = topk
@ -97,6 +97,9 @@ class RetriMetric(nn.Layer):
gallery_img_id, self.max_rank)
if "Recallk" in self.config.keys():
topk = self.config['Recallk']['topk']
assert isinstance(topk, (int, list, tuple))
if isinstance(topk, int):
topk = [topk]
for k in topk:
metric_dict["recall{}".format(k)] = all_cmc[k - 1]
if "mAP" in self.config.keys():