Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
77d83a60
Commit
77d83a60
authored
Feb 20, 2022
by
HinGwenWoong
Browse files
Add "key" in saving dict
parent
a85a009e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+8
-6
No files found.
PPOCRLabel/PPOCRLabel.py
View file @
77d83a60
...
...
@@ -1039,7 +1039,7 @@ class MainWindow(QMainWindow):
def
loadLabels
(
self
,
shapes
):
s
=
[]
for
label
,
points
,
line_color
,
fill_color
,
difficult
in
shapes
:
for
label
,
points
,
line_color
,
key
,
difficult
in
shapes
:
shape
=
Shape
(
label
=
label
,
line_color
=
line_color
)
for
x
,
y
in
points
:
...
...
@@ -1119,7 +1119,8 @@ class MainWindow(QMainWindow):
trans_dic
=
[]
for
box
in
shapes
:
trans_dic
.
append
(
{
"transcription"
:
box
[
'label'
],
"points"
:
box
[
'points'
],
'difficult'
:
box
[
'difficult'
]})
{
"transcription"
:
box
[
'label'
],
"points"
:
box
[
'points'
],
"difficult"
:
box
[
'difficult'
],
"key"
:
0
})
self
.
PPlabel
[
annotationFilePath
]
=
trans_dic
if
mode
==
'Auto'
:
self
.
Cachelabel
[
annotationFilePath
]
=
trans_dic
...
...
@@ -1410,13 +1411,13 @@ class MainWindow(QMainWindow):
for
box
in
self
.
canvas
.
lockedShapes
:
if
self
.
canvas
.
isInTheSameImage
:
shapes
.
append
((
box
[
'transcription'
],
[[
s
[
0
]
*
width
,
s
[
1
]
*
height
]
for
s
in
box
[
'ratio'
]],
DEFAULT_LOCK_COLOR
,
None
,
box
[
'difficult'
]))
DEFAULT_LOCK_COLOR
,
box
[
'key'
]
,
box
[
'difficult'
]))
else
:
shapes
.
append
((
'锁定框:待检测'
,
[[
s
[
0
]
*
width
,
s
[
1
]
*
height
]
for
s
in
box
[
'ratio'
]],
DEFAULT_LOCK_COLOR
,
None
,
box
[
'difficult'
]))
DEFAULT_LOCK_COLOR
,
box
[
'key'
]
,
box
[
'difficult'
]))
if
imgidx
in
self
.
PPlabel
.
keys
():
for
box
in
self
.
PPlabel
[
imgidx
]:
shapes
.
append
((
box
[
'transcription'
],
box
[
'points'
],
None
,
None
,
box
[
'difficult'
]))
shapes
.
append
((
box
[
'transcription'
],
box
[
'points'
],
None
,
box
[
'key'
]
,
box
[
'difficult'
]))
self
.
loadLabels
(
shapes
)
self
.
canvas
.
verified
=
False
...
...
@@ -2185,7 +2186,8 @@ 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'
]})
trans_dic
.
append
({
"transcription"
:
box
[
'label'
],
"ratio"
:
box
[
'ratio'
],
"difficult"
:
box
[
'difficult'
],
"key"
:
0
if
"key"
not
in
box
else
box
[
"key"
]})
self
.
canvas
.
lockedShapes
=
trans_dic
self
.
actions
.
save
.
setEnabled
(
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment