From 8402e8d1deaef4bbe9f0e9cf58cc9d43fada6764 Mon Sep 17 00:00:00 2001 From: Leif <4603009@qq.com> Date: Wed, 6 Jan 2021 15:38:18 +0800 Subject: [PATCH] Add editinlist.py --- PPOCRLabel/README.md | 8 ++++++-- PPOCRLabel/README_ch.md | 20 ++++++++++++++++---- PPOCRLabel/libs/editinlist.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 PPOCRLabel/libs/editinlist.py diff --git a/PPOCRLabel/README.md b/PPOCRLabel/README.md index c7598817..b7a359d4 100644 --- a/PPOCRLabel/README.md +++ b/PPOCRLabel/README.md @@ -2,7 +2,7 @@ English | [简体中文](README_ch.md) # PPOCRLabel -PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field. It is written in python3 and pyqt5, supporting rectangular box annotation and four-point annotation modes. Annotations can be directly used for the training of PPOCR detection and recognition models. +PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field, with built-in PPOCR model to automatically detect and re-recognize data. It is written in python3 and pyqt5, supporting rectangular box annotation and four-point annotation modes. Annotations can be directly used for the training of PPOCR detection and recognition models. @@ -10,11 +10,15 @@ PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field. I - 2020.12.18: Support re-recognition of a single label box (by [ninetailskim](https://github.com/ninetailskim) ), perfect shortcut keys. +### TODO: +- Lock box mode: For the same scene data, the size and position of the locked detection box can be transferred between different pictures. +- Experience optimization: Add undo, batch operation include move, copy, delete and so on, optimize the annotation process. + ## Installation ### 1. Install PaddleOCR -Refer to [PaddleOCR installation document](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/doc_ch/installation.md) to prepare PaddleOCR +PaddleOCR models has been built in PPOCRLabel, please refer to [PaddleOCR installation document](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/doc_ch/installation.md) to prepare PaddleOCR and make sure it works. ### 2. Install PPOCRLabel diff --git a/PPOCRLabel/README_ch.md b/PPOCRLabel/README_ch.md index bc60c4ee..4200a214 100644 --- a/PPOCRLabel/README_ch.md +++ b/PPOCRLabel/README_ch.md @@ -2,18 +2,26 @@ # PPOCRLabel -PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具,使用python3和pyqt5编写,支持矩形框标注和四点标注模式,导出格式可直接用于PPOCR检测和识别模型的训练。 +PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具,内置PPOCR模型对数据自动标注和重新识别。使用python3和pyqt5编写,支持矩形框标注和四点标注模式,导出格式可直接用于PPOCR检测和识别模型的训练。 #### 近期更新 -- 2020.12.18: 支持对单个标记框进行重新识别(by [ninetailskim](https://github.com/ninetailskim) ),完善快捷键。 +- 2020.12.18: 支持对单个标记框进行重新识别(by [ninetailskim](https://github.com/ninetailskim)),完善快捷键。 + +#### 尽请期待 + +- 锁定框模式:针对同一场景数据,被锁定的检测框的大小与位置能在不同图片之间传递。 +- 体验优化:增加撤销操作,批量移动、复制、删除等功能。优化标注流程。 + +如果您对以上内容感兴趣或对完善工具有不一样的想法,欢迎加入我们的队伍与我们共同开发 + ## 安装 ### 1. 安装PaddleOCR -参考[PaddleOCR安装文档](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/doc_ch/installation.md)准备好PaddleOCR +PPOCRLabel内置PaddleOCR模型,故请参考[PaddleOCR安装文档](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/doc_ch/installation.md)准备好PaddleOCR,并确保PaddleOCR安装成功。 ### 2. 安装PPOCRLabel #### Windows + Anaconda @@ -115,7 +123,7 @@ python3 PPOCRLabel.py --lang ch - PPOCRLabel**不支持对中文文件名**的图片进行自动标注。 -- 针对Linux用户::如果您在打开软件过程中出现**objc[XXXXX]**开头的错误,证明您的opencv版本太高,建议安装4.2版本: +- 针对Linux用户:如果您在打开软件过程中出现**objc[XXXXX]**开头的错误,证明您的opencv版本太高,建议安装4.2版本: ``` pip install opencv-python==4.2.0.32 ``` @@ -129,6 +137,10 @@ python3 PPOCRLabel.py --lang ch ``` pip install opencv-contrib-python-headless ``` +### 成为特殊兴趣小组的一员 + +PPOCRSIG(Paddle Paddle OCR Special Interest Group,飞桨OCR特殊兴趣小组)致力于,我们希望拥有各种背景的,以开源的精神将OCR应用于各行各业。小组 + ### 参考资料 1.[Tzutalin. LabelImg. Git code (2015)](https://github.com/tzutalin/labelImg) diff --git a/PPOCRLabel/libs/editinlist.py b/PPOCRLabel/libs/editinlist.py new file mode 100644 index 00000000..f01f513c --- /dev/null +++ b/PPOCRLabel/libs/editinlist.py @@ -0,0 +1,29 @@ +import sys +from PyQt5 import QtWidgets +from PyQt5.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtWidgets import * + +class EditInList(QListWidget): + def __init__(self): + super(EditInList,self).__init__() + # click to edit + self.clicked.connect(self.item_clicked) + + def item_clicked(self, modelindex: QModelIndex) -> None: + self.edited_item = self.currentItem() + self.closePersistentEditor(self.edited_item) + item = self.item(modelindex.row()) + self.edited_item = item + self.openPersistentEditor(item) + self.editItem(item) + + def mouseDoubleClickEvent(self, event): + # close edit + for i in range(self.count()): + self.closePersistentEditor(self.item(i)) + + def leaveEvent(self, event): + # close edit + for i in range(self.count()): + self.closePersistentEditor(self.item(i)) \ No newline at end of file -- GitLab