Skip to content

Supported ONNX Squeeze, ReduceL2 and Eltwise::DIV - #15811

Merged
alalek merged 6 commits into
opencv:3.4from
l-bat:eltwise_div
Nov 9, 2019
Merged

alalek merged 6 commits into
opencv:3.4from
l-bat:eltwise_div

Conversation

@l-bat

@l-bat l-bat commented Oct 30, 2019 •

Copy link
Copy Markdown
Contributor

Related: #15251
Merge with extra: opencv/opencv_extra#683

force_builders=Custom,Custom Win,Custom Mac
build_image:Custom=ubuntu-openvino-2019r3.0:16.04
build_image:Custom Win=openvino-2019r3.0
build_image:Custom Mac=openvino-2019r3.0

test_modules:Custom=dnn,python2,python3,java
test_modules:Custom Win=dnn,python2,python3,java
test_modules:Custom Mac=dnn,python2,python3,java

buildworker:Custom=linux-1
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

Comment thread modules/dnn/src/onnx/onnx_importer.cpp Resolved
Comment thread modules/dnn/src/onnx/onnx_importer.cpp Outdated
else if (layer_type == "ReduceL2")
{
CV_Assert(node_proto.input_size() == 1);
CV_Assert(graph_proto.node(li + 1).op_type() == "Div");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check that node_size more than li first:

CV_Assert(graph_proto.node_size() > li && graph_proto.node(li + 1).op_type() == "Div");

Comment thread modules/dnn/src/onnx/onnx_importer.cpp Outdated
++li;

layerParams.type = "Normalize";
layerParams.set("p", 2);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"p" is 2 by default

Comment thread modules/dnn/src/onnx/onnx_importer.cpp Outdated
for (int j = 1; j < axes.size(); ++j) {
CV_Assert(axes[j - 1] + 1 == axes[j]);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid using this code? I mean keep default values of Normalize layer

Comment thread modules/dnn/src/onnx/onnx_importer.cpp Outdated
if (constBlobs.find(node_proto.input(1)) == constBlobs.end()) {
layerParams.type = "Eltwise";
layerParams.set("operation", "div");
} else {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format it in this way:

if
{
}
else
{
}

@dkurt dkurt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thank you.

@dkurt dkurt self-assigned this Nov 9, 2019
@alalek
alalek merged commit cfc7819 into opencv:3.4 Nov 9, 2019
@l-bat l-bat mentioned this pull request Nov 15, 2019
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Supported ONNX Squeeze, ReduceL2 and Eltwise::DIV

* Support eltwise div

* Fix test

* OpenCL support added

* refactoring

* fix code style

* Only squeeze with axes supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants