From 51836a1df27c9d90ceef84176e5ea4602791de8d Mon Sep 17 00:00:00 2001 From: HinGwenWoong Date: Sun, 20 Feb 2022 22:48:12 +0800 Subject: [PATCH] Fixed BUG not using --kie will crash, Improve README --- PPOCRLabel/PPOCRLabel.py | 9 ++++++--- PPOCRLabel/README.md | 8 ++++++-- PPOCRLabel/README_ch.md | 8 ++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py index 78a6586b..34c045e9 100644 --- a/PPOCRLabel/PPOCRLabel.py +++ b/PPOCRLabel/PPOCRLabel.py @@ -980,9 +980,12 @@ class MainWindow(QMainWindow): self.labelList.scrollToItem(self.currentItem()) # QAbstractItemView.EnsureVisible self.BoxList.scrollToItem(self.currentBox()) - if len(self.canvas.selectedShapes) == 1 and self.keyList.count() > 0: - selected_key_item_row = self.keyList.findItemsByLabel(self.canvas.selectedShapes[0].key_cls, get_row=True) - self.keyList.setCurrentRow(selected_key_item_row) + + if self.kie_mode: + if len(self.canvas.selectedShapes) == 1 and self.keyList.count() > 0: + selected_key_item_row = self.keyList.findItemsByLabel(self.canvas.selectedShapes[0].key_cls, + get_row=True) + self.keyList.setCurrentRow(selected_key_item_row) self._noSelectionSlot = False n_selected = len(selected_shapes) diff --git a/PPOCRLabel/README.md b/PPOCRLabel/README.md index e40d8291..4d25e670 100644 --- a/PPOCRLabel/README.md +++ b/PPOCRLabel/README.md @@ -8,6 +8,8 @@ PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field, w ### Recent Update +- 2022.02:(by [PeterH0323](https://github.com/peterh0323) ) + - Added KIE mode, 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 - 2021.11.17: @@ -72,7 +74,8 @@ PPOCRLabel ```bash pip3 install PPOCRLabel pip3 install opencv-contrib-python-headless==4.2.0.32 -PPOCRLabel # run +PPOCRLabel # [Normal mode] for [detection + recognition] labeling +PPOCRLabel --kie True # [KIE mode] for [detection + recognition + keyword extraction] labeling ``` #### 1.2.2 Build and Install the Whl Package Locally @@ -87,7 +90,8 @@ pip3 install dist/PPOCRLabel-1.0.2-py2.py3-none-any.whl ```bash cd ./PPOCRLabel # Switch to the PPOCRLabel directory -python PPOCRLabel.py +python PPOCRLabel.py # [Normal mode] for [detection + recognition] labeling +python PPOCRLabel.py --kie True # [KIE mode] for [detection + recognition + keyword extraction] labeling ``` diff --git a/PPOCRLabel/README_ch.md b/PPOCRLabel/README_ch.md index 815de997..3f8dc4f0 100644 --- a/PPOCRLabel/README_ch.md +++ b/PPOCRLabel/README_ch.md @@ -8,6 +8,8 @@ PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具,内置P #### 近期更新 +- 2022.02:(by [PeterH0323](https://github.com/peterh0323) ) + - 新增:KIE 功能,用于打【检测+识别+关键字提取】的标签 - 2022.01:(by [PeterH0323](https://github.com/peterh0323) ) - 提升用户体验:新增文件与标记数目提示、优化交互、修复gpu使用等问题 - 2021.11.17: @@ -70,7 +72,8 @@ PPOCRLabel --lang ch ```bash pip3 install PPOCRLabel pip3 install opencv-contrib-python-headless==4.2.0.32 # 如果下载过慢请添加"-i https://mirror.baidu.com/pypi/simple" -PPOCRLabel --lang ch # 启动 +PPOCRLabel --lang ch # 启动【普通模式】,用于打【检测+识别】场景的标签 +PPOCRLabel --lang ch --kie True # 启动 【KIE 模式】,用于打【检测+识别+关键字提取】场景的标签 ``` > 如果上述安装出现问题,可以参考3.6节 错误提示 @@ -89,7 +92,8 @@ pip3 install dist/PPOCRLabel-1.0.2-py2.py3-none-any.whl -i https://mirror.baidu. ```bash cd ./PPOCRLabel # 切换到PPOCRLabel目录 -python PPOCRLabel.py --lang ch +python PPOCRLabel.py --lang ch # 启动【普通模式】,用于打【检测+识别】场景的标签 +python PPOCRLabel.py --lang ch --kie True # 启动 【KIE 模式】,用于打【检测+识别+关键字提取】场景的标签 ``` -- GitLab