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
93b49541
Unverified
Commit
93b49541
authored
Aug 16, 2022
by
andyjpaddle
Committed by
GitHub
Aug 16, 2022
Browse files
Merge pull request #7219 from andyjpaddle/fix_sar_cp
[CP]Fix sar export
parents
b8a98bc3
8fb1103e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
3 deletions
+6
-3
doc/doc_ch/algorithm_rec_sar.md
doc/doc_ch/algorithm_rec_sar.md
+1
-1
doc/doc_en/algorithm_rec_sar_en.md
doc/doc_en/algorithm_rec_sar_en.md
+1
-1
tools/export_model.py
tools/export_model.py
+2
-0
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+2
-1
No files found.
doc/doc_ch/algorithm_rec_sar.md
View file @
93b49541
...
@@ -79,7 +79,7 @@ python3 tools/export_model.py -c configs/rec/rec_r31_sar.yml -o Global.pretraine
...
@@ -79,7 +79,7 @@ python3 tools/export_model.py -c configs/rec/rec_r31_sar.yml -o Global.pretraine
SAR文本识别模型推理,可以执行如下命令:
SAR文本识别模型推理,可以执行如下命令:
```
```
python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_sar/" --rec_image_shape="3, 48, 48, 160"
--rec_char_type="ch"
--rec_algorithm="SAR" --rec_char_dict_path="ppocr/utils/dict90.txt" --max_text_length=30 --use_space_char=False
python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_sar/" --rec_image_shape="3, 48, 48, 160" --rec_algorithm="SAR" --rec_char_dict_path="ppocr/utils/dict90.txt" --max_text_length=30 --use_space_char=False
```
```
<a
name=
"4-2"
></a>
<a
name=
"4-2"
></a>
...
...
doc/doc_en/algorithm_rec_sar_en.md
View file @
93b49541
...
@@ -79,7 +79,7 @@ python3 tools/export_model.py -c configs/rec/rec_r31_sar.yml -o Global.pretraine
...
@@ -79,7 +79,7 @@ python3 tools/export_model.py -c configs/rec/rec_r31_sar.yml -o Global.pretraine
For SAR text recognition model inference, the following commands can be executed:
For SAR text recognition model inference, the following commands can be executed:
```
```
python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_sar/" --rec_image_shape="3, 48, 48, 160"
--rec_char_type="ch"
--rec_algorithm="SAR" --rec_char_dict_path="ppocr/utils/dict90.txt" --max_text_length=30 --use_space_char=False
python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/en/word_1.png" --rec_model_dir="./inference/rec_sar/" --rec_image_shape="3, 48, 48, 160" --rec_algorithm="SAR" --rec_char_dict_path="ppocr/utils/dict90.txt" --max_text_length=30 --use_space_char=False
```
```
<a
name=
"4-2"
></a>
<a
name=
"4-2"
></a>
...
...
tools/export_model.py
View file @
93b49541
...
@@ -58,6 +58,8 @@ def export_single_model(model,
...
@@ -58,6 +58,8 @@ def export_single_model(model,
other_shape
=
[
other_shape
=
[
paddle
.
static
.
InputSpec
(
paddle
.
static
.
InputSpec
(
shape
=
[
None
,
3
,
48
,
160
],
dtype
=
"float32"
),
shape
=
[
None
,
3
,
48
,
160
],
dtype
=
"float32"
),
[
paddle
.
static
.
InputSpec
(
shape
=
[
None
],
dtype
=
"float32"
)]
]
]
model
=
to_static
(
model
,
input_spec
=
other_shape
)
model
=
to_static
(
model
,
input_spec
=
other_shape
)
elif
arch_config
[
"algorithm"
]
==
"SVTR"
:
elif
arch_config
[
"algorithm"
]
==
"SVTR"
:
...
...
tools/infer/predict_rec.py
View file @
93b49541
...
@@ -349,7 +349,8 @@ class TextRecognizer(object):
...
@@ -349,7 +349,8 @@ class TextRecognizer(object):
valid_ratios
=
np
.
concatenate
(
valid_ratios
)
valid_ratios
=
np
.
concatenate
(
valid_ratios
)
inputs
=
[
inputs
=
[
norm_img_batch
,
norm_img_batch
,
valid_ratios
,
np
.
array
(
[
valid_ratios
],
dtype
=
np
.
float32
),
]
]
if
self
.
use_onnx
:
if
self
.
use_onnx
:
input_dict
=
{}
input_dict
=
{}
...
...
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