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
a0fd1a48
Commit
a0fd1a48
authored
Mar 12, 2021
by
WenmuZhou
Browse files
fix srn infer error when use custom max_text_length
parent
f687e092
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+4
-2
No files found.
tools/infer/predict_rec.py
View file @
a0fd1a48
...
@@ -41,6 +41,7 @@ class TextRecognizer(object):
...
@@ -41,6 +41,7 @@ class TextRecognizer(object):
self
.
character_type
=
args
.
rec_char_type
self
.
character_type
=
args
.
rec_char_type
self
.
rec_batch_num
=
args
.
rec_batch_num
self
.
rec_batch_num
=
args
.
rec_batch_num
self
.
rec_algorithm
=
args
.
rec_algorithm
self
.
rec_algorithm
=
args
.
rec_algorithm
self
.
max_text_length
=
args
.
max_text_length
postprocess_params
=
{
postprocess_params
=
{
'name'
:
'CTCLabelDecode'
,
'name'
:
'CTCLabelDecode'
,
"character_type"
:
args
.
rec_char_type
,
"character_type"
:
args
.
rec_char_type
,
...
@@ -186,8 +187,9 @@ class TextRecognizer(object):
...
@@ -186,8 +187,9 @@ class TextRecognizer(object):
norm_img
=
norm_img
[
np
.
newaxis
,
:]
norm_img
=
norm_img
[
np
.
newaxis
,
:]
norm_img_batch
.
append
(
norm_img
)
norm_img_batch
.
append
(
norm_img
)
else
:
else
:
norm_img
=
self
.
process_image_srn
(
norm_img
=
self
.
process_image_srn
(
img_list
[
indices
[
ino
]],
img_list
[
indices
[
ino
]],
self
.
rec_image_shape
,
8
,
25
)
self
.
rec_image_shape
,
8
,
self
.
max_text_length
)
encoder_word_pos_list
=
[]
encoder_word_pos_list
=
[]
gsrm_word_pos_list
=
[]
gsrm_word_pos_list
=
[]
gsrm_slf_attn_bias1_list
=
[]
gsrm_slf_attn_bias1_list
=
[]
...
...
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