diff --git a/framework/e2e/PaddleLT_new/generator/builder_data.py b/framework/e2e/PaddleLT_new/generator/builder_data.py index 2b6b07d4d5..7ff653b9c7 100644 --- a/framework/e2e/PaddleLT_new/generator/builder_data.py +++ b/framework/e2e/PaddleLT_new/generator/builder_data.py @@ -14,6 +14,10 @@ import diy import layerApicase import layercase + + if os.environ.get("USE_PADDLE_MODEL", "None") == "PaddleOCR": + import layerModelcase + import PaddleOCR elif os.environ.get("FRAMEWORK") == "torch": import torch import layerTorchcase diff --git a/framework/e2e/PaddleLT_new/generator/builder_layer.py b/framework/e2e/PaddleLT_new/generator/builder_layer.py index e88f9d4928..6f7f433950 100644 --- a/framework/e2e/PaddleLT_new/generator/builder_layer.py +++ b/framework/e2e/PaddleLT_new/generator/builder_layer.py @@ -12,6 +12,10 @@ import diy import layerApicase import layercase + + if os.environ.get("USE_PADDLE_MODEL", "None") == "PaddleOCR": + import layerModelcase + import PaddleOCR elif os.environ.get("FRAMEWORK") == "torch": import torch import layerTorchcase diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/__init__.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/__init__.py new file mode 100644 index 0000000000..69b02bce2c --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/__init__.py @@ -0,0 +1,18 @@ +import os +import glob + +# 获取当前文件所在目录 +current_dir = os.path.dirname(__file__) + +# 获取当前目录下所有的文件夹路径(注意:这里不需要尾随的斜杠) +folders = glob.glob(os.path.join(current_dir, '*')) + +# 过滤出文件夹(排除文件) +folders = [folder for folder in folders if os.path.isdir(folder) and not os.path.basename(folder) == '__pycache__'] + +# 动态导入所有 .py 文件 +for folder in folders: + # 获取文件名(不含扩展名) + module_name = os.path.basename(folder) + # 导入模块 + __import__('layerModelcase.Ocr_cases.' + module_name, globals(), locals(), []) diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/__init__.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/__init__.py new file mode 100644 index 0000000000..b808ebae28 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/__init__.py @@ -0,0 +1,15 @@ +import os +import glob + +# 获取当前文件所在目录 +current_dir = os.path.dirname(__file__) + +# 获取当前目录下所有的 .py 文件路径 +py_files = glob.glob(os.path.join(current_dir, "*.py")) + +# 动态导入所有 .py 文件 +for py_file in py_files: + # 获取文件名(不含扩展名) + module_name = os.path.basename(py_file)[:-3] + # 导入模块 + __import__('layerModelcase.Ocr_cases.backbones.' + module_name, globals(), locals(), []) diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_DenseNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_DenseNet.py new file mode 100644 index 0000000000..d6f359eecf --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_DenseNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "DenseNet"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_EfficientNetb3_PREN.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_EfficientNetb3_PREN.py new file mode 100644 index 0000000000..3e15057cec --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_EfficientNetb3_PREN.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "EfficientNetb3_PREN"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_HybridTransformer.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_HybridTransformer.py new file mode 100644 index 0000000000..de41d0c753 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_HybridTransformer.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "HybridTransformer"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MTB.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MTB.py new file mode 100644 index 0000000000..f35c86af82 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MTB.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MTB"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MicroNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MicroNet.py new file mode 100644 index 0000000000..8f3320860e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MicroNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MicroNet"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MobileNetV1Enhance.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MobileNetV1Enhance.py new file mode 100644 index 0000000000..4a89849a4e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MobileNetV1Enhance.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MobileNetV3.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MobileNetV3.py new file mode 100644 index 0000000000..4a89849a4e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_MobileNetV3.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_PPHGNet_small.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_PPHGNet_small.py new file mode 100644 index 0000000000..9a8084940a --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_PPHGNet_small.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPHGNet_small"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_PPLCNetV3.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_PPLCNetV3.py new file mode 100644 index 0000000000..175207e085 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_PPLCNetV3.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPLCNetV3"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_RepSVTR.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_RepSVTR.py new file mode 100644 index 0000000000..bb796bdff0 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_RepSVTR.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "RepSVTR"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet.py new file mode 100644 index 0000000000..acafcbd74e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet31.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet31.py new file mode 100644 index 0000000000..b8b3a35e94 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet31.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet31"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet32.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet32.py new file mode 100644 index 0000000000..11281bfc38 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet32.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet32"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet45.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet45.py new file mode 100644 index 0000000000..bef6dc1755 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet45.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet45"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetFPN.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetFPN.py new file mode 100644 index 0000000000..0c63766067 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetFPN.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNetFPN"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetRFL.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetRFL.py new file mode 100644 index 0000000000..75aea21d57 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetRFL.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNetRFL"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetV2.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetV2.py new file mode 100644 index 0000000000..99ac1aaa61 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNetV2.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNetV2"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet_ASTER.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet_ASTER.py new file mode 100644 index 0000000000..c55f8428ef --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ResNet_ASTER.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet_ASTER"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_SVTRNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_SVTRNet.py new file mode 100644 index 0000000000..b32fb22234 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_SVTRNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "SVTRNet"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_SVTRv2.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_SVTRv2.py new file mode 100644 index 0000000000..1b71420696 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_SVTRv2.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "SVTRv2"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ShallowCNN.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ShallowCNN.py new file mode 100644 index 0000000000..b64fca331b --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ShallowCNN.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ShallowCNN"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViT.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViT.py new file mode 100644 index 0000000000..5d34e4dc72 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViT.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ViT"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViTParseQ.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViTParseQ.py new file mode 100644 index 0000000000..3f2d02403e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViTParseQ.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ViTParseQ"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViTSTR.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViTSTR.py new file mode 100644 index 0000000000..10f683e38e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/cls_ViTSTR.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ViTSTR"}, model_type="cls") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_MobileNetV3.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_MobileNetV3.py new file mode 100644 index 0000000000..c365aa2a7e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_MobileNetV3.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPHGNet_small.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPHGNet_small.py new file mode 100644 index 0000000000..782829d6ea --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPHGNet_small.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPHGNet_small"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPLCNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPLCNet.py new file mode 100644 index 0000000000..47c2431053 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPLCNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPLCNetV3"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPLCNetV2_base.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPLCNetV2_base.py new file mode 100644 index 0000000000..f03809c9a8 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_PPLCNetV2_base.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPLCNetV2_base"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_RepSVTR_det.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_RepSVTR_det.py new file mode 100644 index 0000000000..ec90e54b39 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_RepSVTR_det.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "RepSVTR_det"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet.py new file mode 100644 index 0000000000..b8f1c40b90 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet_SAST.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet_SAST.py new file mode 100644 index 0000000000..5033578148 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet_SAST.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet_SAST"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet_vd.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet_vd.py new file mode 100644 index 0000000000..663fdea835 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/det_ResNet_vd.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet_vd"}, model_type="det") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/e2e_ResNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/e2e_ResNet.py new file mode 100644 index 0000000000..ce69033ffd --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/e2e_ResNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet"}, model_type="e2e") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_Kie_backbone.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_Kie_backbone.py new file mode 100644 index 0000000000..8fd00574dc --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_Kie_backbone.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "Kie_backbone"}, model_type="kie") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMForSer.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMForSer.py new file mode 100644 index 0000000000..7d8b0dc61e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMForSer.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "LayoutLMForSer"}, model_type="kie") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMv2ForRe.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMv2ForRe.py new file mode 100644 index 0000000000..8e3ac41317 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMv2ForRe.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "LayoutLMv2ForRe"}, model_type="kie") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMv2ForSer.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMv2ForSer.py new file mode 100644 index 0000000000..5732a753a5 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutLMv2ForSer.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "LayoutLMv2ForSer"}, model_type="kie") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutXLMForRe.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutXLMForRe.py new file mode 100644 index 0000000000..81b4001dfb --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutXLMForRe.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "LayoutXLMForRe"}, model_type="kie") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutXLMForSer.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutXLMForSer.py new file mode 100644 index 0000000000..406e8a7759 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/kie_LayoutXLMForSer.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "LayoutXLMForSer"}, model_type="kie") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_DenseNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_DenseNet.py new file mode 100644 index 0000000000..23745e9189 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_DenseNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "DenseNet"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_EfficientNetb3_PREN.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_EfficientNetb3_PREN.py new file mode 100644 index 0000000000..bb68211a61 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_EfficientNetb3_PREN.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "EfficientNetb3_PREN"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_HybridTransformer.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_HybridTransformer.py new file mode 100644 index 0000000000..14ba0e32e2 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_HybridTransformer.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "HybridTransformer"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MTB.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MTB.py new file mode 100644 index 0000000000..301b25e620 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MTB.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MTB"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MicroNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MicroNet.py new file mode 100644 index 0000000000..490e8b92ec --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MicroNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MicroNet"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MobileNetV1Enhance.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MobileNetV1Enhance.py new file mode 100644 index 0000000000..9efaaf477b --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MobileNetV1Enhance.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MobileNetV3.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MobileNetV3.py new file mode 100644 index 0000000000..9efaaf477b --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_MobileNetV3.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_PPHGNet_small.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_PPHGNet_small.py new file mode 100644 index 0000000000..4cdf7f6fde --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_PPHGNet_small.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPHGNet_small"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_PPLCNetV3.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_PPLCNetV3.py new file mode 100644 index 0000000000..a29933e5ad --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_PPLCNetV3.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPLCNetV3"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_RepSVTR.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_RepSVTR.py new file mode 100644 index 0000000000..de944eb1b4 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_RepSVTR.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "RepSVTR"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet.py new file mode 100644 index 0000000000..cfbe3bd02e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet31.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet31.py new file mode 100644 index 0000000000..eb36bae841 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet31.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet31"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet32.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet32.py new file mode 100644 index 0000000000..33b8a07d0b --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet32.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet32"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet45.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet45.py new file mode 100644 index 0000000000..159012747d --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet45.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet45"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetFPN.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetFPN.py new file mode 100644 index 0000000000..a263475694 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetFPN.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNetFPN"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetRFL.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetRFL.py new file mode 100644 index 0000000000..fed80286ff --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetRFL.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNetRFL"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetV2.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetV2.py new file mode 100644 index 0000000000..bf5be0f96e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNetV2.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNetV2"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet_ASTER.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet_ASTER.py new file mode 100644 index 0000000000..caf4551b06 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ResNet_ASTER.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet_ASTER"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_SVTRNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_SVTRNet.py new file mode 100644 index 0000000000..c188baa146 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_SVTRNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "SVTRNet"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_SVTRv2.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_SVTRv2.py new file mode 100644 index 0000000000..0db6f9e350 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_SVTRv2.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "SVTRv2"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ShallowCNN.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ShallowCNN.py new file mode 100644 index 0000000000..4d91badef0 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ShallowCNN.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ShallowCNN"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViT.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViT.py new file mode 100644 index 0000000000..994844c856 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViT.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ViT"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViTParseQ.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViTParseQ.py new file mode 100644 index 0000000000..8f86299b44 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViTParseQ.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ViTParseQ"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViTSTR.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViTSTR.py new file mode 100644 index 0000000000..d92f5a375e --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/rec_ViTSTR.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ViTSTR"}, model_type="rec") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_MobileNetV3.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_MobileNetV3.py new file mode 100644 index 0000000000..dade226dd1 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_MobileNetV3.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPHGNet_small.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPHGNet_small.py new file mode 100644 index 0000000000..f5c6fce8a7 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPHGNet_small.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPHGNet_small"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPLCNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPLCNet.py new file mode 100644 index 0000000000..5f5e9fe396 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPLCNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPLCNetV3"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPLCNetV2_base.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPLCNetV2_base.py new file mode 100644 index 0000000000..0a3d990147 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_PPLCNetV2_base.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "PPLCNetV2_base"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_RepSVTR_det.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_RepSVTR_det.py new file mode 100644 index 0000000000..6f612bfbbd --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_RepSVTR_det.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "RepSVTR_det"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet.py new file mode 100644 index 0000000000..eba5387321 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet_SAST.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet_SAST.py new file mode 100644 index 0000000000..c0b36a9645 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet_SAST.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet_SAST"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet_vd.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet_vd.py new file mode 100644 index 0000000000..948c335d75 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_ResNet_vd.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "ResNet_vd"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_TableResNetExtra.py b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_TableResNetExtra.py new file mode 100644 index 0000000000..9e9a5efeb4 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/backbones/table_TableResNetExtra.py @@ -0,0 +1,30 @@ +import paddle +import numpy as np +import PaddleOCR.ppocr.modeling.backbones as backbones + + +def LayerCase(): + """模型库中间态""" + model = backbones.build_backbone(config={"name": "TableResNetExtra"}, model_type="table") + return model + + + +def create_inputspec(): + inputspec = ( + paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False), + ) + return inputspec + +def create_tensor_inputs(): + inputs = ( + paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32), + ) + return inputs + + +def create_numpy_inputs(): + inputs = ( + np.random.random(size=[1, 3, 224, 224]).astype('float32'), + ) + return inputs diff --git a/framework/e2e/PaddleLT_new/layerModelcase/__init__.py b/framework/e2e/PaddleLT_new/layerModelcase/__init__.py new file mode 100644 index 0000000000..9c91080db4 --- /dev/null +++ b/framework/e2e/PaddleLT_new/layerModelcase/__init__.py @@ -0,0 +1,18 @@ +import os +import glob + +# 获取当前文件所在目录 +current_dir = os.path.dirname(__file__) + +# 获取当前目录下所有的文件夹路径(注意:这里不需要尾随的斜杠) +folders = glob.glob(os.path.join(current_dir, '*')) + +# 过滤出文件夹(排除文件) +folders = [folder for folder in folders if os.path.isdir(folder) and not os.path.basename(folder) == '__pycache__'] + +# 动态导入所有 .py 文件 +for folder in folders: + # 获取文件名(不含扩展名) + module_name = os.path.basename(folder) + # 导入模块 + __import__('layerModelcase.' + module_name, globals(), locals(), []) diff --git a/framework/e2e/PaddleLT_new/layertest.py b/framework/e2e/PaddleLT_new/layertest.py index 5920f90af7..2053d74c1a 100644 --- a/framework/e2e/PaddleLT_new/layertest.py +++ b/framework/e2e/PaddleLT_new/layertest.py @@ -246,8 +246,8 @@ def _perf_unit_case_run(self, plt_exc): if __name__ == "__main__": # # 精度调试逻辑 - # layerfile = "./layerTorchcase/demo/SIR_101.py" - # testing = "yaml/dy_eval.yml" + # layerfile = "./layerModelcase/Ocr_cases/backbones/rec_MobileNetV3.py" + # testing = "yaml/dy^dy_train^export_st_inputspec^ppinfer_new_exc_pir.yml" # single_test = LayerTest(title="lzy_naive", layerfile=layerfile, testing=testing) # single_test._case_run() diff --git a/framework/e2e/PaddleLT_new/run.py b/framework/e2e/PaddleLT_new/run.py index 930fcc5dd8..7118522127 100644 --- a/framework/e2e/PaddleLT_new/run.py +++ b/framework/e2e/PaddleLT_new/run.py @@ -68,6 +68,14 @@ def __init__(self): self.logger.get_log().info(f"Paddle框架commit: {paddle.__git_commit__}, 版本: {paddle.__version__}") + if os.environ.get("USE_PADDLE_MODEL", "None") == "PaddleOCR": + os.system( + "wget -q https://xly-devops.bj.bcebos.com/PaddleTest/PaddleOCR/PaddleOCR.tar.gz --no-proxy " + "&& tar -xzf PaddleOCR.tar.gz && rm -rf PaddleOCR.tar.gz " + "&& cd PaddleOCR && git rev-parse HEAD && git branch " + f"&& {self.py_cmd} -m pip install -r requirements.txt && {self.py_cmd} setup.py install" + ) + # 下载ground truth用于跨硬件测试 plt_gt_download_url = os.environ.get("PLT_GT_DOWNLOAD_URL") if not plt_gt_download_url == "None" and os.environ.get("TESTING_MODE") == "precision": diff --git a/framework/e2e/PaddleLT_new/scene/set_pts_env.sh b/framework/e2e/PaddleLT_new/scene/set_pts_env.sh index fe4938db27..4372e638d3 100644 --- a/framework/e2e/PaddleLT_new/scene/set_pts_env.sh +++ b/framework/e2e/PaddleLT_new/scene/set_pts_env.sh @@ -9,6 +9,7 @@ export PLT_SET_DEVICE="${PLT_SET_DEVICE:-gpu}" export PLT_DEVICE_ID="${PLT_DEVICE_ID:-6}" export CUDA_VISIBLE_DEVICES="${PLT_DEVICE_ID:-6}" export FRAMEWORK="${FRAMEWORK:-paddle}" +export USE_PADDLE_MODEL="${USE_PADDLE_MODEL:-None}" # 设定是否使用paddle模型库, 可选PaddleOCR export MULTI_WORKER="${MULTI_WORKER:-0}" export MULTI_DOUBLE_CHECK="${MULTI_DOUBLE_CHECK:-True}"