Skip to content

Commit 3e8e85f

Browse files
authored
PLT update, add Ocr model case (#2937)
* 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
1 parent ecd9016 commit 3e8e85f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2230
-2
lines changed

framework/e2e/PaddleLT_new/generator/builder_data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
import diy
1515
import layerApicase
1616
import layercase
17+
18+
if os.environ.get("USE_PADDLE_MODEL", "None") == "PaddleOCR":
19+
import layerModelcase
20+
import PaddleOCR
1721
elif os.environ.get("FRAMEWORK") == "torch":
1822
import torch
1923
import layerTorchcase

framework/e2e/PaddleLT_new/generator/builder_layer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
import diy
1313
import layerApicase
1414
import layercase
15+
16+
if os.environ.get("USE_PADDLE_MODEL", "None") == "PaddleOCR":
17+
import layerModelcase
18+
import PaddleOCR
1519
elif os.environ.get("FRAMEWORK") == "torch":
1620
import torch
1721
import layerTorchcase
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
import glob
3+
4+
# 获取当前文件所在目录
5+
current_dir = os.path.dirname(__file__)
6+
7+
# 获取当前目录下所有的文件夹路径(注意:这里不需要尾随的斜杠)
8+
folders = glob.glob(os.path.join(current_dir, '*'))
9+
10+
# 过滤出文件夹(排除文件)
11+
folders = [folder for folder in folders if os.path.isdir(folder) and not os.path.basename(folder) == '__pycache__']
12+
13+
# 动态导入所有 .py 文件
14+
for folder in folders:
15+
# 获取文件名(不含扩展名)
16+
module_name = os.path.basename(folder)
17+
# 导入模块
18+
__import__('layerModelcase.Ocr_cases.' + module_name, globals(), locals(), [])
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
import glob
3+
4+
# 获取当前文件所在目录
5+
current_dir = os.path.dirname(__file__)
6+
7+
# 获取当前目录下所有的 .py 文件路径
8+
py_files = glob.glob(os.path.join(current_dir, "*.py"))
9+
10+
# 动态导入所有 .py 文件
11+
for py_file in py_files:
12+
# 获取文件名(不含扩展名)
13+
module_name = os.path.basename(py_file)[:-3]
14+
# 导入模块
15+
__import__('layerModelcase.Ocr_cases.backbones.' + module_name, globals(), locals(), [])
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "DenseNet"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "EfficientNetb3_PREN"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "HybridTransformer"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "MTB"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "MicroNet"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "MobileNetV3"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "PPHGNet_small"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "PPLCNetV3"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "RepSVTR"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import paddle
2+
import numpy as np
3+
import PaddleOCR.ppocr.modeling.backbones as backbones
4+
5+
6+
def LayerCase():
7+
"""模型库中间态"""
8+
model = backbones.build_backbone(config={"name": "ResNet"}, model_type="cls")
9+
return model
10+
11+
12+
13+
def create_inputspec():
14+
inputspec = (
15+
paddle.static.InputSpec(shape=(-1, 3, 224, 224), dtype=paddle.float32, stop_gradient=False),
16+
)
17+
return inputspec
18+
19+
def create_tensor_inputs():
20+
inputs = (
21+
paddle.rand(shape=[1, 3, 224, 224], dtype=paddle.float32),
22+
)
23+
return inputs
24+
25+
26+
def create_numpy_inputs():
27+
inputs = (
28+
np.random.random(size=[1, 3, 224, 224]).astype('float32'),
29+
)
30+
return inputs

0 commit comments

Comments
 (0)