From 52bc8f0eaba34604b3a4ee50981714605d34d639 Mon Sep 17 00:00:00 2001 From: Liu Jiaxuan <85537209+liu-jiaxuan@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:49:23 +0800 Subject: [PATCH] fix slanext export bug (#14519) * add slanext models * refine codes * refine codes * refine codes * fix export SLANeXt * fix export bugs --- ppocr/utils/export_model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ppocr/utils/export_model.py b/ppocr/utils/export_model.py index 3f613f5a90..22a680a7cc 100644 --- a/ppocr/utils/export_model.py +++ b/ppocr/utils/export_model.py @@ -59,6 +59,10 @@ def dump_infer_config(config, path, logger): common_dynamic_shapes = { "x": [[1, 3, 32, 32], [1, 3, 64, 448], [8, 3, 488, 488]] } + elif arch_config["algorithm"] == "SLANeXt": + common_dynamic_shapes = { + "x": [[1, 3, 512, 512], [1, 3, 512, 512], [8, 3, 512, 512]] + } elif arch_config["algorithm"] == "LaTeXOCR": common_dynamic_shapes = { "x": [[1, 3, 224, 224], [1, 3, 448, 448], [8, 3, 1280, 1280]] @@ -251,7 +255,7 @@ def dynamic_to_static(model, arch_config, logger, input_shape=None): model = paddle.jit.to_static( model, input_spec=[ - paddle.static.InputSpec(shape=[-1, 1, 512, 512], dtype="float32") + paddle.static.InputSpec(shape=[-1, 3, 512, 512], dtype="float32") ], full_graph=True, )