diff --git a/PPOCRLabel.py b/PPOCRLabel.py index 6eb9e0c..c4e4724 100644 --- a/PPOCRLabel.py +++ b/PPOCRLabel.py @@ -1993,7 +1993,7 @@ def togglePolygons(self, value): for item, shape in self.itemsToShapes.items(): self.canvas.setShapeVisible(shape, value) - def loadFile(self, filePath=None): + def loadFile(self, filePath=None, isAdjustScale=True): """Load the specified file, or the last opened file if None.""" if self.dirty: self.mayContinue() @@ -2065,7 +2065,8 @@ def loadFile(self, filePath=None): self.actions.save.setEnabled(True) self.setDirty() self.canvas.setEnabled(True) - self.adjustScale(initial=True) + if isAdjustScale: + self.adjustScale(initial=True) self.paintCanvas() self.addRecentFile(self.filePath) self.toggleActions(True) @@ -2839,7 +2840,7 @@ def reRecognition(self): if (len(self.result_dic) > 0 and rec_flag > 0) or self.canvas.lockedShapes: self.canvas.isInTheSameImage = True self.saveFile(mode="Auto") - self.loadFile(self.filePath) + self.loadFile(self.filePath, isAdjustScale=False) self.canvas.isInTheSameImage = False self.setDirty() elif len(self.result_dic) == len(self.canvas.shapes) and rec_flag == 0: diff --git a/README.md b/README.md index 0d0ab87..be08fac 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ PPOCRLabelv2 is a semi-automatic graphic annotation tool suitable for OCR field, | | | ### Recent Update - +- 2022.09: Added `Re-recognition` and `Auto Save Unsaved changes` features. For usage details, please refer to the "11. Additional Feature Description" in the "2.1 Operational Steps" section below. - 2022.05: Add table annotations, follow `2.2 Table Annotations` for more information (by [whjdark](https://github.com/peterh0323); [Evezerest](https://github.com/Evezerest)) - 2022.02:(by [PeterH0323](https://github.com/peterh0323) ) - Add KIE Mode by using `--kie`, for [detection + identification + keyword extraction] labeling. @@ -157,6 +157,10 @@ PPOCRLabel.exe --lang ch 10. Labeling result: the user can export the label result manually through the menu "File - Export Label", while the program will also export automatically if "File - Auto export Label Mode" is selected. The manually checked label will be stored in *Label.txt* under the opened picture folder. Click "File"-"Export Recognition Results" in the menu bar, the recognition training data of such pictures will be saved in the *crop_img* folder, and the recognition label will be saved in *rec_gt.txt*[4]. +11. Additional Feature Description + - `File` -> `Re-recognition`: After checking, the newly annotated box content will automatically trigger the `Re-recognition` function of the current annotation box, eliminating the need to click the Re-identify button. This is suitable for scenarios where you do not want to use Automatic Annotation but prefer manual annotation, such as license plate recognition. In a single image with only one license plate, using Automatic Annotation would require deleting many additional recognized text boxes, which is less efficient than directly re-annotating. + - `File` -> `Auto Save Unsaved changes`: By default, you need to press the `Check` button to complete the marking confirmation for the current box, which can be cumbersome. After checking, when switching to the next image (by pressing the shortcut key `D`), a prompt box asking to confirm whether to save unconfirmed markings will no longer appear. The current markings will be automatically saved and the next image will be switched, making it convenient for quick marking. + ### 2.2 Table Annotation The table annotation is aimed at extracting the structure of the table in a picture and converting it to Excel format, so the annotation needs to be done simultaneously with external software to edit Excel. diff --git a/README_ch.md b/README_ch.md index 4302755..e0ad042 100644 --- a/README_ch.md +++ b/README_ch.md @@ -18,6 +18,7 @@ PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具,内置P | | | #### 近期更新 +- 2022.09: 新增`自动重新识别`和`自动保存未提交变更`功能,使用方法详见下方`2.1 操作步骤`的`11. 补充功能说明` - 2022.05:**新增表格标注**,使用方法见下方`2.2 表格标注`(by [whjdark](https://github.com/peterh0323); [Evezerest](https://github.com/Evezerest)) - 2022.02:**新增关键信息标注**、优化标注体验(by [PeterH0323](https://github.com/peterh0323) ) - 新增:使用 `--kie` 进入 KIE 功能,用于打【检测+识别+关键字提取】的标签 @@ -141,6 +142,9 @@ PPOCRLabel.exe --lang ch 8. **确认标记:点击 “确认”,图片状态切换为 “√”,跳转至下一张。** 9. 删除:点击 “删除图像”,图片将会被删除至回收站。 10. 导出结果:用户可以通过菜单中“文件-导出标记结果”手动导出,同时也可以点击“文件 - 自动导出标记结果”开启自动导出。手动确认过的标记将会被存放在所打开图片文件夹下的*Label.txt*中。在菜单栏点击 “文件” - "导出识别结果"后,会将此类图片的识别训练数据保存在*crop_img*文件夹下,识别标签保存在*rec_gt.txt*中[4]。 +11. 补充功能说明 + - `文件` -> `自动重新识别` : 勾选后,对于新标注的框内容会自动触发当前标注框的重新识别功能,不需要再去点击`重新识别`按钮,适合各种原因不想使用`自动标注`只想手动标注的场景,例如车牌识别,一张图里只有一个车牌,如果使用`自动标注`,需要删除很多额外识别出来的文字框,不如直接重新标注 + - `文件` -> `自动保存未提交变更` : 默认是按`确认`按钮完成当前框的标记确认,有点繁琐,勾选后,切换下一张图(按快捷键`D`)的时候,不再弹出提示框确认是否保存未确认的标记,自动保存当前标记并切换下一张图,方便快速标记 ### 2.2 表格标注([视频演示](https://www.bilibili.com/video/BV1wR4y1v7JE/?share_source=copy_web&vd_source=cf1f9d24648d49636e3d109c9f9a377d&t=1998)) 表格标注针对表格的结构化提取,将图片中的表格转换为Excel格式,因此标注时需要配合外部软件打开Excel同时完成。在PPOCRLabel软件中完成表格中的文字信息标注(文字与位置)、在Excel文件中完成表格结构信息标注,推荐的步骤为: @@ -193,7 +197,7 @@ PPOCRLabel.exe --lang ch | Ctrl + R | 重新识别所选标记 | | Ctrl + C | 【复制并粘贴】选中的标记框 | | Ctrl + 鼠标左键 | 多选标记框 | -| Backspace 或 delete | 删除所选框 | +| Backspace 或 Delete | 删除所选框 | | Ctrl + V 或 End | 确认本张图片标记 | | Ctrl + Shift + d | 删除本张图片 | | D | 下一张图片 | diff --git a/libs/canvas.py b/libs/canvas.py index a0517d2..ba89789 100644 --- a/libs/canvas.py +++ b/libs/canvas.py @@ -218,7 +218,7 @@ def mouseMoveEvent(self, ev): # - Highlight shapes # - Highlight vertex # Update shape/vertex fill and tooltip value accordingly. - self.setToolTip("Image") + # self.setToolTip("Image") for shape in reversed([s for s in self.shapes if self.isVisible(s)]): # Look for a nearby vertex to highlight. If that fails, # check if we happen to be inside a shape.