Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
ab17e963
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看板
提交
ab17e963
编写于
2月 24, 2022
作者:
HinGwenWoong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Saving key [key_cls] only --kie=True
上级
967f0676
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
11 deletion
+17
-11
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+17
-11
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
ab17e963
...
...
@@ -536,7 +536,7 @@ class MainWindow(QMainWindow):
editMenu
=
(
createpoly
,
edit
,
copy
,
delete
,
singleRere
,
None
,
undo
,
undoLastPoint
,
None
,
rotateLeft
,
rotateRight
,
None
,
color1
,
self
.
drawSquaresOption
,
lock
),
beginnerContext
=
(
create
,
edit
,
copy
,
delete
,
singleRere
,
rotateLeft
,
rotateRight
,
lock
,
change_cls
),
create
,
edit
,
copy
,
delete
,
singleRere
,
rotateLeft
,
rotateRight
,
lock
,
change_cls
),
advancedContext
=
(
createMode
,
editMode
,
edit
,
copy
,
delete
,
shapeLineColor
,
shapeFillColor
),
onLoadActive
=
(
create
,
createMode
,
editMode
),
...
...
@@ -1105,7 +1105,9 @@ class MainWindow(QMainWindow):
shapes
=
[
format_shape
(
shape
)
for
shape
in
self
.
canvas
.
shapes
if
shape
.
line_color
!=
DEFAULT_LOCK_COLOR
]
# Can add differrent annotation formats here
for
box
in
self
.
result_dic
:
trans_dic
=
{
"label"
:
box
[
1
][
0
],
"points"
:
box
[
0
],
"difficult"
:
False
,
"key_cls"
:
"None"
}
trans_dic
=
{
"label"
:
box
[
1
][
0
],
"points"
:
box
[
0
],
"difficult"
:
False
}
if
self
.
kie_mode
:
trans_dic
.
update
({
"key_cls"
:
"None"
})
if
trans_dic
[
"label"
]
==
""
and
mode
==
'Auto'
:
continue
shapes
.
append
(
trans_dic
)
...
...
@@ -1113,8 +1115,10 @@ class MainWindow(QMainWindow):
try
:
trans_dic
=
[]
for
box
in
shapes
:
trans_dic
.
append
({
"transcription"
:
box
[
'label'
],
"points"
:
box
[
'points'
],
"difficult"
:
box
[
'difficult'
],
"key_cls"
:
box
[
'key_cls'
]})
trans_dict
=
{
"transcription"
:
box
[
'label'
],
"points"
:
box
[
'points'
],
"difficult"
:
box
[
'difficult'
]}
if
self
.
kie_mode
:
trans_dict
.
update
({
"key_cls"
:
box
[
'key_cls'
]})
trans_dic
.
append
(
trans_dict
)
self
.
PPlabel
[
annotationFilePath
]
=
trans_dic
if
mode
==
'Auto'
:
self
.
Cachelabel
[
annotationFilePath
]
=
trans_dic
...
...
@@ -1424,15 +1428,17 @@ class MainWindow(QMainWindow):
# box['ratio'] of the shapes saved in lockedShapes contains the ratio of the
# four corner coordinates of the shapes to the height and width of the image
for
box
in
self
.
canvas
.
lockedShapes
:
key_cls
=
None
if
not
self
.
kie_mode
else
box
[
'key_cls'
]
if
self
.
canvas
.
isInTheSameImage
:
shapes
.
append
((
box
[
'transcription'
],
[[
s
[
0
]
*
width
,
s
[
1
]
*
height
]
for
s
in
box
[
'ratio'
]],
DEFAULT_LOCK_COLOR
,
box
[
'key_cls'
]
,
box
[
'difficult'
]))
DEFAULT_LOCK_COLOR
,
key_cls
,
box
[
'difficult'
]))
else
:
shapes
.
append
((
'锁定框:待检测'
,
[[
s
[
0
]
*
width
,
s
[
1
]
*
height
]
for
s
in
box
[
'ratio'
]],
DEFAULT_LOCK_COLOR
,
box
[
'key_cls'
]
,
box
[
'difficult'
]))
DEFAULT_LOCK_COLOR
,
key_cls
,
box
[
'difficult'
]))
if
imgidx
in
self
.
PPlabel
.
keys
():
for
box
in
self
.
PPlabel
[
imgidx
]:
shapes
.
append
((
box
[
'transcription'
],
box
[
'points'
],
None
,
box
[
'key_cls'
],
box
[
'difficult'
]))
key_cls
=
None
if
not
self
.
kie_mode
else
box
[
'key_cls'
]
shapes
.
append
((
box
[
'transcription'
],
box
[
'points'
],
None
,
key_cls
,
box
[
'difficult'
]))
self
.
loadLabels
(
shapes
)
self
.
canvas
.
verified
=
False
...
...
@@ -1600,7 +1606,6 @@ class MainWindow(QMainWindow):
else
:
self
.
keyDialog
.
labelList
.
addItems
(
self
.
existed_key_cls_set
)
def
importDirImages
(
self
,
dirpath
,
isDelete
=
False
):
if
not
self
.
mayContinue
()
or
not
dirpath
:
return
...
...
@@ -2250,9 +2255,10 @@ class MainWindow(QMainWindow):
shapes
=
[
format_shape
(
shape
)
for
shape
in
self
.
canvas
.
selectedShapes
]
trans_dic
=
[]
for
box
in
shapes
:
trans_dic
.
append
({
"transcription"
:
box
[
'label'
],
"ratio"
:
box
[
'ratio'
],
"difficult"
:
box
[
'difficult'
],
"key_cls"
:
"None"
if
"key_cls"
not
in
box
else
box
[
"key_cls"
]})
trans_dict
=
{
"transcription"
:
box
[
'label'
],
"ratio"
:
box
[
'ratio'
],
"difficult"
:
box
[
'difficult'
]}
if
self
.
kie_mode
:
trans_dict
.
update
({
"key_cls"
:
box
[
"key_cls"
]})
trans_dic
.
append
(
trans_dict
)
self
.
canvas
.
lockedShapes
=
trans_dic
self
.
actions
.
save
.
setEnabled
(
True
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录