Skip to content

Commit a2e293c

Browse files
authored
Merge pull request #1349 from omrope79:wechat-fix-layers
Adds ONNX test models and data for PriorBox and Nearest wechat-fix-layers models #1349 Merge with PR : opencv/opencv#28855 This PR is part 1 of the split from the original PR: Added WeChatQR-fix ONNX models #1329 It adds the required ONNX models and input/output data
1 parent ab6b19c commit a2e293c

6 files changed

Lines changed: 29 additions & 3 deletions

File tree

152 Bytes
Binary file not shown.
224 Bytes
Binary file not shown.
3.13 KB
Binary file not shown.

testdata/dnn/onnx/generate_onnx_models.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,9 +2989,9 @@ def generate_gemm_dynmaic_inputs(name, inputA, inputB, inputC, path_data, path_m
29892989

29902990
for name, inputs in gemm_dynamic_inputs_testcases.items():
29912991
generate_gemm_dynmaic_inputs(
2992-
f"test_gemm_3inputs_{name}",
2993-
inputs["inputA"],
2994-
inputs["inputB"],
2992+
f"test_gemm_3inputs_{name}",
2993+
inputs["inputA"],
2994+
inputs["inputB"],
29952995
inputs["inputC"],
29962996
"data",
29972997
"models"
@@ -3402,3 +3402,29 @@ def forward(self, x):
34023402

34033403
x = torch.randint(1000000000000000, 1000000000000200, (3, 4, 5, 6), dtype=torch.int64)
34043404
save_data_and_model("tile_int64", x, Tile((1, 1, 1, 2)), version=18)
3405+
3406+
################# PriorBox #################
3407+
3408+
data = helper.make_tensor_value_info("input_0", TensorProto.FLOAT, [1, 3, 10, 10])
3409+
shape = helper.make_tensor_value_info("input_1", TensorProto.FLOAT, [1, 2, 3, 4])
3410+
out = helper.make_tensor_value_info("out", TensorProto.FLOAT, ["d0", "d1", "d2"])
3411+
node = helper.make_node("PriorBox", ["input_1", "input_0"], ["out"],
3412+
min_size=[2.0, 3.0],
3413+
max_size=[6.0, 7.0],
3414+
aspect_ratio=[2.0],
3415+
flip=1, clip=0,
3416+
variance=[0.1, 0.1, 0.2, 0.2])
3417+
graph = helper.make_graph([node], "prior_box", [data, shape], [out])
3418+
onnx.save(helper.make_model(graph, producer_name="prior_box"),
3419+
os.path.join("models", "prior_box.onnx"))
3420+
3421+
################# Resize Nearest #################
3422+
3423+
inp = helper.make_tensor_value_info("input", TensorProto.FLOAT, [1, 1, 2, 3])
3424+
out = helper.make_tensor_value_info("out", TensorProto.FLOAT, [1, 1, 4, 6])
3425+
roi = numpy_helper.from_array(np.array([], dtype=np.float32), name="roi")
3426+
scales = numpy_helper.from_array(np.array([1.0, 1.0, 2.0, 2.0], dtype=np.float32), name="scales")
3427+
node = helper.make_node("Resize", ["input", "roi", "scales"], ["out"], mode="nearest")
3428+
graph = helper.make_graph([node], "Resample", [inp], [out], initializer=[roi, scales])
3429+
onnx.save(helper.make_model(graph, producer_name="nearest"),
3430+
os.path.join("models", "nearest.onnx"))
192 Bytes
Binary file not shown.
305 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)