Skip to content

Commit 427d273

Browse files
authored
[PaddleV3] 修复部分依赖 paddle.fluid 的 onnx 模型 part 2 (#1068)
* [Fix] version check * [Fix] onnx best float32 * [Fix] onnx cifarnet * [Fix] onnx circledet * [Fix] onnx crnn lstm * [Fix] onnx densenet121 * [Fix] onnx efficientnet b0 * [Fix] onnx face cyclegan 34 * [Fix] onnx facedetector * [Fix] onnx hand landmark ar * [Fix] onnx inceptionv1 * [Fix] onnx inceptionv2 * [Fix] onnx mnasnet a1 * [Fix] onnx mobilenet v2 * [Fix] onnx modelgen * [Fix] onnx pnasnet mobile * [Fix] onnx resnet101 * [Fix] onnx resnet152 * [Fix] onnx resnet18 * [Fix] onnx resnet34 * [Fix] onnx resnet50 * [Fix] onnx ronin 2d cp9 * [Fix] onnx shufflenet * [Fix] onnx squeezenet * [Fix] onnx transformer * [Fix] onnx vgg11 * [Fix] onnx vgg11 bn * [Fix] onnx vgg16 bn * [Fix] onnx vgg19 * [Fix] onnx vgg19 bn * [Fix] onnx yolov5s fix resize * [Update] black.list
1 parent 085508d commit 427d273

File tree

32 files changed

+64
-245
lines changed

32 files changed

+64
-245
lines changed

test_benchmark/ONNX/best_float32/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import paddle.fluid as fluid
21
import paddle
32
import numpy as np
43
import sys
@@ -10,11 +9,8 @@
109
exe = paddle.static.Executor(paddle.CPUPlace())
1110

1211
# test dygraph
13-
[prog, inputs, outputs] = fluid.io.load_inference_model(
14-
dirname="pd_model_dygraph/inference_model/",
15-
executor=exe,
16-
model_filename="model.pdmodel",
17-
params_filename="model.pdiparams")
12+
[prog, inputs, outputs] = paddle.static.load_inference_model(
13+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1814
data = np.load('../dataset/best_float32/input.npy')
1915
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2016

test_benchmark/ONNX/black.list

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
SwinTransformer
22
bert6
3-
best_float32
4-
cifarnet
5-
circledet
6-
crnn_lstm
7-
densenet121
8-
efficientnet_b0
9-
face_cyclegan_34
10-
facedetector
11-
hand_landmark_ar
12-
inceptionv1
13-
inceptionv2
143
mmdetection_fasterrcnn
154
mmdetection_fcos
165
mmdetection_fsaf
@@ -20,24 +9,7 @@ mmdetection_yolov3
209
mnasnet_a1
2110
mobilefacenet
2211
mobilenet_v2
23-
modelGen
24-
pnasnet_mobile
25-
resnet101
26-
resnet152
27-
resnet18
28-
resnet34
29-
resnet50
30-
ronin_2d_cp9
31-
shufflenet
32-
squeezenet
33-
transformer
34-
vgg11
35-
vgg11_bn
36-
vgg16_bn
37-
vgg19
38-
vgg19_bn
3912
yolov5s
40-
yolov5s_fix_resize
4113
dataset
4214
tools
4315
output

test_benchmark/ONNX/cifarnet/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import paddle
2-
import paddle.fluid as fluid
32
import numpy as np
43
import pickle
54
import sys
@@ -11,11 +10,8 @@
1110
exe = paddle.static.Executor(paddle.CPUPlace())
1211

1312
# test dygraph
14-
[prog, inputs, outputs] = fluid.io.load_inference_model(
15-
dirname="pd_model_dygraph/inference_model/",
16-
executor=exe,
17-
model_filename="model.pdmodel",
18-
params_filename="model.pdiparams")
13+
[prog, inputs, outputs] = paddle.static.load_inference_model(
14+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1915
data = np.load("../dataset/cifarnet/input.npy")
2016
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2117

test_benchmark/ONNX/circledet/pd_infer.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
1-
import paddle.fluid as fluid
2-
import numpy as np
3-
import sys
4-
5-
# model_name = sys.argv[1]
6-
# model_dir = sys.argv[2]
7-
8-
# f = open('result.txt', 'w')
9-
# f.write("======{}: ".format(model_name[:-1]))
10-
# try:
11-
# exe = fluid.Executor(fluid.CPUPlace())
12-
# [prog, inputs, outputs] = fluid.io.load_inference_model(dirname=model_dir, executor=exe)
13-
# data = np.load('input_0.npy')
14-
# result = exe.run(prog, feed={inputs[0]:data}, fetch_list=outputs)
15-
16-
# tf_result = np.load('result.npy')
17-
# diff = result[0] - tf_result
18-
# max_abs_diff = np.fabs(diff).max()
19-
20-
# if max_abs_diff < 1e-05:
21-
# f.write("Successed\n")
22-
# else:
23-
# relative_diff = max_abs_diff / np.fabs(tf_result).max()
24-
# if relative_diff < 1e-05:
25-
# f.write("Successed\n")
26-
# else:
27-
# f.write("!!!!!Failed\n")
28-
# except:
29-
# f.write("!!!!!Failed\n")
30-
# raise
31-
32-
import paddle.fluid as fluid
331
import paddle
342
import numpy as np
353
import sys
@@ -41,11 +9,8 @@
419
exe = paddle.static.Executor(paddle.CPUPlace())
4210

4311
# test dygraph
44-
[prog, inputs, outputs] = fluid.io.load_inference_model(
45-
dirname="pd_model_dygraph/inference_model/",
46-
executor=exe,
47-
model_filename="model.pdmodel",
48-
params_filename="model.pdiparams")
12+
[prog, inputs, outputs] = paddle.static.load_inference_model(
13+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
4914
data = np.load('../dataset/circledet/input_0.npy')
5015
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
5116

test_benchmark/ONNX/crnn_lstm/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import paddle
2-
import paddle.fluid as fluid
32
import numpy as np
43
import pickle
54
import sys
@@ -11,11 +10,8 @@
1110
exe = paddle.static.Executor(paddle.CPUPlace())
1211

1312
# test dygraph
14-
[prog, inputs, outputs] = fluid.io.load_inference_model(
15-
dirname="pd_model_dygraph/inference_model/",
16-
executor=exe,
17-
model_filename="model.pdmodel",
18-
params_filename="model.pdiparams")
13+
[prog, inputs, outputs] = paddle.static.load_inference_model(
14+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1915
data = np.load("../dataset/crnn_lstm/input.npy")
2016
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2117

test_benchmark/ONNX/densenet121/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import paddle.fluid as fluid
21
import paddle
32
import numpy as np
43
import sys
@@ -10,11 +9,8 @@
109
exe = paddle.static.Executor(paddle.CPUPlace())
1110

1211
# test dygraph
13-
[prog, inputs, outputs] = fluid.io.load_inference_model(
14-
dirname="pd_model_dygraph/inference_model/",
15-
executor=exe,
16-
model_filename="model.pdmodel",
17-
params_filename="model.pdiparams")
12+
[prog, inputs, outputs] = paddle.static.load_inference_model(
13+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1814
data = np.load('../dataset/densenet121/input_0.npy')
1915
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2016
paddle.disable_static()

test_benchmark/ONNX/efficientnet_b0/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import paddle.fluid as fluid
21
import paddle
32
import numpy as np
43
import sys
@@ -10,11 +9,8 @@
109
exe = paddle.static.Executor(paddle.CPUPlace())
1110

1211
# test dygraph
13-
[prog, inputs, outputs] = fluid.io.load_inference_model(
14-
dirname="pd_model_dygraph/inference_model/",
15-
executor=exe,
16-
model_filename="model.pdmodel",
17-
params_filename="model.pdiparams")
12+
[prog, inputs, outputs] = paddle.static.load_inference_model(
13+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1814
data = np.load('../dataset/efficientnet_b0/input_0.npy')
1915
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2016

test_benchmark/ONNX/face_cyclegan_34/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import paddle.fluid as fluid
21
import paddle
32
import numpy as np
43
import sys
@@ -10,11 +9,8 @@
109
exe = paddle.static.Executor(paddle.CPUPlace())
1110

1211
# test dygraph
13-
[prog, inputs, outputs] = fluid.io.load_inference_model(
14-
dirname="pd_model_dygraph/inference_model/",
15-
executor=exe,
16-
model_filename="model.pdmodel",
17-
params_filename="model.pdiparams")
12+
[prog, inputs, outputs] = paddle.static.load_inference_model(
13+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1814
data = np.load('../dataset/face_cyclegan_34/input_0.npy')
1915
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2016

test_benchmark/ONNX/facedetector/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import paddle
2-
import paddle.fluid as fluid
32
import numpy as np
43
import pickle
54
import sys
@@ -11,11 +10,8 @@
1110
exe = paddle.static.Executor(paddle.CPUPlace())
1211

1312
# test dygraph
14-
[prog, inputs, outputs] = fluid.io.load_inference_model(
15-
dirname="pd_model_dygraph/inference_model/",
16-
executor=exe,
17-
model_filename="model.pdmodel",
18-
params_filename="model.pdiparams")
13+
[prog, inputs, outputs] = paddle.static.load_inference_model(
14+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1915
data = np.load('../dataset/facedetector/input.npy')
2016
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2117

test_benchmark/ONNX/hand_landmark_ar/pd_infer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import paddle
2-
import paddle.fluid as fluid
32
import numpy as np
43
import pickle
54
import sys
@@ -10,11 +9,8 @@
109
paddle.enable_static()
1110
exe = paddle.static.Executor(paddle.CPUPlace())
1211
# test Dygraph
13-
[prog, inputs, outputs] = fluid.io.load_inference_model(
14-
dirname="pd_model_dygraph/inference_model/",
15-
executor=exe,
16-
model_filename="model.pdmodel",
17-
params_filename="model.pdiparams")
12+
[prog, inputs, outputs] = paddle.static.load_inference_model(
13+
path_prefix="pd_model_dygraph/inference_model/model", executor=exe)
1814
data = np.load("../dataset/hand_landmark_ar/input.npy")
1915
result = exe.run(prog, feed={inputs[0]: data}, fetch_list=outputs)
2016

0 commit comments

Comments
 (0)