mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
Merge pull request #23746 from Abdurrahheem:ash/graph_simplifier
Assertion Fix in Split Layer #23746 ### Pull Request Readiness Checklist This PR fixes issue mentioned in [#23663](https://github.com/opencv/opencv/issues/23663) Merge with https://github.com/opencv/opencv_extra/pull/1067 See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
d3e7968927
commit
6b53fe8f7b
@ -1363,7 +1363,14 @@ void ONNXImporter::parseSplit(LayerParams& layerParams, const opencv_onnx::NodeP
|
||||
{
|
||||
DictValue splits = layerParams.get("split");
|
||||
const int numSplits = splits.size();
|
||||
CV_Assert(numSplits > 1);
|
||||
|
||||
if (numSplits == 1)
|
||||
{
|
||||
layerParams.set("num_split", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_Assert(numSplits >= 1);
|
||||
|
||||
std::vector<int> slicePoints(numSplits - 1, splits.get<int>(0));
|
||||
for (int i = 1; i < splits.size() - 1; ++i)
|
||||
@ -1372,6 +1379,7 @@ void ONNXImporter::parseSplit(LayerParams& layerParams, const opencv_onnx::NodeP
|
||||
}
|
||||
layerParams.set("slice_point", DictValue::arrayInt(&slicePoints[0], slicePoints.size()));
|
||||
}
|
||||
}
|
||||
else if (node_proto.input_size() == 2) // opset >= 13, the split will be stored at the second input, instead of the attribute.
|
||||
{
|
||||
CV_Assert(constBlobs.find(node_proto.input(1)) != constBlobs.end());
|
||||
|
@ -1146,6 +1146,7 @@ TEST_P(Test_ONNX_layers, Split)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
|
||||
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
|
||||
testONNXModels("split_0");
|
||||
testONNXModels("split_1");
|
||||
testONNXModels("split_2");
|
||||
testONNXModels("split_3");
|
||||
|
Loading…
Reference in New Issue
Block a user