Skip to content

Commit

Permalink
rename PP-OCRv3 algorithm to SVTR_LCNet (PaddlePaddle#9025)
Browse files Browse the repository at this point in the history
* rename PP-OCRv3 algorithm to SVTR_LCNet

* rename PP-OCRv3 algorithm to SVTR_LCNet

* update multi-lang config for v3
  • Loading branch information
tink2123 committed Feb 13, 2023
1 parent 7c81d48 commit dd02918
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv3/ch_PP-OCRv3_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
4 changes: 2 additions & 2 deletions configs/rec/PP-OCRv3/ch_PP-OCRv3_rec_distillation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Architecture:
freeze_params: false
return_all_feats: true
model_type: *model_type
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand All @@ -72,7 +72,7 @@ Architecture:
freeze_params: false
return_all_feats: true
model_type: *model_type
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv3/en_PP-OCRv3_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv3/multi_language/japan_PP-OCRv3_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv3/multi_language/ka_PP-OCRv3_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv3/multi_language/latin_PP-OCRv3_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv3/multi_language/ta_PP-OCRv3_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
2 changes: 1 addition & 1 deletion configs/rec/PP-OCRv3/multi_language/te_PP-OCRv3_rec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Optimizer:

Architecture:
model_type: rec
algorithm: SVTR
algorithm: SVTR_LCNet
Transform:
Backbone:
name: MobileNetV1Enhance
Expand Down
4 changes: 2 additions & 2 deletions ppocr/modeling/architectures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def apply_to_static(model, config, logger):
return model
assert "image_shape" in config[
"Global"], "image_shape must be assigned for static training mode..."
supported_list = ["DB", "SVTR"]
supported_list = ["DB", "SVTR_LCNet"]
if config["Architecture"]["algorithm"] in ["Distillation"]:
algo = list(config["Architecture"]["Models"].values())[0]["algorithm"]
else:
Expand All @@ -52,7 +52,7 @@ def apply_to_static(model, config, logger):
[None] + config["Global"]["image_shape"], dtype='float32')
]

if algo == "SVTR":
if algo == "SVTR_LCNet":
specs.append([
InputSpec(
[None, config["Global"]["max_text_length"]],
Expand Down
3 changes: 2 additions & 1 deletion tools/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def main():

model = build_model(config['Architecture'])
extra_input_models = [
"SRN", "NRTR", "SAR", "SEED", "SVTR", "VisionLAN", "RobustScanner"
"SRN", "NRTR", "SAR", "SEED", "SVTR", "SVTR_LCNet", "VisionLAN",
"RobustScanner"
]
extra_input = False
if config['Architecture']['algorithm'] == 'Distillation':
Expand Down
20 changes: 10 additions & 10 deletions tools/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ def export_single_model(model,
shape=[None], dtype="float32")]
]
model = to_static(model, input_spec=other_shape)
elif arch_config["algorithm"] == "SVTR_LCNet":
other_shape = [
paddle.static.InputSpec(
shape=[None, 3, 48, -1], dtype="float32"),
]
model = to_static(model, input_spec=other_shape)
elif arch_config["algorithm"] == "SVTR":
if arch_config["Head"]["name"] == 'MultiHead':
other_shape = [
paddle.static.InputSpec(
shape=[None, 3, 48, -1], dtype="float32"),
]
else:
other_shape = [
paddle.static.InputSpec(
shape=[None] + input_shape, dtype="float32"),
]
other_shape = [
paddle.static.InputSpec(
shape=[None] + input_shape, dtype="float32"),
]
model = to_static(model, input_spec=other_shape)
elif arch_config["algorithm"] == "PREN":
other_shape = [
Expand Down
8 changes: 4 additions & 4 deletions tools/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def train(config,

use_srn = config['Architecture']['algorithm'] == "SRN"
extra_input_models = [
"SRN", "NRTR", "SAR", "SEED", "SVTR", "SPIN", "VisionLAN",
"SRN", "NRTR", "SAR", "SEED", "SVTR", "SVTR_LCNet", "SPIN", "VisionLAN",
"RobustScanner", "RFL", 'DRRG', 'SATRN'
]
extra_input = False
Expand Down Expand Up @@ -641,9 +641,9 @@ def preprocess(is_train=False):
'EAST', 'DB', 'SAST', 'Rosetta', 'CRNN', 'STARNet', 'RARE', 'SRN',
'CLS', 'PGNet', 'Distillation', 'NRTR', 'TableAttn', 'SAR', 'PSE',
'SEED', 'SDMGR', 'LayoutXLM', 'LayoutLM', 'LayoutLMv2', 'PREN', 'FCE',
'SVTR', 'ViTSTR', 'ABINet', 'DB++', 'TableMaster', 'SPIN', 'VisionLAN',
'Gestalt', 'SLANet', 'RobustScanner', 'CT', 'RFL', 'DRRG', 'CAN',
'Telescope', 'SATRN'
'SVTR', 'SVTR_LCNet', 'ViTSTR', 'ABINet', 'DB++', 'TableMaster', 'SPIN',
'VisionLAN', 'Gestalt', 'SLANet', 'RobustScanner', 'CT', 'RFL', 'DRRG',
'CAN', 'Telescope', 'SATRN'
]

if use_xpu:
Expand Down

0 comments on commit dd02918

Please sign in to comment.