Commit 190467b6 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #14586 from dianlujitao:master

parents a4333948 f0f50b75
...@@ -786,6 +786,11 @@ void ONNXImporter::populateNet(Net dstNet) ...@@ -786,6 +786,11 @@ void ONNXImporter::populateNet(Net dstNet)
} }
replaceLayerParam(layerParams, "mode", "interpolation"); replaceLayerParam(layerParams, "mode", "interpolation");
} }
else if (layer_type == "LogSoftmax")
{
layerParams.type = "Softmax";
layerParams.set("log_softmax", true);
}
else else
{ {
for (int j = 0; j < node_proto.input_size(); j++) { for (int j = 0; j < node_proto.input_size(); j++) {
...@@ -816,7 +821,7 @@ void ONNXImporter::populateNet(Net dstNet) ...@@ -816,7 +821,7 @@ void ONNXImporter::populateNet(Net dstNet)
CV_Assert(!layerOutShapes.empty()); CV_Assert(!layerOutShapes.empty());
outShapes[layerParams.name] = layerOutShapes[0]; outShapes[layerParams.name] = layerOutShapes[0];
} }
} }
Net readNetFromONNX(const String& onnxFile) Net readNetFromONNX(const String& onnxFile)
{ {
......
...@@ -245,6 +245,12 @@ TEST_P(Test_ONNX_layers, Reshape) ...@@ -245,6 +245,12 @@ TEST_P(Test_ONNX_layers, Reshape)
testONNXModels("unsqueeze"); testONNXModels("unsqueeze");
} }
TEST_P(Test_ONNX_layers, Softmax)
{
testONNXModels("softmax");
testONNXModels("log_softmax");
}
INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_ONNX_layers, dnnBackendsAndTargets()); INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_ONNX_layers, dnnBackendsAndTargets());
class Test_ONNX_nets : public Test_ONNX_layers {}; class Test_ONNX_nets : public Test_ONNX_layers {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment