提交 50811e04 编写于 作者: L Lubov Batanina 提交者: Alexander Alekhin

Merge pull request #12596 from l-bat:l-bat/shufflenet_onnx

* Add Shufflenet support in ONNX

* Add test for transpose layer
上级 44982628
......@@ -132,8 +132,6 @@ public:
for (size_t i = 0; i < inputs.size(); i++)
{
CV_Assert(inputs[i].size() == 4);
CV_Assert(inputs[i][2] == shapeBefore[2] && inputs[i][3] == shapeBefore[3]);
CV_Assert(total(inputs[i]) == total(shapeAfter));
outputs.push_back(shapeAfter);
}
......
......@@ -486,6 +486,11 @@ void ONNXImporter::populateNet(Net dstNet)
layerParams.set("num_output", layerParams.blobs[0].size[0]);
layerParams.set("bias_term", node_proto.input_size() == 3);
}
else if (layer_type == "Transpose")
{
layerParams.type = "Permute";
replaceLayerParam(layerParams, "perm", "order");
}
else if (layer_type == "Unsqueeze")
{
CV_Assert(node_proto.input_size() == 1);
......
......@@ -108,6 +108,14 @@ TEST_P(Test_ONNX_layers, BatchNormalization)
testONNXModels("batch_norm");
}
TEST_P(Test_ONNX_layers, Transpose)
{
if (backend == DNN_BACKEND_INFERENCE_ENGINE &&
(target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_OPENCL || target == DNN_TARGET_MYRIAD))
throw SkipTestException("");
testONNXModels("transpose");
}
TEST_P(Test_ONNX_layers, Multiplication)
{
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16 ||
......@@ -351,6 +359,14 @@ TEST_P(Test_ONNX_nets, Inception_v1)
testONNXModels("inception_v1", pb);
}
TEST_P(Test_ONNX_nets, Shufflenet)
{
if (backend == DNN_BACKEND_INFERENCE_ENGINE &&
(target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_OPENCL || target == DNN_TARGET_MYRIAD))
throw SkipTestException("");
testONNXModels("shufflenet", pb);
}
INSTANTIATE_TEST_CASE_P(/**/, Test_ONNX_nets, dnnBackendsAndTargets());
}} // namespace
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册