Skip to content

Added ngraph::op::v4::Interpolation#19716

Merged
opencv-pushbot merged 2 commits intoopencv:3.4from
l-bat:lb/fix_resize
Mar 13, 2021
Merged

Added ngraph::op::v4::Interpolation#19716
opencv-pushbot merged 2 commits intoopencv:3.4from
l-bat:lb/fix_resize

Conversation

@l-bat
Copy link
Copy Markdown
Contributor

@l-bat l-bat commented Mar 12, 2021

allow_multiple_commits=1

force_builders=Custom,Custom Win,Custom Mac
build_image:Custom=ubuntu-openvino-2021.2.0:20.04
build_image:Custom Win=openvino-2021.1.0
build_image:Custom Mac=openvino-2021.2.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
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Thank you!

#if INF_ENGINE_VER_MAJOR_LE(INF_ENGINE_RELEASE_2021_2)
auto mvn = std::make_shared<ngraph::op::MVN>(ieInpNode, acrossChannels, normVariance, eps);
#else
int64_t start_axis = 1 + !acrossChannels;
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.

I believe this should be more clear:

int64_t start_axis = acrossChannels ? 1 : 2;

auto out_shape = std::make_shared<ngraph::op::Constant>(ngraph::element::i64, ngraph::Shape{2}, shape.data());

auto& input_shape = ieInpNode->get_shape();
std::vector<float> scales = {static_cast<float>(outHeight) / input_shape[2], static_cast<float>(outHeight) / input_shape[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.

Please add CV_Assert(input_shape[2] != 0); before division.

Also it makes sense to evaluate static_cast<float>(outHeight) / input_shape[2] only once.

attrs.mode = ngraph::op::v4::Interpolate::InterpolateMode::linear_onnx;
attrs.coordinate_transformation_mode = ngraph::op::v4::Interpolate::CoordinateTransformMode::asymmetric;
} else {
CV_Error(Error::StsNotImplemented, "Unsupported interpolation: " + interpolation);
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 use cv::format()` here.

Old compilers may not like const char* operations.

Also it would lead to error if someone converts interpolation to int/enum in the future (code would compile w/o errors and const char* pointer arithmetic would be applied here)

@l-bat l-bat requested a review from alalek March 12, 2021 18:01
@opencv-pushbot opencv-pushbot merged commit 6da5c7c into opencv:3.4 Mar 13, 2021
@alalek alalek mentioned this pull request Mar 13, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
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