Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
3d30899b
P
PaddleOCR
项目概览
weixin_41840029
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3d30899b
编写于
1月 20, 2022
作者:
E
Evezerest
提交者:
GitHub
1月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5290 from PeterH0323/dygraph
【PPOCRLabel】: Improve User Experience and Efficiency and BUG Fixed
上级
177d284f
fb8fadcd
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
40 addition
and
14 deletion
+40
-14
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+24
-7
PPOCRLabel/README.md
PPOCRLabel/README.md
+2
-2
PPOCRLabel/README_ch.md
PPOCRLabel/README_ch.md
+4
-4
PPOCRLabel/libs/autoDialog.py
PPOCRLabel/libs/autoDialog.py
+10
-1
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
3d30899b
...
@@ -101,6 +101,8 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -101,6 +101,8 @@ class MainWindow(QMainWindow, WindowMixin):
def
__init__
(
self
,
lang
=
"ch"
,
gpu
=
False
,
defaultFilename
=
None
,
defaultPrefdefClassFile
=
None
,
defaultSaveDir
=
None
):
def
__init__
(
self
,
lang
=
"ch"
,
gpu
=
False
,
defaultFilename
=
None
,
defaultPrefdefClassFile
=
None
,
defaultSaveDir
=
None
):
super
(
MainWindow
,
self
).
__init__
()
super
(
MainWindow
,
self
).
__init__
()
self
.
setWindowTitle
(
__appname__
)
self
.
setWindowTitle
(
__appname__
)
self
.
setWindowState
(
Qt
.
WindowMaximized
)
# set window max
self
.
activateWindow
()
# PPOCRLabel goes to the front when activate
# Load setting in the main thread
# Load setting in the main thread
self
.
settings
=
Settings
()
self
.
settings
=
Settings
()
...
@@ -178,7 +180,8 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -178,7 +180,8 @@ class MainWindow(QMainWindow, WindowMixin):
fileListContainer
=
QWidget
()
fileListContainer
=
QWidget
()
fileListContainer
.
setLayout
(
filelistLayout
)
fileListContainer
.
setLayout
(
filelistLayout
)
self
.
filedock
=
QDockWidget
(
getStr
(
'fileList'
),
self
)
self
.
fileListName
=
getStr
(
'fileList'
)
self
.
filedock
=
QDockWidget
(
self
.
fileListName
,
self
)
self
.
filedock
.
setObjectName
(
getStr
(
'files'
))
self
.
filedock
.
setObjectName
(
getStr
(
'files'
))
self
.
filedock
.
setWidget
(
fileListContainer
)
self
.
filedock
.
setWidget
(
fileListContainer
)
self
.
addDockWidget
(
Qt
.
LeftDockWidgetArea
,
self
.
filedock
)
self
.
addDockWidget
(
Qt
.
LeftDockWidgetArea
,
self
.
filedock
)
...
@@ -394,7 +397,7 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -394,7 +397,7 @@ class MainWindow(QMainWindow, WindowMixin):
'w'
,
'objects'
,
getStr
(
'crtBoxDetail'
),
enabled
=
False
)
'w'
,
'objects'
,
getStr
(
'crtBoxDetail'
),
enabled
=
False
)
delete
=
action
(
getStr
(
'delBox'
),
self
.
deleteSelectedShape
,
delete
=
action
(
getStr
(
'delBox'
),
self
.
deleteSelectedShape
,
'
backspace
'
,
'delete'
,
getStr
(
'delBoxDetail'
),
enabled
=
False
)
'
Alt+X
'
,
'delete'
,
getStr
(
'delBoxDetail'
),
enabled
=
False
)
copy
=
action
(
getStr
(
'dupBox'
),
self
.
copySelectedShape
,
copy
=
action
(
getStr
(
'dupBox'
),
self
.
copySelectedShape
,
'Ctrl+C'
,
'copy'
,
getStr
(
'dupBoxDetail'
),
'Ctrl+C'
,
'copy'
,
getStr
(
'dupBoxDetail'
),
...
@@ -1388,6 +1391,13 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -1388,6 +1391,13 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
labelList
.
setCurrentItem
(
self
.
labelList
.
item
(
self
.
labelList
.
count
()
-
1
))
self
.
labelList
.
setCurrentItem
(
self
.
labelList
.
item
(
self
.
labelList
.
count
()
-
1
))
self
.
labelList
.
item
(
self
.
labelList
.
count
()
-
1
).
setSelected
(
True
)
self
.
labelList
.
item
(
self
.
labelList
.
count
()
-
1
).
setSelected
(
True
)
# show file list image count
select_indexes
=
self
.
fileListWidget
.
selectedIndexes
()
if
len
(
select_indexes
)
>
0
:
self
.
filedock
.
setWindowTitle
(
self
.
fileListName
+
f
" (
{
select_indexes
[
0
].
row
()
+
1
}
"
f
"/
{
self
.
fileListWidget
.
count
()
}
)"
)
self
.
canvas
.
setFocus
(
True
)
self
.
canvas
.
setFocus
(
True
)
return
True
return
True
return
False
return
False
...
@@ -1596,7 +1606,8 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -1596,7 +1606,8 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
actions
.
rotateLeft
.
setEnabled
(
True
)
self
.
actions
.
rotateLeft
.
setEnabled
(
True
)
self
.
actions
.
rotateRight
.
setEnabled
(
True
)
self
.
actions
.
rotateRight
.
setEnabled
(
True
)
self
.
fileListWidget
.
setCurrentRow
(
0
)
# set list index to first
self
.
filedock
.
setWindowTitle
(
self
.
fileListName
+
f
" (1/
{
self
.
fileListWidget
.
count
()
}
)"
)
# show image count
def
openPrevImg
(
self
,
_value
=
False
):
def
openPrevImg
(
self
,
_value
=
False
):
if
len
(
self
.
mImgList
)
<=
0
:
if
len
(
self
.
mImgList
)
<=
0
:
...
@@ -1790,6 +1801,9 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -1790,6 +1801,9 @@ class MainWindow(QMainWindow, WindowMixin):
def
discardChangesDialog
(
self
):
def
discardChangesDialog
(
self
):
yes
,
no
,
cancel
=
QMessageBox
.
Yes
,
QMessageBox
.
No
,
QMessageBox
.
Cancel
yes
,
no
,
cancel
=
QMessageBox
.
Yes
,
QMessageBox
.
No
,
QMessageBox
.
Cancel
if
self
.
lang
==
'ch'
:
msg
=
u
'您有未保存的变更, 您想保存再继续吗?
\n
点击 "No" 丢弃所有未保存的变更.'
else
:
msg
=
u
'You have unsaved changes, would you like to save them and proceed?
\n
Click "No" to undo all changes.'
msg
=
u
'You have unsaved changes, would you like to save them and proceed?
\n
Click "No" to undo all changes.'
return
QMessageBox
.
warning
(
self
,
u
'Attention'
,
msg
,
yes
|
no
|
cancel
)
return
QMessageBox
.
warning
(
self
,
u
'Attention'
,
msg
,
yes
|
no
|
cancel
)
...
@@ -1908,7 +1922,7 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -1908,7 +1922,7 @@ class MainWindow(QMainWindow, WindowMixin):
uncheckedList
=
[
i
for
i
in
self
.
mImgList
if
i
not
in
self
.
fileStatedict
.
keys
()]
uncheckedList
=
[
i
for
i
in
self
.
mImgList
if
i
not
in
self
.
fileStatedict
.
keys
()]
self
.
autoDialog
=
AutoDialog
(
parent
=
self
,
ocr
=
self
.
ocr
,
mImgList
=
uncheckedList
,
lenbar
=
len
(
uncheckedList
))
self
.
autoDialog
=
AutoDialog
(
parent
=
self
,
ocr
=
self
.
ocr
,
mImgList
=
uncheckedList
,
lenbar
=
len
(
uncheckedList
))
self
.
autoDialog
.
popUp
()
self
.
autoDialog
.
popUp
()
self
.
currIndex
=
len
(
self
.
mImgList
)
self
.
currIndex
=
len
(
self
.
mImgList
)
-
1
self
.
loadFile
(
self
.
filePath
)
# ADD
self
.
loadFile
(
self
.
filePath
)
# ADD
self
.
haveAutoReced
=
True
self
.
haveAutoReced
=
True
self
.
AutoRecognition
.
setEnabled
(
False
)
self
.
AutoRecognition
.
setEnabled
(
False
)
...
@@ -2089,8 +2103,11 @@ class MainWindow(QMainWindow, WindowMixin):
...
@@ -2089,8 +2103,11 @@ class MainWindow(QMainWindow, WindowMixin):
f
.
write
(
key
+
'
\t
'
)
f
.
write
(
key
+
'
\t
'
)
f
.
write
(
json
.
dumps
(
self
.
PPlabel
[
key
],
ensure_ascii
=
False
)
+
'
\n
'
)
f
.
write
(
json
.
dumps
(
self
.
PPlabel
[
key
],
ensure_ascii
=
False
)
+
'
\n
'
)
if
mode
==
'Manual'
:
if
mode
==
'Manual'
:
msg
=
'Images that have been checked are saved in '
+
self
.
PPlabelpath
if
self
.
lang
==
'ch'
:
msg
=
'已将检查过的图片标签保存在 '
+
self
.
PPlabelpath
+
" 文件中"
else
:
msg
=
'Images that have been checked are saved in '
+
self
.
PPlabelpath
QMessageBox
.
information
(
self
,
"Information"
,
msg
)
QMessageBox
.
information
(
self
,
"Information"
,
msg
)
def
saveCacheLabel
(
self
):
def
saveCacheLabel
(
self
):
...
...
PPOCRLabel/README.md
浏览文件 @
3d30899b
...
@@ -143,7 +143,7 @@ python PPOCRLabel.py
...
@@ -143,7 +143,7 @@ python PPOCRLabel.py
### 3.1 Shortcut keys
### 3.1 Shortcut keys
| Shortcut keys | Description |
| Shortcut keys | Description |
|
------------------------
| ------------------------------------------------ |
|
--------------------------
| ------------------------------------------------ |
| Ctrl + Shift + R | Re-recognize all the labels of the current image |
| Ctrl + Shift + R | Re-recognize all the labels of the current image |
| W | Create a rect box |
| W | Create a rect box |
| Q | Create a four-points box |
| Q | Create a four-points box |
...
@@ -151,7 +151,7 @@ python PPOCRLabel.py
...
@@ -151,7 +151,7 @@ python PPOCRLabel.py
| Ctrl + R | Re-recognize the selected box |
| Ctrl + R | Re-recognize the selected box |
| Ctrl + C | Copy and paste the selected box |
| Ctrl + C | Copy and paste the selected box |
| Ctrl + Left Mouse Button | Multi select the label box |
| Ctrl + Left Mouse Button | Multi select the label box |
|
Backspace
| Delete the selected box |
|
Ctrl + X
| Delete the selected box |
| Ctrl + V | Check image |
| Ctrl + V | Check image |
| Ctrl + Shift + d | Delete image |
| Ctrl + Shift + d | Delete image |
| D | Next image |
| D | Next image |
...
...
PPOCRLabel/README_ch.md
浏览文件 @
3d30899b
...
@@ -132,7 +132,7 @@ python PPOCRLabel.py --lang ch
...
@@ -132,7 +132,7 @@ python PPOCRLabel.py --lang ch
### 3.1 快捷键
### 3.1 快捷键
| 快捷键 | 说明 |
| 快捷键 | 说明 |
|
----------------
| ---------------------------- |
|
------------------
| ---------------------------- |
| Ctrl + shift + R | 对当前图片的所有标记重新识别 |
| Ctrl + shift + R | 对当前图片的所有标记重新识别 |
| W | 新建矩形框 |
| W | 新建矩形框 |
| Q | 新建四点框 |
| Q | 新建四点框 |
...
@@ -140,7 +140,7 @@ python PPOCRLabel.py --lang ch
...
@@ -140,7 +140,7 @@ python PPOCRLabel.py --lang ch
| Ctrl + R | 重新识别所选标记 |
| Ctrl + R | 重新识别所选标记 |
| Ctrl + C | 复制并粘贴选中的标记框 |
| Ctrl + C | 复制并粘贴选中的标记框 |
| Ctrl + 鼠标左键 | 多选标记框 |
| Ctrl + 鼠标左键 | 多选标记框 |
|
Backspace
| 删除所选框 |
|
Ctrl + X
| 删除所选框 |
| Ctrl + V | 确认本张图片标记 |
| Ctrl + V | 确认本张图片标记 |
| Ctrl + Shift + d | 删除本张图片 |
| Ctrl + Shift + d | 删除本张图片 |
| D | 下一张图片 |
| D | 下一张图片 |
...
...
PPOCRLabel/libs/autoDialog.py
浏览文件 @
3d30899b
...
@@ -6,6 +6,8 @@ except ImportError:
...
@@ -6,6 +6,8 @@ except ImportError:
from
PyQt4.QtGui
import
*
from
PyQt4.QtGui
import
*
from
PyQt4.QtCore
import
*
from
PyQt4.QtCore
import
*
import
time
import
datetime
import
json
import
json
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
...
@@ -80,8 +82,9 @@ class AutoDialog(QDialog):
...
@@ -80,8 +82,9 @@ class AutoDialog(QDialog):
self
.
parent
=
parent
self
.
parent
=
parent
self
.
ocr
=
ocr
self
.
ocr
=
ocr
self
.
mImgList
=
mImgList
self
.
mImgList
=
mImgList
self
.
lender
=
lenbar
self
.
pb
=
QProgressBar
()
self
.
pb
=
QProgressBar
()
self
.
pb
.
setRange
(
0
,
lenba
r
)
self
.
pb
.
setRange
(
0
,
self
.
lende
r
)
self
.
pb
.
setValue
(
0
)
self
.
pb
.
setValue
(
0
)
layout
=
QVBoxLayout
()
layout
=
QVBoxLayout
()
...
@@ -108,10 +111,16 @@ class AutoDialog(QDialog):
...
@@ -108,10 +111,16 @@ class AutoDialog(QDialog):
self
.
thread_1
.
progressBarValue
.
connect
(
self
.
handleProgressBarSingal
)
self
.
thread_1
.
progressBarValue
.
connect
(
self
.
handleProgressBarSingal
)
self
.
thread_1
.
listValue
.
connect
(
self
.
handleListWidgetSingal
)
self
.
thread_1
.
listValue
.
connect
(
self
.
handleListWidgetSingal
)
self
.
thread_1
.
endsignal
.
connect
(
self
.
handleEndsignalSignal
)
self
.
thread_1
.
endsignal
.
connect
(
self
.
handleEndsignalSignal
)
self
.
time_start
=
time
.
time
()
# save start time
def
handleProgressBarSingal
(
self
,
i
):
def
handleProgressBarSingal
(
self
,
i
):
self
.
pb
.
setValue
(
i
)
self
.
pb
.
setValue
(
i
)
# calculate time left of auto labeling
avg_time
=
(
time
.
time
()
-
self
.
time_start
)
/
i
# Use average time to prevent time fluctuations
time_left
=
str
(
datetime
.
timedelta
(
seconds
=
avg_time
*
(
self
.
lender
-
i
))).
split
(
"."
)[
0
]
# Remove microseconds
self
.
setWindowTitle
(
"PPOCRLabel -- "
+
f
"Time Left:
{
time_left
}
"
)
# show
def
handleListWidgetSingal
(
self
,
i
):
def
handleListWidgetSingal
(
self
,
i
):
self
.
listWidget
.
addItem
(
i
)
self
.
listWidget
.
addItem
(
i
)
titem
=
self
.
listWidget
.
item
(
self
.
listWidget
.
count
()
-
1
)
titem
=
self
.
listWidget
.
item
(
self
.
listWidget
.
count
()
-
1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录