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
fa8a0e38
Commit
fa8a0e38
authored
Feb 24, 2021
by
WenmuZhou
Browse files
Add hint
parent
3ce97f18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
paddleocr.py
paddleocr.py
+13
-1
No files found.
paddleocr.py
View file @
fa8a0e38
...
...
@@ -282,8 +282,13 @@ class PaddleOCR(predict_system.TextSystem):
if
isinstance
(
img
,
list
)
and
det
==
True
:
logger
.
error
(
'When input a list of images, det must be false'
)
exit
(
0
)
if
cls
==
False
:
self
.
use_angle_cls
=
False
elif
cls
==
True
and
self
.
use_angle_cls
==
False
:
logger
.
warning
(
'Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process'
)
self
.
use_angle_cls
=
cls
if
isinstance
(
img
,
str
):
# download net image
if
img
.
startswith
(
'http'
):
...
...
@@ -301,6 +306,7 @@ class PaddleOCR(predict_system.TextSystem):
if
isinstance
(
img
,
np
.
ndarray
)
and
len
(
img
.
shape
)
==
2
:
img
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_GRAY2BGR
)
if
det
and
rec
:
dt_boxes
,
rec_res
=
self
.
__call__
(
img
)
return
[[
box
.
tolist
(),
res
]
for
box
,
res
in
zip
(
dt_boxes
,
rec_res
)]
elif
det
and
not
rec
:
...
...
@@ -342,3 +348,9 @@ def main():
if
result
is
not
None
:
for
line
in
result
:
logger
.
info
(
line
)
if
__name__
==
'__main__'
:
ocr
=
PaddleOCR
(
use_angle_cls
=
False
)
r
=
ocr
.
ocr
(
'doc/imgs/1.jpg'
)
print
(
r
)
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