Skip to content

Commit

Permalink
PLT update, add Ocr model case (#2937)
Browse files Browse the repository at this point in the history
* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* add plt export, test=model

* fix plt start, test=model

* fix plt start, test=model

* fix plt start, test=model

* fix plt start, test=model

* fix plt perf, test=model

* add plt bm ignore, test=model

* update plt start.sh, test=model

* update plt start.sh, test=model

* add inputspec plt ci, test=model

* add inputspec plt ci, test=model

* update plt ci, test=model

* update plt ci, test=model

* update plt ci, test=model

* update plt ci, test=model

* update plt ci, test=model

* update plt gsb, test=model

* fix plt statistic, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* plt update net instance, test=model

* fix plt tools, test=model

* update ply add model case, test=model

* update ply add model case, test=model

* update ply add model case, test=model
  • Loading branch information
Zeref996 authored Sep 11, 2024
1 parent ecd9016 commit 3e8e85f
Show file tree
Hide file tree
Showing 80 changed files with 2,230 additions and 2 deletions.
4 changes: 4 additions & 0 deletions framework/e2e/PaddleLT_new/generator/builder_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions framework/e2e/PaddleLT_new/generator/builder_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions framework/e2e/PaddleLT_new/layerModelcase/Ocr_cases/__init__.py
Original file line number Diff line number Diff line change
@@ -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(), [])
Original file line number Diff line number Diff line change
@@ -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(), [])
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 3e8e85f

Please sign in to comment.