From 9e04c09f6258ac3b9aba6b1a6d54376e6ca207d6 Mon Sep 17 00:00:00 2001 From: HinGwenWoong Date: Thu, 5 May 2022 10:11:21 +0800 Subject: [PATCH] Fix kie mode will crash when it has no `kie_cls` in label info --- PPOCRLabel/PPOCRLabel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py index c896425b..6dec987e 100644 --- a/PPOCRLabel/PPOCRLabel.py +++ b/PPOCRLabel/PPOCRLabel.py @@ -1439,7 +1439,7 @@ class MainWindow(QMainWindow): DEFAULT_LOCK_COLOR, key_cls, box['difficult'])) if imgidx in self.PPlabel.keys(): for box in self.PPlabel[imgidx]: - key_cls = None if not self.kie_mode else box['key_cls'] + key_cls = None if not self.kie_mode else box.get('key_cls', 'None') shapes.append((box['transcription'], box['points'], None, key_cls, box.get('difficult', False))) self.loadLabels(shapes) @@ -1584,7 +1584,7 @@ class MainWindow(QMainWindow): for image, info in label_dict.items(): for box in info: if "key_cls" not in box: - continue + box.update({"key_cls": "None"}) self.existed_key_cls_set.add(box["key_cls"]) if len(self.existed_key_cls_set) > 0: for key_text in self.existed_key_cls_set: -- GitLab