rename PP-OCRv3 algorithm to SVTR_LCNet (#9025)
* rename PP-OCRv3 algorithm to SVTR_LCNet * rename PP-OCRv3 algorithm to SVTR_LCNet * update multi-lang config for v3pull/9068/head
parent
7c81d482e9
commit
dd02918bb4
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -36,7 +36,7 @@ Optimizer:
|
|||
|
||||
Architecture:
|
||||
model_type: rec
|
||||
algorithm: SVTR
|
||||
algorithm: SVTR_LCNet
|
||||
Transform:
|
||||
Backbone:
|
||||
name: MobileNetV1Enhance
|
||||
|
|
|
@ -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:
|
||||
|
@ -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"]],
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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
|
||||
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue