Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
e7570d5b
P
PaddleOCR
项目概览
s920243400
/
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看板
提交
e7570d5b
编写于
2月 20, 2022
作者:
HinGwenWoong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Load label successful
上级
84a9ccf6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
17 deletion
+37
-17
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+37
-17
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
e7570d5b
...
@@ -79,14 +79,19 @@ class MainWindow(QMainWindow):
...
@@ -79,14 +79,19 @@ class MainWindow(QMainWindow):
self
.
settings
.
load
()
self
.
settings
.
load
()
settings
=
self
.
settings
settings
=
self
.
settings
self
.
lang
=
lang
self
.
lang
=
lang
self
.
kie_mode
=
kie_mode
self
.
key_previous_text
=
""
# Load string bundle for i18n
# Load string bundle for i18n
if
lang
not
in
[
'ch'
,
'en'
]:
if
lang
not
in
[
'ch'
,
'en'
]:
lang
=
'en'
lang
=
'en'
self
.
stringBundle
=
StringBundle
.
getBundle
(
localeStr
=
'zh-CN'
if
lang
==
'ch'
else
'en'
)
# 'en'
self
.
stringBundle
=
StringBundle
.
getBundle
(
localeStr
=
'zh-CN'
if
lang
==
'ch'
else
'en'
)
# 'en'
getStr
=
lambda
strId
:
self
.
stringBundle
.
getString
(
strId
)
getStr
=
lambda
strId
:
self
.
stringBundle
.
getString
(
strId
)
# KIE setting
self
.
kie_mode
=
kie_mode
self
.
key_previous_text
=
""
self
.
existed_key_cls_set
=
set
()
self
.
key_dialog_tip
=
getStr
(
'keyDialogTip'
)
self
.
defaultSaveDir
=
default_save_dir
self
.
defaultSaveDir
=
default_save_dir
self
.
ocr
=
PaddleOCR
(
use_pdserving
=
False
,
self
.
ocr
=
PaddleOCR
(
use_pdserving
=
False
,
use_angle_cls
=
True
,
use_angle_cls
=
True
,
...
@@ -425,26 +430,11 @@ class MainWindow(QMainWindow):
...
@@ -425,26 +430,11 @@ class MainWindow(QMainWindow):
}
}
# ================== New Actions ==================
# ================== New Actions ==================
# key list dialog
if
kie_mode
:
self
.
keyDialog
=
KeyDialog
(
text
=
getStr
(
'keyDialogTip'
),
parent
=
self
,
labels
=
None
,
sort_labels
=
True
,
show_text_field
=
True
,
completion
=
"startswith"
,
fit_to_content
=
{
'column'
:
True
,
'row'
:
False
},
flags
=
None
)
else
:
self
.
keyDialog
=
None
edit
=
action
(
getStr
(
'editLabel'
),
self
.
editLabel
,
edit
=
action
(
getStr
(
'editLabel'
),
self
.
editLabel
,
'Ctrl+E'
,
'edit'
,
getStr
(
'editLabelDetail'
),
'Ctrl+E'
,
'edit'
,
getStr
(
'editLabelDetail'
),
enabled
=
False
)
enabled
=
False
)
# ================== New Actions ==================
AutoRec
=
action
(
getStr
(
'autoRecognition'
),
self
.
autoRecognition
,
AutoRec
=
action
(
getStr
(
'autoRecognition'
),
self
.
autoRecognition
,
''
,
'Auto'
,
getStr
(
'autoRecognition'
),
enabled
=
False
)
''
,
'Auto'
,
getStr
(
'autoRecognition'
),
enabled
=
False
)
...
@@ -652,6 +642,8 @@ class MainWindow(QMainWindow):
...
@@ -652,6 +642,8 @@ class MainWindow(QMainWindow):
elif
self
.
filePath
:
elif
self
.
filePath
:
self
.
queueEvent
(
partial
(
self
.
loadFile
,
self
.
filePath
or
""
))
self
.
queueEvent
(
partial
(
self
.
loadFile
,
self
.
filePath
or
""
))
self
.
keyDialog
=
None
# Callbacks:
# Callbacks:
self
.
zoomWidget
.
valueChanged
.
connect
(
self
.
paintCanvas
)
self
.
zoomWidget
.
valueChanged
.
connect
(
self
.
paintCanvas
)
...
@@ -1595,6 +1587,34 @@ class MainWindow(QMainWindow):
...
@@ -1595,6 +1587,34 @@ class MainWindow(QMainWindow):
self
.
Cachelabel
=
self
.
loadLabelFile
(
self
.
Cachelabelpath
)
self
.
Cachelabel
=
self
.
loadLabelFile
(
self
.
Cachelabelpath
)
if
self
.
Cachelabel
:
if
self
.
Cachelabel
:
self
.
PPlabel
=
dict
(
self
.
Cachelabel
,
**
self
.
PPlabel
)
self
.
PPlabel
=
dict
(
self
.
Cachelabel
,
**
self
.
PPlabel
)
for
image
,
info
in
self
.
PPlabel
.
items
():
for
box
in
info
:
if
"key_cls"
not
in
box
:
continue
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
:
if
not
self
.
keyList
.
findItemsByLabel
(
key_text
):
item
=
self
.
keyList
.
createItemFromLabel
(
key_text
)
self
.
keyList
.
addItem
(
item
)
rgb
=
self
.
_get_rgb_by_label
(
key_text
,
self
.
kie_mode
)
self
.
keyList
.
setItemLabel
(
item
,
key_text
,
rgb
)
# key list dialog
if
self
.
kie_mode
:
self
.
keyDialog
=
KeyDialog
(
text
=
self
.
key_dialog_tip
,
parent
=
self
,
labels
=
self
.
existed_key_cls_set
,
sort_labels
=
True
,
show_text_field
=
True
,
completion
=
"startswith"
,
fit_to_content
=
{
'column'
:
True
,
'row'
:
False
},
flags
=
None
)
self
.
lastOpenDir
=
dirpath
self
.
lastOpenDir
=
dirpath
self
.
dirname
=
dirpath
self
.
dirname
=
dirpath
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录