From f3f1c98943899eea76c19d9c8e75e2949956393a Mon Sep 17 00:00:00 2001 From: dongshuilong Date: Sat, 5 Jun 2021 18:33:50 +0800 Subject: [PATCH] fix yaml bugs --- ppcls/configs/Vehicle/ResNet50.yaml | 8 ++++---- ppcls/configs/Vehicle/ResNet50_ReID.yaml | 2 +- ppcls/metric/metrics.py | 10 ++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ppcls/configs/Vehicle/ResNet50.yaml b/ppcls/configs/Vehicle/ResNet50.yaml index 23cb462c..e7c4736d 100644 --- a/ppcls/configs/Vehicle/ResNet50.yaml +++ b/ppcls/configs/Vehicle/ResNet50.yaml @@ -148,9 +148,9 @@ Infer: Metric: Train: - - Topk: - k: [1, 5] + - TopkAcc: + topk: [1, 5] Eval: - - Topk: - k: [1, 5] + - TopkAcc: + topk: [1, 5] diff --git a/ppcls/configs/Vehicle/ResNet50_ReID.yaml b/ppcls/configs/Vehicle/ResNet50_ReID.yaml index 39862847..a8d20474 100644 --- a/ppcls/configs/Vehicle/ResNet50_ReID.yaml +++ b/ppcls/configs/Vehicle/ResNet50_ReID.yaml @@ -147,7 +147,7 @@ Metric: Eval: - Recallk: topk: [1, 5] - - mAP: + - mAP: {} Infer: infer_imgs: "docs/images/whl/demo.jpg" diff --git a/ppcls/metric/metrics.py b/ppcls/metric/metrics.py index ac286639..05723c12 100644 --- a/ppcls/metric/metrics.py +++ b/ppcls/metric/metrics.py @@ -39,9 +39,8 @@ class TopkAcc(nn.Layer): class mAP(nn.Layer): - def __init__(self, name="mAP"): + def __init__(self): super().__init__() - self.name = name def forward(self, similarities_matrix, query_img_id, gallery_img_id): metric_dict = dict() @@ -49,14 +48,13 @@ class mAP(nn.Layer): gallery_img_id) mAP = np.mean(all_AP) - metric_dict[self.name] = mAP + metric_dict["mAP"] = mAP return metric_dict class mINP(nn.Layer): - def __init__(self, name="mINP"): + def __init__(self): super().__init__() - self.name = name def forward(self, similarities_matrix, query_img_id, gallery_img_id): metric_dict = dict() @@ -64,7 +62,7 @@ class mINP(nn.Layer): gallery_img_id) mINP = np.mean(all_INP) - metric_dict[self.name] = mINP + metric_dict["mINP"] = mINP return metric_dict -- GitLab