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
c620b939
Commit
c620b939
authored
Aug 03, 2021
by
LDOUBLEV
Browse files
return None when no boxes found
parent
51bd3a6b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
ppocr/data/imaug/label_ops.py
ppocr/data/imaug/label_ops.py
+6
-4
No files found.
ppocr/data/imaug/label_ops.py
View file @
c620b939
...
@@ -53,9 +53,11 @@ class DetLabelEncode(object):
...
@@ -53,9 +53,11 @@ class DetLabelEncode(object):
txt_tags
.
append
(
True
)
txt_tags
.
append
(
True
)
else
:
else
:
txt_tags
.
append
(
False
)
txt_tags
.
append
(
False
)
if
len
(
boxes
)
==
0
:
return
None
boxes
=
self
.
expand_points_num
(
boxes
)
boxes
=
self
.
expand_points_num
(
boxes
)
#
boxes = np.array(boxes, dtype=np.float32)
boxes
=
np
.
array
(
boxes
,
dtype
=
np
.
float32
)
#
txt_tags = np.array(txt_tags, dtype=np.bool)
txt_tags
=
np
.
array
(
txt_tags
,
dtype
=
np
.
bool
)
data
[
'polys'
]
=
boxes
data
[
'polys'
]
=
boxes
data
[
'texts'
]
=
txts
data
[
'texts'
]
=
txts
...
@@ -387,10 +389,10 @@ class TableLabelEncode(object):
...
@@ -387,10 +389,10 @@ class TableLabelEncode(object):
character_num
=
int
(
substr
[
0
])
character_num
=
int
(
substr
[
0
])
elem_num
=
int
(
substr
[
1
])
elem_num
=
int
(
substr
[
1
])
for
cno
in
range
(
1
,
1
+
character_num
):
for
cno
in
range
(
1
,
1
+
character_num
):
character
=
lines
[
cno
].
decode
(
'utf-8'
).
strip
(
"
\r\n
"
)
character
=
lines
[
cno
].
decode
(
'utf-8'
).
strip
(
"
\r\n
"
)
list_character
.
append
(
character
)
list_character
.
append
(
character
)
for
eno
in
range
(
1
+
character_num
,
1
+
character_num
+
elem_num
):
for
eno
in
range
(
1
+
character_num
,
1
+
character_num
+
elem_num
):
elem
=
lines
[
eno
].
decode
(
'utf-8'
).
strip
(
"
\r\n
"
)
elem
=
lines
[
eno
].
decode
(
'utf-8'
).
strip
(
"
\r\n
"
)
list_elem
.
append
(
elem
)
list_elem
.
append
(
elem
)
return
list_character
,
list_elem
return
list_character
,
list_elem
...
...
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