Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[I420 color conversion] I420toRGB/I420toBGR reference implementation #8605

Merged
merged 10 commits into from
Nov 18, 2021

Conversation

nosovmik
Copy link
Contributor

@nosovmik nosovmik commented Nov 15, 2021

Details:

  • Based on already existing NV12toRGB/BGR implementation
  • Reference implementation of color conversion from I420 to RGB/BGR formats
  • Specification is under separate PR: [OV20] I420toRGB and I420toBGR operations specification #8292
  • Tests:
    • ngraph: type_prop and visitor tests
    • Template plugin: reference evaluate
    • IE shared tests: compliance and accuracy tests
    • CPU: compliance tests (currently passed due to fallback)
    • IE functional tests: serialization tests

TODO:

  • OpenCV compliance tests will be added during integration of new ops to 'OV 2.0 preprocessing', like it is done for NV12

Tickets:

  • 62175
  • 71211

@nosovmik nosovmik requested review from ilya-lavrenov, ilyachur and a team November 15, 2021 17:46
@openvino-pushbot openvino-pushbot added category: TEMPLATE OpenVINO Template plugin category: IE Tests OpenVINO Test: plugins and common category: Core OpenVINO Core (aka ngraph) labels Nov 15, 2021
@nosovmik nosovmik requested a review from jane-intel November 17, 2021 06:10
Copy link
Contributor

@jane-intel jane-intel left a comment

Choose a reason for hiding this comment

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

Looks good with few comments. Agree to merge as is

namespace ngraph {
namespace op {
namespace v8 {
using ov::op::v8::I420toRGB;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we add it to old structure?
It has no legacy place, so it seems we can only keep it in openvino/ folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ilyachur Can you comment on this?
For NV12, you've requested to have such aliases in 'ngraph' namespace. See #7601 (comment)

Comment on lines +97 to +102
if (!shape_uv[i420_op::H_DIM].is_dynamic()) {
shape_uv[i420_op::H_DIM] *= 2;
}
if (!shape_uv[i420_op::W_DIM].is_dynamic()) {
shape_uv[i420_op::W_DIM] *= 2;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Basically we can multiply dimensions without checking if it is dynamic. Please see

Suggested change
if (!shape_uv[i420_op::H_DIM].is_dynamic()) {
shape_uv[i420_op::H_DIM] *= 2;
}
if (!shape_uv[i420_op::W_DIM].is_dynamic()) {
shape_uv[i420_op::W_DIM] *= 2;
}
shape_uv[i420_op::H_DIM] *= 2;
shape_uv[i420_op::W_DIM] *= 2;

Feel free to change it in the next PR -- as you stated in the description there will be a follow up PR.

Copy link
Contributor

@ilyachur ilyachur left a comment

Choose a reason for hiding this comment

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

I propose to use new evaluate API

}
};

TEST_F(ReferenceConvertColorI420LayerTest, CompareWithHardcodedRefs_r_u8_single_rgb) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you can use parametrized tests

bool visit_attributes(AttributeVisitor& visitor) override;

OPENVINO_SUPPRESS_DEPRECATED_START
bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can use new evaluate API

@ilyachur ilyachur merged commit 03c8542 into openvinotoolkit:master Nov 18, 2021
@ilyachur ilyachur deleted the ov20/i420_ref_impl branch November 18, 2021 06:48
openvino-dev-samples pushed a commit to openvino-dev-samples/openvino that referenced this pull request Nov 23, 2021
…penvinotoolkit#8605)

* ngraph part

* Template reference tests
Common plugin tests
CPU compliance tests
Serialization tests

* Clang format fixes

* Remove reference implementation for f16, bf16, f64 types

* Fix ninja build

* Fix opset8_dump test

* Fix opset8_dump test

* Fix CentOS build

* Removed Myriad preprocessing tests (to be added by separate PR)
openvino-dev-samples pushed a commit to openvino-dev-samples/openvino that referenced this pull request Nov 24, 2021
…penvinotoolkit#8605)

* ngraph part

* Template reference tests
Common plugin tests
CPU compliance tests
Serialization tests

* Clang format fixes

* Remove reference implementation for f16, bf16, f64 types

* Fix ninja build

* Fix opset8_dump test

* Fix opset8_dump test

* Fix CentOS build

* Removed Myriad preprocessing tests (to be added by separate PR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) category: IE Tests OpenVINO Test: plugins and common category: TEMPLATE OpenVINO Template plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants