From d1f21650a976334c90d71e68adaeea15b87b502c Mon Sep 17 00:00:00 2001 From: HinGwenWoong Date: Thu, 5 May 2022 09:41:25 +0800 Subject: [PATCH 1/4] Improve doc about rotate box --- PPOCRLabel/README.md | 1 + PPOCRLabel/README_ch.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/PPOCRLabel/README.md b/PPOCRLabel/README.md index 0a1a753691..95baf66b29 100644 --- a/PPOCRLabel/README.md +++ b/PPOCRLabel/README.md @@ -12,6 +12,7 @@ PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field, w - Add KIE Mode by using `--kie`, for [detection + identification + keyword extraction] labeling. - 2022.01:(by [PeterH0323](https://github.com/peterh0323) ) - Improve user experience: prompt for the number of files and labels, optimize interaction, and fix bugs such as only use CPU when inference + - New functions: Support using `C` or `X` to rotate box. - 2021.11.17: - Support install and start PPOCRLabel through the whl package (by [d2623587501](https://github.com/d2623587501)) - Dataset segmentation: Divide the annotation file into training, verification and testing parts (refer to section 3.5 below, by [MrCuiHao](https://github.com/MrCuiHao)) diff --git a/PPOCRLabel/README_ch.md b/PPOCRLabel/README_ch.md index 99c088de83..5534b308f3 100644 --- a/PPOCRLabel/README_ch.md +++ b/PPOCRLabel/README_ch.md @@ -11,7 +11,8 @@ PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具,内置P - 2022.02:(by [PeterH0323](https://github.com/peterh0323) ) - 新增:使用 `--kie` 进入 KIE 功能,用于打【检测+识别+关键字提取】的标签 - 2022.01:(by [PeterH0323](https://github.com/peterh0323) ) - - 提升用户体验:新增文件与标记数目提示、优化交互、修复gpu使用等问题 + - 提升用户体验:新增文件与标记数目提示、优化交互、修复gpu使用等问题。 + - 新增功能:使用 `C` 和 `X` 对标记框进行旋转。 - 2021.11.17: - 新增支持通过whl包安装和启动PPOCRLabel(by [d2623587501](https://github.com/d2623587501)) - 标注数据集切分:对标注数据进行训练、验证与测试集划分(参考下方3.5节,by [MrCuiHao](https://github.com/MrCuiHao)) From cb9a8c4b9669a049ed9cc345189a4b70408af576 Mon Sep 17 00:00:00 2001 From: HinGwenWoong Date: Thu, 5 May 2022 09:48:23 +0800 Subject: [PATCH 2/4] Fix when has not `difficult` field will crash --- PPOCRLabel/PPOCRLabel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py index 523661b635..c896425b25 100644 --- a/PPOCRLabel/PPOCRLabel.py +++ b/PPOCRLabel/PPOCRLabel.py @@ -1440,7 +1440,7 @@ class MainWindow(QMainWindow): if imgidx in self.PPlabel.keys(): for box in self.PPlabel[imgidx]: key_cls = None if not self.kie_mode else box['key_cls'] - shapes.append((box['transcription'], box['points'], None, key_cls, box['difficult'])) + shapes.append((box['transcription'], box['points'], None, key_cls, box.get('difficult', False))) self.loadLabels(shapes) self.canvas.verified = False From 9e04c09f6258ac3b9aba6b1a6d54376e6ca207d6 Mon Sep 17 00:00:00 2001 From: HinGwenWoong Date: Thu, 5 May 2022 10:11:21 +0800 Subject: [PATCH 3/4] 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 c896425b25..6dec987eb5 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: From d30025583683a6ed100b05f30f3b0dd858a738db Mon Sep 17 00:00:00 2001 From: HinGwenWoong Date: Thu, 5 May 2022 11:31:17 +0800 Subject: [PATCH 4/4] Fix add same label in key dialog --- PPOCRLabel/PPOCRLabel.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py index 6dec987eb5..7c7802a73e 100644 --- a/PPOCRLabel/PPOCRLabel.py +++ b/PPOCRLabel/PPOCRLabel.py @@ -1606,8 +1606,6 @@ class MainWindow(QMainWindow): fit_to_content={'column': True, 'row': False}, flags=None ) - else: - self.keyDialog.labelList.addItems(self.existed_key_cls_set) def importDirImages(self, dirpath, isDelete=False): if not self.mayContinue() or not dirpath: