From d7a7d3e5e1bfb5a592000fe3ccb7042a90f2945a Mon Sep 17 00:00:00 2001 From: zhangyubo0722 <94225063+zhangyubo0722@users.noreply.github.com> Date: Fri, 1 Sep 2023 19:28:17 +0800 Subject: [PATCH] fix topk bug (#2945) --- ppcls/data/postprocess/topk.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ppcls/data/postprocess/topk.py b/ppcls/data/postprocess/topk.py index cd45734e..50cc40d4 100644 --- a/ppcls/data/postprocess/topk.py +++ b/ppcls/data/postprocess/topk.py @@ -42,9 +42,9 @@ class Topk(object): except Exception as e: with open(class_id_map_file, "r", encoding='gbk') as fin: lines = fin.readlines() - for line in lines: - partition = line.split("\n")[0].partition(self.delimiter) - class_id_map[int(partition[0])] = str(partition[-1]) + for line in lines: + partition = line.split("\n")[0].partition(self.delimiter) + class_id_map[int(partition[0])] = str(partition[-1]) except Exception as ex: print(ex) class_id_map = None -- GitLab