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
ec770f64
Commit
ec770f64
authored
Feb 20, 2022
by
HinGwenWoong
Browse files
After auto labeling, add None to key list at the same time
parent
3cf0237f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
26 deletions
+36
-26
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+36
-26
No files found.
PPOCRLabel/PPOCRLabel.py
View file @
ec770f64
...
@@ -1565,24 +1565,11 @@ class MainWindow(QMainWindow):
...
@@ -1565,24 +1565,11 @@ class MainWindow(QMainWindow):
self
.
actions
.
open_dataset_dir
.
setEnabled
(
False
)
self
.
actions
.
open_dataset_dir
.
setEnabled
(
False
)
defaultOpenDirPath
=
os
.
path
.
dirname
(
self
.
filePath
)
if
self
.
filePath
else
'.'
defaultOpenDirPath
=
os
.
path
.
dirname
(
self
.
filePath
)
if
self
.
filePath
else
'.'
def
i
mportDirImages
(
self
,
dirpath
,
isDelete
=
False
):
def
i
nit_key_list
(
self
,
label_dict
):
if
not
self
.
mayContinue
()
or
not
dirpath
:
if
not
self
.
kie_mode
:
return
return
if
self
.
defaultSaveDir
and
self
.
defaultSaveDir
!=
dirpath
:
self
.
saveLabelFile
()
if
not
isDelete
:
self
.
loadFilestate
(
dirpath
)
self
.
PPlabelpath
=
dirpath
+
'/Label.txt'
self
.
PPlabel
=
self
.
loadLabelFile
(
self
.
PPlabelpath
)
self
.
Cachelabelpath
=
dirpath
+
'/Cache.cach'
self
.
Cachelabel
=
self
.
loadLabelFile
(
self
.
Cachelabelpath
)
if
self
.
Cachelabel
:
self
.
PPlabel
=
dict
(
self
.
Cachelabel
,
**
self
.
PPlabel
)
if
self
.
kie_mode
:
# load key_cls
# load key_cls
for
image
,
info
in
self
.
PP
label
.
items
():
for
image
,
info
in
label
_dict
.
items
():
for
box
in
info
:
for
box
in
info
:
if
"key_cls"
not
in
box
:
if
"key_cls"
not
in
box
:
continue
continue
...
@@ -1595,6 +1582,7 @@ class MainWindow(QMainWindow):
...
@@ -1595,6 +1582,7 @@ class MainWindow(QMainWindow):
rgb
=
self
.
_get_rgb_by_label
(
key_text
,
self
.
kie_mode
)
rgb
=
self
.
_get_rgb_by_label
(
key_text
,
self
.
kie_mode
)
self
.
keyList
.
setItemLabel
(
item
,
key_text
,
rgb
)
self
.
keyList
.
setItemLabel
(
item
,
key_text
,
rgb
)
if
self
.
keyDialog
is
None
:
# key list dialog
# key list dialog
self
.
keyDialog
=
KeyDialog
(
self
.
keyDialog
=
KeyDialog
(
text
=
self
.
key_dialog_tip
,
text
=
self
.
key_dialog_tip
,
...
@@ -1606,6 +1594,26 @@ class MainWindow(QMainWindow):
...
@@ -1606,6 +1594,26 @@ class MainWindow(QMainWindow):
fit_to_content
=
{
'column'
:
True
,
'row'
:
False
},
fit_to_content
=
{
'column'
:
True
,
'row'
:
False
},
flags
=
None
flags
=
None
)
)
else
:
self
.
keyDialog
.
labelList
.
addItems
(
self
.
existed_key_cls_set
)
def
importDirImages
(
self
,
dirpath
,
isDelete
=
False
):
if
not
self
.
mayContinue
()
or
not
dirpath
:
return
if
self
.
defaultSaveDir
and
self
.
defaultSaveDir
!=
dirpath
:
self
.
saveLabelFile
()
if
not
isDelete
:
self
.
loadFilestate
(
dirpath
)
self
.
PPlabelpath
=
dirpath
+
'/Label.txt'
self
.
PPlabel
=
self
.
loadLabelFile
(
self
.
PPlabelpath
)
self
.
Cachelabelpath
=
dirpath
+
'/Cache.cach'
self
.
Cachelabel
=
self
.
loadLabelFile
(
self
.
Cachelabelpath
)
if
self
.
Cachelabel
:
self
.
PPlabel
=
dict
(
self
.
Cachelabel
,
**
self
.
PPlabel
)
self
.
init_key_list
(
self
.
PPlabel
)
self
.
lastOpenDir
=
dirpath
self
.
lastOpenDir
=
dirpath
self
.
dirname
=
dirpath
self
.
dirname
=
dirpath
...
@@ -1943,6 +1951,8 @@ class MainWindow(QMainWindow):
...
@@ -1943,6 +1951,8 @@ class MainWindow(QMainWindow):
self
.
setDirty
()
self
.
setDirty
()
self
.
saveCacheLabel
()
self
.
saveCacheLabel
()
self
.
init_key_list
(
self
.
Cachelabel
)
def
reRecognition
(
self
):
def
reRecognition
(
self
):
img
=
cv2
.
imread
(
self
.
filePath
)
img
=
cv2
.
imread
(
self
.
filePath
)
# org_box = [dic['points'] for dic in self.PPlabel[self.getImglabelidx(self.filePath)]]
# org_box = [dic['points'] for dic in self.PPlabel[self.getImglabelidx(self.filePath)]]
...
...
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